[Tex/LaTex] 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:



\setbondstyle{line width=0.8 pt}


\centering \caption{Test} 
\begin{tabular}{>{\centering\arraybackslash}p{20pt}>     {\centering\arraybackslash}p{160pt}
>{\centering\arraybackslash}p{60pt}>{\centering\arraybackslash}p{160pt}>  {\centering\arraybackslash}p{20pt}}
\\[-5pt] %controls the spacing between line and text
\vfill Entry & \vfill RBF$_3$K  &\vfill Ar-Br &\vfill R-R & Yield (\%)\\
 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\\      


Best Answer

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:


\setbondstyle{line width=0.8 pt}


  % locally change the molecule layout
  % the following is necessary because you have defined \printatom with
  % a fixed fontsize:
      Entry & \ce{RBF3K}  & \ce{Ar-Br} & \ce{R-R} & Yield (\%) \\
      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 \\


enter image description here

Related Question