Branching from the core series of LaTeX introduction, here is a specialized series on writing chemistry papers and dissertations in $latex LaTeX$. In this part, we will download, open, and clean up a RSC template, yielding a cleaner framework for writing.
Joseph Wright has published some amazing tools for writing chemistry with LaTeX, and they make writing much simpler to do than otherwise. Thank you!
A First Pass at the Templates
Many journals have LaTeX templates available, including RSC and ACS journals, as well as Wiley books. These bundles generally contains all necessary packages, define the layout of the journal, and usually also take care of the bibliography format. For example, the Royal Society of Chemistry bundle includes:
- A – how to use the templates
- B – .tex, the template file whose content is to be replaced with your magnificent research
- C – .bib, the BibTeX file containing the reference. For simplicity, you can delete this, place your own .bib file here, and rename it rsc.bib
- D – .bst, the bibliography style file. This tells $latex LaTeX$ how to format the bibliographies in the RSC style (i.e., A. Bradacabra, Journal of Medieval Chemistry, 1650, 34, 54-34.)
- E – .sty, the additional packages that the template uses but your local installation may not have. You can see these called in the preamble of the template .tex.
You may not have the auxiliary files initially, so don’t worry if my folder seems more populated than yours. After reading the readme and guidance documents, I suggest opening up pccp.tex in your tex-editor, and typeset the document once. Let’s walk through part of the template:
Sections A and B comprise the “preamble” of the document (see here for explanation of a LaTeX document). A tells LaTeX how the document ought to look – for example, it should be 2 columns as opposed to a single column (needless to say, you really don’t want to be changing this). B tells LaTeX which packages it should use to extend its functionality. For example, the line
instructs LaTeX to use the natbib package (Natural sciences Bibliography). In additional, it instructs natbib to format citations by superscripts, and when multiple citations are used together, to sort and compress them. If you are missing a package, the typesetting engine will complain and refuse to work; you will need to then find and install the appropriate package from CTAN. Reading up on the documentation will allow you to best harnass the functions from the package. In a moment, we will be adding a package to extend the functionality of the template.
From C onwards is the main text of the document. I’ve added headers/ at D (and a few places after) to make it format properly – without this addition, the code would not know where to find LH.pdf, since it is hidden inside the headers folder. (I also rename a b926007m-ga.jpg into the supplied example.jpg).
Sidenote – if your complains about all that LaTeX instructions, check out this post: Spellchecking LaTeX.
To correctly see the bibliography, you will need to
- typeset with LaTeX
- run BibTeX,
- run LaTeX, and
- run LaTeX again.
In both MiKTeX and TeXshop, BibTeX is accessed from the choice box beside Typeset.
If your output panel shows any error, this is the time to resolve it. When it no longer show any error, save a copy of the template pccp.tex (so you can refer to the instructions later), and go on to clean up the template; we don’t really want all that clutter. In the next section I’ll show you my preferred “clean” template.
Gearing up to Write
The first thing I did was rename my clean template to zManuscript.tex. What this does is to put all the auxiliary files at the bottom of the directory structure, and everything else near the top. (This is important when we start using PSTricks package, which generate large amounts of clutter.)
I also create directories for my figures, schemes, manuscript, and bibliographies. The only things left in the base directory, then, are the packages, and the core manuscript. The final structure looks like:
zManuscript.tex is trimmed to reflect this new organization:
A – removed section header.
B – the examples are deleted. Instead of writing with all these RSC stuff, the main text is moved over to a separate .tex file (only the filename need to be mentioned here, and not the extension). The content of that file is processed as normal when zManuscript is typeset.
C – notice that we have added a bib/ path, in conjunction with the folder structure above. Otherwise LaTeX would not know where to find rsc.bib and rsc.bst!
The actual writing, in this example, is contained in manuscript/section1.tex, and it gives the following output:
We have something to work with, and in the next part, we’ll complete the package by integrating chemstyle with it.