latex, thesis writing, writing

LaTeX commands for chemistry

LaTeX is great for writing theses, although collaboration with other authors on LaTeX files can be a pain.* Below I have listed a few LaTeX commands that I used when I was writing up my thesis. They are very basic, but they are useful because they save some typing and ensure that the same formatting is used each time. In particular, the \moles command and the \micro command for formatting moles and microanalysis** in standard notation, respectively. There are many more that I could write about, but I am short of time at the moment. Hopefully, at some point, I will update with a more substantial (and useful) list.


\newcommand{\celsius}{$^{\circ}$C} %a degrees Celcius symbol (to avoid use of superscript 'o', the bane of my life
\newcommand{\gs}[4]{$#1^#2_#3(#4)$} %Etter's graph-set notation, for hydrogen-bonded systems
\newcommand*{\moles}[2]{#1 $\times$ 10$^{#2}$ mol} formats number of moles in standard form
\newcommand*{\Moles}[2]{#1 $\times$ 10$^{#2}$ \textsc{m}} %formats molar quantities in standard form
\newcommand{\Molar}{\textsc{m}} %formats a small-caps M
\newcommand{\micro}[7]{\textbf{Microanalysis:} Calculated for \textbf{\ce{#1}} (\%) C, #2; H, #3; N, #4; Found (\%) C, #5; H, #6; N, #7.} %formatting of microanalysis results
\newcommand{\melt}[2]{m.p. #1--#2 \celsius} %melting point ranges

\newcommand{\yield}[2]{\textbf{Yield:} #1, #2 \%} %yields formatted as Yield: quantity (write number and quantity symbol, e.g., \yield{2 g}{94}

Below is the output of a few of these commands.

examples
Example of the pdfLaTeX output

These were output by using the commands at the head of the page according to the following usage:


...forming a hydrogen-bonded \gs{R}{1}{2}{5} ring.\\

A 10 \Molar{} sodium hydroxide solution.\\

An aqueous solution of \textbf{1} (\moles{1.1}{-5}).\\

\micro{C14H30}{14}{14}{14}{14}{14}{14} \yield{2 g}{94}, \melt{100}{103}

I hope you find them useful.

*However, nowadays, many collaborative, cloud-based LaTeX services are available. e.g., Overleaf.

**Requires the mhchem package to format chemical formulae.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s