Bibliography Texshop Mac Bib

I wrote my last book (my only book, that is) using LaTeX. I had a large bibliography with close to 400 entries. I stored all of the bibliographic items in a BibTeX file (a text file ending in .bib). Each item looks something like this:

The beautiful thing about BibTeX is that after you cite works in your LaTeX document (for example ), the references are automatically generated in whichever bibliographic style you specify (APA, MLA, Chicago, etc.).

However, as you can see above, it is a pain to enter the bibliographic information by hand—the syntax is rather cumbersome. Fortunately there are a number of places on the web to get pre-formated BibTeX entries. You can pull them up in your browser, then copy-and-paste them in to your .bib file. Here are a few useful sites for mathematicians (I learned about a few of these from this MathOverflow conversation).

  • MathSciNet (subscription required)—this is the web front-end for the extensive Mathematical Reviews database. It currently has over 2 million items. It gives bibliographic information, reviews, and more.
  • MR Lookup—this is the free version of MathSciNet. It gives bibliographic information only.
  • Zentralblatt Math database (subscription required)—similar to MathSciNet, it has over 3 million items.
  • OttoBib—search for books by ISBN
  • Lead2Amazon—searches six different Amazon sites
  • Google Scholar—this is a well-known scholarly search site run by Google. If you click the “Scholar preferences” link you’ll see that under Bibliography Manager, one of the options is to “Show links to import citations into: BibTeX.” Now each Google Scholar search result will have a link to the BibTeX entry (see below).

Mac-only goodness: BibDesk + TexShop

I could create the .bib files using a text editor, but instead I use the great, free, Mac-only program BibDesk (see screenshot below).

I was a huge fan of BibDesk while writing my book, but it turns out I was using only a small fraction of its capabilities. I used it to create, edit, and organize bibliographic entries. It has a simple interface that allows you to enter bibliographic information into the fields provided. The file it creates is a .bib file, not a BibDesk file, so there is no need to export the information for use in LaTeX.

Even though I spent many, many hours using BibDesk, I never explored its other features (and now I’m kicking my self). I want to share a few of them with you now.

Importing BibTeX entries. Above I gave several locations on the web to go to find BibTeX entries for mathematical works. I’ve known for a while if I highlighted a BibTeX entry, then dragged-and-dropped the text onto the BibDesk program that it would create a new entry with the fields filled in. I thought that was cool. That was nothing. Recently I discovered that you can use BibDesk like a mini web browser and import bibliographic entries with one click.

On the side-bar click External>Web. The screen splits vertically into thirds. You get a little browser in the top third with links to MathSciNet, Zentralblatt Math, the arXiv, etc. You can also type in addresses (such as the ones I gave above) or create bookmarks. When you perform a search using one of these websites BibDesk uses the middle screen to list all of the bibliographic items it finds. (The bottom third is used to preview the contents.) Each entry has an “import” button next to it. When you find the item you want, click the button and you’re done (see below).

I also like that when you import an entry from MathSciNet it saves a direct link back to the page that contains the review.

(I see that you can also search databases, like the Library of Congress—these databases are found in the Search menu.)

Paper archive. If you have an electronic copy of an article (a pdf for instance), you can drag-and-drop it onto the BibTeX entry for the article. Then BibDesk will place the article into a dedicated folder of your choosing (and a subfolder named for the first author). Then you can access your articles straight from BibDesk. Not only that, you can use BibDesk’s search feature to search inside the articles!

I’ve written before about my love for DropBox. I have it set up so that my bibliographic files are in sync and so are my pdfs. Since the folder structures are the same, I can access all my articles through BibDesk on any of my computers.

TexShop integration. I’m also a die-hard TexShop user. This front-end for LaTeX is another free and elegant Mac-only program (which I may write about in another blog post). It integrates with BibDesk beautifully. If you type the beginning of a citation in TexShop, like , and then press F5 it will pull up a contextual menu listing all of the entries from your bibliography that could match that fragment. With a couple keystrokes you’re done.

Enjoy!

Like this:

LikeLoading...

Related

Using BibTex in LATEX documents

