Created
March 26, 2012 19:49
-
-
Save baoilleach/2209175 to your computer and use it in GitHub Desktop.
Example TeX file showing how to embed SMILES strings into LaTeX as images
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\documentclass{article} | |
% -- Add this section to your LaTeX doc | |
% Remember to use "pdflatex -shell-escape myfile.tex" | |
% or it won't allow LaTeX to call any command-line | |
% programs! | |
\usepackage{graphicx} | |
\newcounter{smilescounter} | |
\setcounter{smilescounter}{1} | |
\newcommand{\smiles}[1]{ | |
\immediate\write18{obabel -:"#1" -O smilesimg\arabic{smilescounter}.png} | |
\includegraphics{smilesimg\arabic{smilescounter}.png} | |
\addtocounter{smilescounter}{1} | |
} | |
% -- End of section | |
\title{This is an example of use} | |
\author{Noel O'Boyle} | |
\date{26 March 2012} | |
\begin{document} | |
\maketitle | |
The following images were created using the smiles command. | |
\begin{figure}[h!] | |
\smiles{CCO} | |
\caption{Ethanol.} | |
\centering | |
\end{figure} | |
\begin{figure}[h!] | |
\smiles{[C@H]2(OC1O[C@@H]([C@@H](O)[C@H](O)[C@H]1O)CO)[C@H](O)[C@@H](O)C(O[C@@H]2CO)O[C@H]3[C@H](O)[C@@H](O)[C@H](O[C@@H]3CO)O} | |
\caption{Not ethanol.} | |
\centering | |
\end{figure} | |
\end{document} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment