# How to line up a chemical structure in the table (chemfig)?

I have a table which has three rows of chemical structures. The structures in the second row are not lined up with the first and third rows. I tried to use \vspace to bring the structure down but it didn't help. How to change the position of the structure in the table? Any help is greatly appreciated!

My sample code:

\documentclass[12pt,doublespacing,letterpaper]{report}
\usepackage{etex}
\usepackage[usenames,dvipsnames]{color}
\usepackage{lscape}
\usepackage{morehelp}
\usepackage{setspace}
\usepackage{easytable}
\usepackage{chemfig}
\usepackage{longtable}
\usepackage{graphicx}
\usepackage{dcolumn}
\usepackage{bm}
\usepackage{geometry}
\usepackage{multirow}
\usepackage{caption}

\begin{document}

\setatomsep{2em}
\setbondoffset{1pt}
\setdoublesep{4pt}
\setbondstyle{line width=0.8 pt}

\renewcommand{\printatom}[1]{\fontsize{14pt}{14pt}\selectfont{\ensuremath{\mathrm{#1}}}}

\begin{table}[t]
\centering \caption{Test}
\begin{footnotesize}
\begin{tabular}{>{\centering\arraybackslash}p{20pt}>     {\centering\arraybackslash}p{160pt}
>{\centering\arraybackslash}p{60pt}>{\centering\arraybackslash}p{160pt}>  {\centering\arraybackslash}p{20pt}}
\hline\hline
\\[-5pt] %controls the spacing between line and text
\vfill Entry & \vfill RBF$_3$K  &\vfill Ar-Br &\vfill R-R & Yield (\%)\\
\\[-5pt]\hline
\\[-7pt]
1 & \chemfig[][scale=0.6]{[:30]--[::-60]--[::-60]-[:30]-[:-30]~[:0]-[:0]BF_3K} & \chemfig[][scale=0.6]{[:30]NC-*6(-=-(-[,1.3]Br)=-=)} & \chemfig[][scale=0.6]{[:30]--[::-60]--[::-60]-[:30]-[:-30]~[:0]-[:0]*6(-=-(-CN)=-=-)}&75\\
2 & \chemfig[][scale=0.6]{[:30]--[::-60]--[::-60]-[:30]-[:-30]~[:0]-[:0]BF_3K} & \chemfig[][scale=0.6]{[:30]Cl-*6(-=-(-[,1.3]Br)=-=)} & \chemfig[][scale=0.6]{[:30]--[::-60]--[::-60]-[:30]-[:-30]~[:0]-[:0]*6(-=-(-Cl)=-=-)}&65\\
\hline\hline
&\\
\end{tabular}
\end{footnotesize}
\\
\end{table}

\end{document}

• Just a quick comment: Use ex instead of pt when dealing with vertical spacing (and em instead of pt when dealing with horizontal spacing); pt isn't font dependant. – Svend Tveskæg Jul 29 '13 at 15:20
• I guess you want m{} type columns instead of p{} type ones. (BTW: all the packages you load seem unrelated to the problem. It doesn't even seem to be a chemfig problem..., also: the table currently exceeds \textwidth) – clemens Jul 29 '13 at 15:42

I don't normally advertize the tabu package (see this post for reasons why) but in this case it is very handy. It scales the table horizontally to textwidth per default if you use its X type columns. Those columns have an optional argument for specifying the ratio of one column to another: X[1]X[2] would mean that the second column has a width twice as much as the first. In the optional argument you can also specify what traditional column type you'd like to have. I used X[<num>c,m] to have all cells centered both vertically and horizontally.

Instead of scaling each of the molecules I redefined the atom-sep and the \printatom command inside the table environment. Since this is inside the environment the effect of the redefinitions will stay local.

In the code below I removed all unnecessary packages. Instead I introduced mhchem (I could also have used chemformula) for inline chemical formulae, and booktabs for nicer table rules:

\documentclass[12pt,letterpaper]{report}
\usepackage{chemfig}
\usepackage[version=4]{mhchem}
\usepackage{tabu}
\usepackage{booktabs}

\setatomsep{2em}
\setbondoffset{1pt}
\setdoublesep{4pt}
\setbondstyle{line width=0.8 pt}
\renewcommand{\printatom}[1]{\fontsize{14pt}{14pt}\selectfont{\ensuremath{\mathrm{#1}}}}

\begin{document}

\begin{table}[t]
\centering
% locally change the molecule layout
\setatomsep{.8em}
% the following is necessary because you have defined \printatom with
% a fixed fontsize:
\renewcommand*\printatom[1]{\scriptsize\ensuremath{\mathrm{#1}}}
\caption{Test}
\begin{tabu}{X[3c,m]X[8c,m]X[5,cm]X[9c,m]X[3c,m]}
\toprule\rowfont\bfseries
Entry & \ce{RBF3K}  & \ce{Ar-Br} & \ce{R-R} & Yield (\%) \\
\midrule
1 & \chemfig{[:30]--[::-60]--[::-60]-[:30]-[:-30]~[:0]-[:0]BF_3K}
& \chemfig{[:30]NC-*6(-=-(-[,1.3]Br)=-=)}
& \chemfig{[:30]--[::-60]--[::-60]-[:30]-[:-30]~[:0]-[:0]*6(-=-(-CN)=-=-)}
& 75 \\
2 & \chemfig{[:30]--[::-60]--[::-60]-[:30]-[:-30]~[:0]-[:0]BF_3K}
& \chemfig{[:30]Cl-*6(-=-(-[,1.3]Br)=-=)}
& \chemfig{[:30]--[::-60]--[::-60]-[:30]-[:-30]~[:0]-[:0]*6(-=-(-Cl)=-=-)}
& 65 \\
\bottomrule
\end{tabu}
\end{table}

\end{document}