BibTex is a program that reads entries from a database of citations based on the output of LATEX and then makes a bibliography file that LATEX can insert into the document. There is lots to say about BibTex (and some good manuals that do it well) but here are some essentials I have found useful and not covered in the books. (There is a lot to say and learn about LATEX too).

Finding the material for a BibTex database is a chapter of its own, covered at least briefly at http://www.sci.utah.edu/~macleod/litbase

There is a repository of bibtex files available for use at the SCI Institute.

Quick Links:

  1. Usage Conventions
  2. Teaching Bibtex to find your bibtex files
  3. BibTex, PMCID, and the NIH
  4. Editing BibTex files
  5. Additional BibTex tools

1 Usage Conventions

There are a suggestions when using BibTex:

  1. The standard way to show citations in the text is as ``522'' where N is the reference number in the bibliography. We often use a style and a package called as in the LaTeX file that writes them as superscripted numbers. This style is also smart enough to find sequences of numbers and compress them, e.g., text1,2,3,4,5,9 becomes text1-5,9.
  2. Enter refs as you go and do not leave them all to the last minute! This makes for unnecessary stress when we need it least. Give us your refs in whatever form you have and we can get them entered now.
  3. If you are part of SCI (or otherwise smart and organized), please note the key naming conventions we use. You can find these in the SCI Bibtex tips web page.

2 Teaching Bibtex to find your bibtex files

The default location for the Bibtex files for a document are in the same directory as that document. A slightly better solution is to have a directory that holds all your Bibtex files and then hard-wire the commands in LateX to find those files.

A better way (the best way?) is to store all your Bibtex files in one place in your computer, ideally managed through a system like Subversion, and then to tell the Bibtex program where to look. How this works depends on the operating system and the Bibtex application, of course, but here are some typical examples. I found a lot of this information at this web site by Julien Dutant .

  • Unix, in all its flavors.
    This is the simplest but not the most common, sadly. The solution requires, of course, on an Environmental variable, which users typically set in a start script like .bashrc (for the Bash shell). # Set up the TeX environmentals TEXINPUTS=.:${HOME}/tex/latex: export TEXINPUTS BIBINPUTS=.:${HOME}/litbase/bibtex: export BIBINPUTS This bit of code also sets the TEXINPUTS environment variable, which is also helpful when one has some style files that are stored in a common directory and need to be available to all LaTeX files. ${HOME} is a built in variable that is set to be a user's home directory so this bit of code sets my LaTeX directory to ~macleod/tex/latex and my Bibtex directory to ~macleod/litbase/bibtex.
  • TexShop on the Mac (OSX)
    TexShop is based on TexLive and TeXLive requires a pre-set location, i.e., you cannot adjust this location and must store all .bib files in this place. The files go in
    ~/Library/texmf/bibtex/bib or subfolders of this directory.

    Of course, this directory is not directly visible in the modern versions of Mac OSX and the Finder, thus protecting users from all this tedious detail? To access the ~/Library directory, either use a terminal or use the "Go" command in the Finder but hold down the the option key to see this directory in the list. Here is what the result should look like:

    Once visible, you can maneuver to the texmf/ directory and then add the necessary bibtex/bib directories and store bibtex files there.

    I like to keep things in the same (visible) place for all programs that use bibtex so I have created a link between this standard location and the place TexShop wants to see things. This is a Terminal command so use with the usual care:

    cd ~/Library/tex/bibtex ln -s ~/litbase/bibtex bib You should then see something like the following (again from a terminal window): ls -l bib -> /Users/macleod/litbase/bibtex A above, this assumes my bibtex files are all in my ~/libtase/bibtex directory.
  • WinEdt
    In the control menu: Menu > Options > Executions Modes...
    A window opens with several tabs. In the "Console Applications" tab, you find a list of commands. Select bibtex, and add to the "Switches" field: --include-directory="F:\my bibliography folder"

3 BibTex, PMCID, and the NIH

NIH requires public disclosure of journal articles supported by NIH funding and all such articles receive a code called the PMCID as part of the PubMed system. As an NIH funded researcher, you MUST include this code every time you cite such a reference, especially in progress reports, proposals, and biosketches.

To support this code in BibTeX, I have created a slightly modified version of one of the most common BibTeX style files (.bst), which is available here.

To use this new style file,

  1. Add a field called "pmcid" to each BibTeX reference that contains the PMCID string, which you can locate by searching for the papers in the PubMed system.
  2. Modify your command to look (something) like this: \bibliography{strings,biglit,crj,rtw,jgs,md,cdh,dhb,jaw,crb,sci} \bibliographystyle{nihunsrt}

4 Editing BibTex files

To edit a BibTex file, you can use any editor but emacs has lots of great support for this process. The ones I like are Nelson Beebe's emacs tools found at www.math.utah.edu/pub/emacs/, in particular and .

Here is what my contains to access these:

;;; Add bibtex mode unconditionally; it is already bound to text-mode ;;; and we can do better than that. (delq (assoc "\\.bib$" auto-mode-alist) auto-mode-alist) (setq auto-mode-alist (cons (cons "\\.bib$" 'bibtex-mode) auto-mode-alist)) (autoload 'bibtex-mode "~/emacs/lisp/bibtex/bibtex" ;(autoload 'bibtex-mode "bibtex" "Enter BibTeX mode for bibliography editing." t nil) (setq bibtex-mode-hook '(lambda () (setq comment-end "") (setq comment-start "%% ") (setq comment-start-skip "%+ *") (setq bibtex-include-OPTcrossref nil) (setq bibtex-include-OPTkey nil) (setq bibtex-include-OPTannote nil) (setq bibtex-include-robnote t) (load "~/emacs/lisp/bibtex/bibtex-support") (load "~/emacs/lisp/bibtex/bibtools") ))

Note that these commands assume a subdirectory called in which the require lisp code ( or files) is available.

5 Additional BibTex tools

There are some other fun software tools that can make life easier with BibTex. Most are in the public domain in one form or another and I have included links where I had them--if the links fail, use Google and please let me know (macleod@sci.utah.edu).

5.1 EndNote

EndNote is not really a program that works on BibTexfiles but it does manage citations well and it has some support for BibTex that can make it useful.

See endnote.html for more details on how to convert between Endnote and BibTex.

5.2 bibclean

The goal of bibclean is to clean up syntax and layout errors in BibTex files so that all entries have a nice, clean look that is consistent. The program will also reveal some errors in the file, which can be very helpful! To get bibclean, surf on over to
and thank Nelson Beebe for making this available.

Here are some direct links that might be helpful

One of the many arguments to bibclean essential for SCI databases, if only because it is the convention we had adopted:

bibclean -no-fix-names which I actually alias to bibclean so that I don't forget!

5.3 Mendeley

The free literature databased program Meddeley has support for Bibtex output.

5.4 Converting from Word bibliography to BibTex

This is truly amazing! There is a website called hubmed.org that will convert from Word document text that you copy to the web page into Bibtex files! It actually works.

This program is some sort of search engine interface to Pubmed and it manages to parse the text and propose matches for each entry in the bibliography. I am really impressed with this tool!

5.5 Testing a BibTex file

There is a simple way to test a BibTex file for completeness using LATEX and the bibtex commands from your own computer. Testing is a good plan, especially if you do it after editing the file and not when you are in a hurry and have to build a document using the file.

To test a BibTex file, make a LaTeX file, call it with the following contents:

\documentclass[]{article} \begin{document} Some text. \nocite{*} \bibliography{sci} \bibliographystyle{unsrt} \end{document} where ``sci'' is the name of the BibTex file to test.

Then run

latex testbib bibtex testbib and the output will list all the errors or warnings resulting from trying to parse the file . Some of the output will be warnings that you can ignore but other errors can be fatal the next time you use the file.

5.5 BibDesk

BibDesk is a Mac OSX program to edit and manage your bibliography. It will keep track of both the bibliographic information and the associated files or web links for you. Read more at .

5.6 JabRef

JabRef is a new cross platform, open source program to edit and manage your bibliography. It performs searches and downloads articles (assuming they are open access) and seems to have a lot of customlization options. It claims to integrate well with many LaTeX systems/editors, including eXstudio, LyX, Kile, LatexEditor, Emacs, Vim, and WinEdt.


Last modified: Sat Mar 25 08:37:38 MDT 2017

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *