Common Pitfalls When Citing Without In-Text References In Latex

Inserting Bibliographic Information Directly in the Text

One mistake that LaTeX users often make when citing sources is to directly insert the bibliographic information into the text instead of using citation commands. For example, a user may copy and paste part of a book's bibliographic entry like "(Knuth, 1984)" rather than using the proper \cite{knuth1984} command.

There are several issues with adding the information manually without citation commands:

  • It breaks the separation between content and bibliographic data
  • It leads to formatting inconsistencies in the rendered PDF
  • It prevents LaTeX from automatically numbering citations
  • It does not allow using bibliography styles to format the citations

Here is an example of the wrong way to add a citation directly in LaTeX:

As shown in (Knuth, 1984), LaTeX is very useful for document preparation.  

And here is the correct method using a citation command:

As shown in \cite{knuth1984}, LaTeX is very useful for document preparation.

Using citation commands allows LaTeX to handle all the formatting and numbering automatically based on the chosen bibliography style.

Forgetting to Run BibTeX

Another common mistake when working with BibTeX in LaTeX is to forget to run BibTeX after the initial LaTeX compile.

The typical LaTeX workflow when using BibTeX is:

  1. LaTeX compile to create .aux file with citations
  2. BibTeX run to create .bbl file with references
  3. LaTeX compile twice more to insert references

Often users will run LaTeX once, then immediately again, wondering why citations are showing up as [?] marks in the output PDF. The issue is that BibTeX was never executed to read the citation commands and build the actual reference list.

Here is an example sequence when this step is forgotten:

Run LaTeX -> [?]-style citations shown  
Run LaTeX again -> No change, [?]'s still shown

And here is the correct sequence:

Run LaTeX -> [?]'s shown  
Run BibTeX -> Process .aux to create .bbl with references 
Run LaTeX -> References shown  
Run LaTeX again -> Final formatted PDF with references

Remembering to insert the critical BibTeX step avoids undefined reference errors in the final PDF.

Using Incorrect Citation Keys

When inserting citation commands like \cite{mykey}, the citation key such as "mykey" must exactly match what is defined in the BibTeX .bib database file. If invalid keys are used, LaTeX will output warning messages about missing references.

For example, if a citation command tries to use a key like:

\cite{smith2022} but the bib file has no matching @entry with key smith2022

LaTeX will fail to find that reference in the bibliography database and output a warning to that effect. This often occurs due to typos or case-sensitivity mismatches between keys used in the LaTeX text and defined keys in the BibTeX file.

Some best practices regarding citation keys include:

  • Manually check that all citation keys exactly match bib file keys
  • Use a reference manager to help avoid mismatches
  • Use unique, informative keys like smith2022laser not smith

Carefully managing the keys ensures that citations in text map correctly to references populated by BibTeX.

Using Invalid Citation Commands

LaTeX defines standard citation commands like \cite, \citep, and \citet to handle references from BibTeX files. Using improperly formatted commands will lead to citation insertion issues or error messages.

Some common issues include:

  • Using commands like \citations or \references that don't exist
  • Forgetting curly braces to delimit citation keys e.g. \cite smith2022
  • Nesting citations too deeply e.g. \cite{\cite{smith2022}}

Here is an example of a valid citation insertion:

\citep{smith2022} showed the importance of citation management.

And here is one using an invalid made-up command:

\citation{smith2022} showed the importance of citation management.

Sticking to standard citation macros helps avoid formatting issues or undefined command messages.

Not Including the Bibliography Style

The final step when working with BibTeX citations is to include the \bibliographystyle and \bibliography commands where the rendered bibliography should display.

Common bibliography styles include:

  • plain (default)
  • unsrt (by entry order)
  • alpha (alphabetical)
  • abbrv (abbreviated)

Here is an example document missing these commands:

Citations shown \cite{smith2022}.

This would compile but lack a bibliography section. Here is the fix:

Citations shown \cite{smith2022}.  

Now the rendered PDF will contain the properly formatted bibliography showing the cited reference(s).

Leave a Reply

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