Notes on using LaTeX for manuscripts: Difference between revisions

From csml-wiki.northwestern.edu
Jump to navigation Jump to search
mNo edit summary
Line 3: Line 3:


=== Formatting ===
=== Formatting ===
<ol>
# <span id="auctex"></span>Use a LaTeX-aware editor. A particularly powerful combination is [http://www.gnu.org/software/emacs/ Emacs] + [http://www.gnu.org/software/auctex/ AUCTeX].
<li><span id="auctex"></span>Use a LaTeX-aware editor. A particularly powerful combination is [http://www.gnu.org/software/emacs/ Emacs] + [http://www.gnu.org/software/auctex/ AUCTeX].</li>
# Make sure to keep your LaTeX file cleanly formatted (i.e., human readable). When using AUCTeX (see [[#auctex|above]]), take advantage of the LaTeX-aware paragraph rewrapping command (alt-q).
<li>Make sure to keep your LaTeX file cleanly formatted (i.e., human readable). When using AUCTeX (see [[#auctex|above]]), take advantage of the LaTeX-aware paragraph rewrapping command (alt-q).</li>
# Understand the difference between an end-of-sentence period and a period used in an abbreviation, and how LaTeX distinguishes these. A period after a lower-case letter is assumed to be the end of a sentence, and LaTeX needs to be told if this is ''not'' the case. So, 'et al.' must be typed as 'et al.\' unless it occurs at the end of a sentence. This is typically not true for 'i.e.' and 'e.g.' because those two abbreviations (at least in American English) are always followed by a comma: 'i.e.,' and 'e.g.,'<br>On the other hand, a period after a capital is assumed to be ''not'' the end of a sentence, and only needs special treatment if it actually is. Those cases are rare; a typical example would be the sentence 'See model A.' which must be entered as 'See model A\@.'<br>Note that the bibliography environment is exempt from these rules, so it is not necessary to write the '\' in 'Phys.\ Rev.\ Lett.\' (unless you use such a journal reference in the main text of your document). Of course, in practice, you should use [http://www.bibtex.org/ BibTeX] (see [[#bibtex|below]]) instead of creating a bibliography environment by hand.
<li>Understand the difference between an end-of-sentence period and a period used in an abbreviation, and how LaTeX distinguishes these. A period after a lower-case letter is assumed to be the end of a sentence, and LaTeX needs to be told if this is ''not'' the case. So, 'et al.' must be typed as 'et al.\' unless it occurs at the end of a sentence. This is typically not true for 'i.e.' and 'e.g.' because those two abbreviations (at least in American English) are always followed by a comma: 'i.e.,' and 'e.g.,'<br>On the other hand, a period after a capital is assumed to be ''not'' the end of a sentence, and only needs special treatment if it actually is. Those cases are rare; a typical example would be the sentence 'See model A.' which must be entered as 'See model A\@.'<br>Note that the bibliography environment is exempt from these rules, so it is not necessary to write the '\' in 'Phys.\ Rev.\ Lett.\' (unless you use such a journal reference in the main text of your document). Of course, in practice, you should use [http://www.bibtex.org/ BibTeX] (see [[#bibtex|below]]) instead of creating a bibliography environment by hand.</li>
# For labels of equations, figures, tables, choose names that start with 'eq:', 'fig:', 'tab:', respectively. Also, use descriptive labels. Labels of the form <tt>\label{eq:3}</tt> or <tt>\label{fig:1}</tt> are poor choices.
<li>For labels of equations, figures, tables, choose names that start with 'eq:', 'fig:', 'tab:', respectively. Also, use descriptive labels. Labels of the form <tt>\label{eq:3}</tt> or <tt>\label{fig:1}</tt> are poor choices.</li>
# Placement of labels: In a single displayed equation, put the <tt>\label</tt> command on the line immediately before the <tt>\end{equation}</tt> command. In a figure environment, place the label command immediately ''after'' the <tt>\caption{}</tt> command (not ''within'' the caption, and certainly not before it).
<li>Placement of labels: In a single displayed equation, put the <tt>\label</tt> command on the line immediately before the <tt>\end{equation}</tt> command. In a figure environment, place the label command immediately ''after'' the <tt>\caption{}</tt> command (not ''within'' the caption, and certainly not before it).</li>
# To include a figure, use the command<blockquote>\includegraphics[width=\figurewidth]{somefigure}</blockquote>Here the figure should ideally be scalable, so an Encapsulated Postscript ('.eps') file if you use LaTeX followed by dvips, or a PDF file if you use pdflatex. To facilitate switching between those programs, do ''not'' include the filename extension in the \includegraphics{} command, so, e.g., do ''not'' write \includegraphics{somefigure.pdf}.<br>Also, note that the width of the figure is specified via a macro, defined in the preamble of the LaTeX file via <blockquote>\newcommand{\figurewidth}{0.4\textwidth}</blockquote>This makes it easy to resize all the figures in a document at once. Finally, note that it is tempting to organize all figures in a subfolder, and then use \includegraphics{Figures/somefigure}. However, this is not permitted when submitting to ''Physical Review''.
<li>To include a figure, use the command
# Sentences cannot start with an abbreviation. Write 'Eq.', 'Fig.' and 'Ref.' in full. Replace 'E.g.,' at the beginning of a sentence with 'For example'. (Exception: ''Nature'' leaves 'Eq.', 'Fig.', 'Ref.' abbreviated.)
<pre>
# <span id="onlinecite"></span>In journals that use superscript-style references (e.g., ''Journal of Chemical Physics''), references that are a grammatical part of the sentence are not written in superscript. Use the <tt>\onlinecite</tt> command for this. For example: <tt>See Ref.~\onlinecite{somepaper}</tt>.
\includegraphics[width=\figurewidth]{somefigure}
</pre>Here the figure should ideally be scalable, so an Encapsulated Postscript ('.eps') file if you use LaTeX followed by dvips, or a PDF file if you use pdflatex. To facilitate switching between those programs, do ''not'' include the filename extension in the <tt>\includegraphics{}</tt> command, so, e.g., do ''not'' write <tt>\includegraphics{somefigure.pdf}</tt>.<br>Also, note that the width of the figure is specified via a macro, defined in the preamble of the LaTeX file via
<pre>
\newcommand{\figurewidth}{0.4\textwidth}
</pre>
This makes it easy to resize all the figures in a document at once. Finally, note that it is tempting to organize all figures in a subfolder, and then use <tt>\includegraphics{Figures/somefigure}</tt>. However, this is not permitted when submitting to ''Physical Review''.</li>
<li>Sentences cannot start with an abbreviation. Write 'Eq.', 'Fig.' and 'Ref.' in full. Replace 'E.g.,' at the beginning of a sentence with 'For example'. (Exception: ''Nature'' leaves 'Eq.', 'Fig.', 'Ref.' abbreviated.)</li>
<li>In general, displayed equations should be a grammatical part of the sentence. Avoid constructs like '...as shown in the following equation:'<br>This also implies that proper punctuation must be used in displayed equations. To avoid that a period or comma after a displayed equation is too close to the equation, insert a small space via '\;'. Thus, a proper construct would be:
<pre>
the mass increases quadratically with time,
\begin{equation}
m = t^2 \;.
\end{equation}
</pre></li>
<li><span id="onlinecite"></span>In journals that use superscript-style references (e.g., ''Journal of Chemical Physics''), references that are a grammatical part of the sentence are not written in superscript. Use the <tt>\onlinecite</tt> command for this. For example: <tt>See Ref.~\onlinecite{somepaper}</tt>.</li>
</ol>


=== <span id="bibtex">BibTeX</span> ===
=== <span id="bibtex">BibTeX</span> ===

Revision as of 14:35, 21 May 2014

This is not a LaTeX manual. Instead, it's a list of topics that have come up repeatedly within our lab in the preparation of manuscripts.


Formatting

  1. Use a LaTeX-aware editor. A particularly powerful combination is Emacs + AUCTeX.
  2. Make sure to keep your LaTeX file cleanly formatted (i.e., human readable). When using AUCTeX (see above), take advantage of the LaTeX-aware paragraph rewrapping command (alt-q).
  3. Understand the difference between an end-of-sentence period and a period used in an abbreviation, and how LaTeX distinguishes these. A period after a lower-case letter is assumed to be the end of a sentence, and LaTeX needs to be told if this is not the case. So, 'et al.' must be typed as 'et al.\' unless it occurs at the end of a sentence. This is typically not true for 'i.e.' and 'e.g.' because those two abbreviations (at least in American English) are always followed by a comma: 'i.e.,' and 'e.g.,'
    On the other hand, a period after a capital is assumed to be not the end of a sentence, and only needs special treatment if it actually is. Those cases are rare; a typical example would be the sentence 'See model A.' which must be entered as 'See model A\@.'
    Note that the bibliography environment is exempt from these rules, so it is not necessary to write the '\' in 'Phys.\ Rev.\ Lett.\' (unless you use such a journal reference in the main text of your document). Of course, in practice, you should use BibTeX (see below) instead of creating a bibliography environment by hand.
  4. For labels of equations, figures, tables, choose names that start with 'eq:', 'fig:', 'tab:', respectively. Also, use descriptive labels. Labels of the form \label{eq:3} or \label{fig:1} are poor choices.
  5. Placement of labels: In a single displayed equation, put the \label command on the line immediately before the \end{equation} command. In a figure environment, place the label command immediately after the \caption{} command (not within the caption, and certainly not before it).
  6. To include a figure, use the command
    \includegraphics[width=\figurewidth]{somefigure}
    
    Here the figure should ideally be scalable, so an Encapsulated Postscript ('.eps') file if you use LaTeX followed by dvips, or a PDF file if you use pdflatex. To facilitate switching between those programs, do not include the filename extension in the \includegraphics{} command, so, e.g., do not write \includegraphics{somefigure.pdf}.
    Also, note that the width of the figure is specified via a macro, defined in the preamble of the LaTeX file via
    \newcommand{\figurewidth}{0.4\textwidth}
    
    This makes it easy to resize all the figures in a document at once. Finally, note that it is tempting to organize all figures in a subfolder, and then use \includegraphics{Figures/somefigure}. However, this is not permitted when submitting to Physical Review.
  7. Sentences cannot start with an abbreviation. Write 'Eq.', 'Fig.' and 'Ref.' in full. Replace 'E.g.,' at the beginning of a sentence with 'For example'. (Exception: Nature leaves 'Eq.', 'Fig.', 'Ref.' abbreviated.)
  8. In general, displayed equations should be a grammatical part of the sentence. Avoid constructs like '...as shown in the following equation:'
    This also implies that proper punctuation must be used in displayed equations. To avoid that a period or comma after a displayed equation is too close to the equation, insert a small space via '\;'. Thus, a proper construct would be:
    the mass increases quadratically with time,
    \begin{equation}
       m = t^2 \;.
    \end{equation}
    
  9. In journals that use superscript-style references (e.g., Journal of Chemical Physics), references that are a grammatical part of the sentence are not written in superscript. Use the \onlinecite command for this. For example: See Ref.~\onlinecite{somepaper}.

BibTeX

Instead of entering references for each paper separately, we use BibTeX. This offers several advantages:

  • References are automatically sort in the order in which they are cited.
  • No need to enter references more than once.
  • No need to manually (re)format references to comply with the style of the journal.
  • Fixes to incorrect references will actually propagate to future manuscripts.

In BibTeX, references are entered as records in a database, and BibTeX extracts the references from that database, formats them for the appropriate journal, and compiles them in a properly sorted list (the '.bbl' file).

Detailed instructions can be found online or in the LaTeX manual by Lamport (copy available in the lab). Here we only discuss a few points specific to our usage.

  • We have several databases (.bib files), approximately divided by topics ('colloids.bib', 'polyelectrolytes.bib', etc.). We also have one database that only contains macros for journal names ('journals.bib').
  • At the end of the document, there will be just two commands:

    \bibliographystyle{journalstyle}
    \bibliography{journals,polyelectrolyte,colloids}

    ('polyelectrolyte' and 'colloids' are just examples of databases)
  • The 'journalstyle' is a style file ('.bst' file) that imposes the journal-specific formatting rules. Many journals provide such a style file. For other cases (specifically, Acta Materialia, Biophysical Journal, Journal of Polymer Science) we have produced our own style files. When using a journal-specific LaTeX style package (RevTeX for APS journals, achemso for ACS journals), the \bibliographystyle{} command can be omitted.
  • When entering a new record into a database, always include the article title, even when using the reference in a journal that will not show that title. Someone else later may need to cite the same reference in a situation where the title will be required (including NSF proposals).
  • The typical choice for the 'key' (label with which you refer to a reference) is 'johnson76', i.e., last name of the first author in all lower case, followed by the last two digits of the year. If that key is already taken, append lower case 'a', 'b', etc.

Journal-specific notes

Physical Review Letters

  • Use RevTeX 4.1 via

    \documentclass[aps,prl,reprint,showpacs,floatfix]{revtex4-1}

  • Abstract no longer than 600 characters
  • Prior to submission:
    • Replace the reprint option in the \documentclass{} command with preprint
    • Rerun LaTeX on this file twice
    • Comment out the \bibliography{} command
    • Insert the '.bbl' file into the LaTeX file
    • Note that EPS figures are required; PDF format is not permitted

Biophysical Journal

Journal of Chemical Physics

  • Invoke RevTeX 4.1 via

    \documentclass[aip,jcp,citeautoscript,amsmath]{revtex4-1}

  • The citeautoscript option will automatically convert citations of the style

    some sentence [2,3].

    to

    some sentence.2,3

    Note the location of the punctuation. Thus, simply enter all references as you would for inline style citations; it will automatically be arranged correctly. The only exception is a citation that you refer to explicitly, see LaTeX notes.
  • Prior to submission:
    • Add the preprint option to the \documentclass{} command
    • Rerun LaTeX on this file twice
    • Comment out the \bibliography{} command
    • Insert the '.bbl' file into the LaTeX file

Nano Letters

Nature