Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question

2 Answers 2

up vote 2 down vote accepted

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}
share|improve this answer
1  
BTW: the names seem to have nothing to do with the molecules? –  cgnieder May 29 '13 at 8:05

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}.

share|improve this answer
    
I don't believe \begin{centering} works for chemfig...wait did you mean \begin{centering} or \centering –  puk May 29 '13 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 '13 at 23:39
    
@cgnieder thanks for clearing that up. –  puk May 30 '13 at 2:11

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.