# Names of chemistry compounds are too long and overlap

How do I ensure that the structural formulas are adapted to the width of the text and that the names of the compounds do not overlap?

The only thing I could still imagine would be to split the structural formulas over 2 lines, but what is the best way to do this?

\documentclass{scrartcl}

\usepackage{blindtext}
\usepackage{chemfig}
\setchemfig{atom sep=2.25em}

\begin{document}

\section{Structural formula}

\begin{center}
\chemnameinit{\chemfig{H-C(-[2]H)(-[6]H)-OH}}
\schemestart
\chemname{
\chemfig{*6(=(-OH)-=-(-(=[-4.5]O)-[1]OMe)=-)}
}{Methyl 4-hydroxybenzoate}
\chemname{
\chemfig{*6(=(-OH)-=-(-(=[-4.5]O)-[1]OEt)=-)}
}{Ethyl 4-hydroxybenzoate}
\chemname{
\chemfig{*6(=(-OH)-=-(-(=[-4.5]O)-[1]OPr)=-)}
}{Propyl 4-hydroxybenzoate}
\chemname{
\chemfig{*6((=O)-N(-Me)-*5(-N=-N(-Me)-=)--(=O)-N(-Me)-)}
}{Caffeine}
\chemname{
\chemfig{H_2N-[:52.24](=[:90]S)-[::-104]NH_2}
}{Thiourea}
\chemname{
\chemfig{H-C(-[2]H)(-[6]H)-OH}
}{Methanol}
\schemestop
\end{center}

\section{Experimental procedure}

\blindtext

\end{document}


• Make the names smaller? Rotate the names? Alternate vertical position of names? – Galen Jul 22 at 1:06
• @Galen The only thing I could still imagine would be to split the structural formulas over 2 lines, but what is the best way to do this? – Schubladenzieher Jul 22 at 1:10
• Why not use bold compound numbers to denote each structure (e.g. 42), and denote the names in text? This is how the majority of journals and publishers like Nature, ACS or Elsevier recommend to deal with long chemical names under the structures. Also, you need to correct the geometry of carbonyl groups and thiourea — those angles look off. – andselisk Jul 22 at 9:32

What about one of the following two suggestions?

\documentclass{scrartcl}

\usepackage{blindtext}
\usepackage{chemfig}
\setchemfig{atom sep=2.25em}
\begin{document}

\section{Structural formula}

\begin{center}
\schemestart
\chemname{
\chemfig{*6(=(-OH)-=-(-(=[-4.5]O)-[:30]OMe)=-)}
}{Methyl 4-hydroxybenzoate}
\hspace{2cm}
\chemname{
\chemfig{*6(=(-OH)-=-(-(=[-4.5]O)-[:30]OEt)=-)}
}{Ethyl 4-hydroxybenzoate}
\hspace{2cm}
\chemname{
\chemfig{*6(=(-OH)-=-(-(=[-4.5]O)-[:30]OPr)=-)}
}{Propyl 4-hydroxybenzoate}
\schemestop
\bigskip

\schemestart
\chemname{
\chemfig{*6((=O)-N(-Me)-*5(-N=-N(-Me)-=)--(=O)-N(-Me)-)}
}{Caffeine}
\chemname{
\chemfig{H_2N-[:30](=[:90]S)-[::-60]NH_2}
}{Thiourea}
\chemname{
\chemfig{H-C(-[2]H)(-[6]H)-OH}
}{Methanol}
\schemestop
\end{center}

\section{Structural formula}

\begin{center}
\schemestart
\hspace{1.25cm}
\chemname{
\chemfig{*6(=(-OH)-=-(-(=[-4.5]O)-[:30]O-[:0]R)=-)}
}{{\begin{tabular}[t]{l@{\;}l}
R = Me: & Methyl 4-hydroxybenzoate\\
R = Et: & Ethyl 4-hydroxybenzoate\\
R = Pr: & Propyl 4-hydroxybenzoate
\end{tabular}}}
\hspace{0.75cm}
\chemname{
\chemfig{*6((=O)-N(-Me)-*5(-N=-N(-Me)-=)--(=O)-N(-Me)-)}
}{Caffeine}
\chemname{
\chemfig{H_2N-[:30](=[:90]S)-[::-60]NH_2}
}{Thiourea}
\chemname{
\chemfig{Me-OH}
}{Methanol}
\schemestop
\end{center}

\section{Experimental procedure}

\blindtext

\end{document}

• What I don't like about the first example is that the structural formulas in the first line are arranged much wider (to the left and right) than the structural formulas in the second line. It would be nice if the structural formulas from the first line were arranged vertically the same as those from the second line, but that probably only works with a tabular environment, right? – Schubladenzieher Jul 22 at 16:00
• I really like the second example, only the chemnames have an uneven vertical placement here. Do I have to use \chemnameinit here again? – Schubladenzieher Jul 22 at 16:01
• @Schubladenzieher: Regarding the horizontal space between compunds in the second row of the first example: You could also add \hspace commands there , just like I did with the compounds in the first row. I entirely overlooked the vertical alignment issue of the names in the second example. I'll check if I can fix that. – leandriis Jul 22 at 16:50
• Did you find a solution to the problem? – Schubladenzieher Jul 23 at 17:40
• @Schubladenzieher: Unfortunately not. As a work around, you could use a tabular environment inside of a all name parts of the \chemname commands. – leandriis Jul 23 at 20:30

Tray by use of tabular environment and break long names into two lines (write them in \parbox):

\documentclass{scrartcl}

\usepackage{blindtext}
\usepackage{chemfig}
\setchemfig{atom sep=2em}
\usepackage{booktabs}

\begin{document}

\section{Structural formula}

\begin{center}
\schemestart
\begin{tabular}{ccc}
\chemname{
\chemfig{*6(=(-OH)-=-(-(=[-4.5]O)-[1]OMe)=-)}
}{\parbox{8em}{\centering   Methyl 4-hydro\-xybenzoate}}
&
\chemname{
\chemfig{*6(=(-OH)-=-(-(=[-4.5]O)-[1]OEt)=-)}
}{\parbox{7em}{\centering   Ethyl 4-hydro\-xybenzoate}}
&
\chemname{
\chemfig{*6(=(-OH)-=-(-(=[-4.5]O)-[1]OPr)=-)}
}{\parbox{7em}{\centering  Propyl 4-hydro\-xybenzoate}}
\\
\chemname{
\chemfig{*6((=O)-N(-Me)-*5(-N=-N(-Me)-=)--(=O)-N(-Me)-)}
}{Caffeine}
&
\chemname{
\chemfig{H_2N-[:52.24](=[:90]S)-[::-104]NH_2}
}{Thiourea}
&
\chemname{
\chemfig{H-C(-[2]H)(-[6]H)-OH}
}{Methanol}
\end{tabular}
\schemestop
\end{center}

\section{Experimental procedure}

\blindtext

\end{document}


Edit: From your comment follows, that useing tabular doesn't gives good result. Since it is not clear, what is for you "good result" here is option without ose of tabular and with formulas names in just one line:


\usepackage{blindtext}
\usepackage{chemfig}
\setchemfig{atom sep=2em}

\begin{document}

\section{Structural formula}

\begin{center}
\schemestart
\chemname{
\chemfig{*6(=(-OH)-=-(-(=[-4.5]O)-[1]OMe)=-)}
}{Methyl 4-hydroxybenzoate}
\hspace{6em}
\chemname{
\chemfig{*6(=(-OH)-=-(-(=[-4.5]O)-[1]OEt)=-)}
}{Ethyl 4-hydroxybenzoate}
\hspace{6em}
\chemname{
\chemfig{*6(=(-OH)-=-(-(=[-4.5]O)-[1]OPr)=-)}
}{Propyl 4-hydroxybenzoate}
\schemestop

\medskip
\schemestart
\chemname{
\chemfig{*6((=O)-N(-Me)-*5(-N=-N(-Me)-=)--(=O)-N(-Me)-)}
}{Caffeine}
\chemname{
\chemfig{H_2N-[:52.24](=[:90]S)-[::-104]NH_2}
}{Thiourea}
\chemname{
\chemfig{H-C(-[2]H)(-[6]H)-OH}
}{Methanol}
\schemestop
\end{center}

\section{Experimental procedure}

\blindtext

\end{document}


Is now better?

• Is there a way without using \parbox and the tabular environment? It does not look so good to be honest... – Schubladenzieher Jul 22 at 2:07
• @Schubladenzieher, of course the image can be composed without using tabular table, but what is not nice? How the image should looks? To me they looks fine :-) – Zarko Jul 22 at 2:09