From the mind of Seth Holloway, to you
RSS icon Email icon Home icon
  • Working with LaTeX: See all your citations

    Posted on July 9th, 2009 Seth 1 comment

    UPDATE

    J.P. Knight left a much easier solution in the comments. If you want to see all of your citations the easy way, simply put the \nocite{*} command into your latex file as seen below.

    \documentclass[11pt]{report}
    \usepackage{natbib}
    \bibpunct{(}{)}{;}{a}{,}{,}
    \begin{document}
    \bibliographystyle{apalike}
    \nocite{*}
    \bibliography{proposal}    %% your bib file name here
    \end{document}

    Thanks J.P!
    ORIGINAL

    I’m currently writing my dissertation (technically my proposal) in LaTeX (think Microsoft Word without the WYSIWYG interface). As I’m searching for citations, I am overwhelmed at the number of sources in my bibtex file. Rather than staring at the bland, perhaps bloated, syntax with curly braces, spaces, and commas, I created a little script that would let me see how the citations will look in the paper–in a nice PDF bibliography. Here, I present seeAllCitations.sh which takes in your bibtex file as an argument and creates a file with all of your potential citations. After the script completes, just “compile” the file as you normally would and open the resulting pdf/dvi.

    #!/bin/sh

    # Check input for one argument
    if [ $# -ne 1 ]; then
    echo “Please input your .bib file as an argument”
    echo “Example: ./seeAllCitations.sh proposal.bib”
    exit 1
    fi

    #  Create the file
    echo “Creating seeAllCitations.tex that will allow you to see all citations.”

    # Create a simple tex file that will include citations
    echo “\documentclass[11pt]{report}
    \usepackage{cite}
    \usepackage{url}
    \\\begin{document}
    \n
    All citations from $1 shown below
    \n
    %% Begin citations” > seeCitations.tex

    cat $1 |grep @ |sed s/^@.*{/\\\\\\cite{/ |sed s/,.*$/}\\\\\\\\/ >> seeCitations.tex

    echo “%% End citations
    \n
    \\\bibliographystyle{abbrv}
    \\\bibliography{$1}
    \n
    \\\end{document}” >> seeCitations.tex

    # Process completed
    echo “Process completed. Enjoy!”
    echo “Confused about what to do next? Create the document. For example:
    pdflatex seeCitations.tex
    bibtex seeCitations.tex
    pdflatex seeCitations.tex
    open seeCitations.pdf”
    exit 0

    See any mistakes? Was that at all helpful? Do you have a different (read: better) method for checking your citations?