6

MWE:

\documentclass{report}
\usepackage{chemfig} %for chemistry diagrams

\begin{document}
   \vspace{10mm}
   \setatomsep{2em}
   \begin{center}
      \chemfig{%
         CH(-[:180]CH_{3})(-[:0]CH_{3})(-[:90]CH_{3})
      }
   \end{center}
   1-chloro-3-methylbutane
   \begin{center}
      \chemfig{%
         CH_{3}-[:0]CH_{2}-[:0]CH(-[:90]CH_{3})(-[:0]CH_{3})
      }
   \end{center}
   1-chloro2-methylbutane
   \vspace{10mm}
\end{document}
%

output:

two chemfigs with labels all on their own line

desired output:

enter image description here

What is the best way for me to accomplish this.

2 Answers 2

3

chemfig provides the command \chemname{<molecule>}{<name>} for writing a name below a molecule. It has an optional argument for the vertical offset and if the molecules have a different depth possibilities are provided to align the names anyway. This is described with examples in section 12 Writing a name under a molecule in chemfig's manual.

With it both molecules can simply be written one after the other.

enter image description here

\documentclass{report}
\usepackage{chemfig} %for chemistry diagrams

\setatomsep{2em}

\begin{document}

% the `center' environment should probably be a `figure'
% environment or maybe a newly declared `scheme' environment
% (with the help of the `newfloat' package) but it does its
% work here:
\begin{center}
  \chemname{%
    \chemfig{%
      CH(-[:180]CH_{3})(-[:0]CH_{3})(-[:90]CH_{3})
    }
  }{1-chloro-3-methylbutane}
  % separate both molecules by 2em:
  \qquad
  \chemname{%
    \chemfig{%
      CH_{3}-[:0]CH_{2}-[:0]CH(-[:90]CH_{3})(-[:0]CH_{3})
    }
  }{1-chloro2-methylbutane}
\end{center}


\end{document}
1
  • 2
    BTW: the names seem to have nothing to do with the molecules?
    – cgnieder
    May 29, 2013 at 8:05
0

You could put it in a tabular environment.

  • The \\ command separates each row of the table. I write \\[2mm] to add extra 2mm of vertical space between the rows.
  • Within a row, the & command separates each column.
  • The {cc} declares a two-column table, and the c means that the contents of each column is centred.

Code:

\documentclass{report}
\usepackage{chemfig} %for chemistry diagrams

\begin{document}
   \setatomsep{2em}
   \begin{tabular}{cc}
      \chemfig{%
         CH(-[:180]CH_{3})(-[:0]CH_{3})(-[:90]CH_{3})
      }
  &
      \chemfig{%
         CH_{3}-[:0]CH_{2}-[:0]CH(-[:90]CH_{3})(-[:0]CH_{3})
      }
  \\[2mm]
   1-chloro-3-methylbutane
  &
   1-chloro2-methylbutane
\end{tabular}
\end{document}

enter image description here

By the way:

  • \vspace{...} doesn't do anything at the top of a page. (But \vspace*{...} does.)

  • You probably ought not to use the center environment in the way that you do -- see this answer by David Carlisle for why \centering might be more appropriate than \begin{center}...\end{center}.

2
  • I don't believe \begin{centering} works for chemfig...wait did you mean \begin{centering} or \centering
    – puk
    May 29, 2013 at 20:29
  • @puk There is no {centering} environment, only a \centering command for formatting the current paragraph. It works well with chemfig's formulae and schemes as they're just TikZ pictures in the end.
    – cgnieder
    May 29, 2013 at 23:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .