3

Why am I getting all this blank space after the phenylalanine molecule?

\documentclass{article}
\usepackage[dvipsnames, svgnames, x11names, table]{xcolor}
\usepackage[version=4]{mhchem}
\usepackage{chemfig}
\begin{document}
\chemname{\chemfig{[:-30]*5(-[,,,2]\textcolor{Grey}{H}|\textcolor{Grey}{N}>[,,,,Grey](-[:255,,,,Grey]\textcolor{Grey}{H})(-[:-30,,,,Grey](=[:-90,,,,Grey]\textcolor{Grey}{O})-[:30,,,,Grey]\textcolor{Grey}{O}|\textcolor{Grey}{H})---)}}
    {Prolina\\Pro, P}

\chemname{\chemfig{\color{Grey}{\ce{H2}}|\textcolor{Grey}{N}>[:60,,,,Grey](-[:195,,,,Grey]\textcolor{Grey}{H})
    (-[:90]-[::-60]*6(=-=-=-))
    -[:-30,,,,Grey](=[:-90,,,,Grey]\textcolor{Grey}{O})-[:30,,,,Grey]\textcolor{Grey}{O}|\textcolor{Grey}{H}}}{Fenilalanina\\Phe, F}
\end{document}

enter image description here

1
  • chemfig's doc says the distance between a molecule and its name "is 1.5ex by default", I don't think it is a stretched rubber. Dec 20, 2015 at 20:03

1 Answer 1

2

chemfig is trying to draw the names of sequential entries at the same vertical location. From page 23 of the manual: "...\chemname inserts 1.5ex + the largest of the depths of the molecules thus below the baseline of each molecule...". Removing the space between the entries so they will appear inline shows this behavior:

inline

Basically, the two molecules are set on the same baseline (at H2N for phenylalanine and the 5-ring forProline) and the names are set below the maximum depth. With more "stuff" below the baseline of proline than phenylalanine, proline controls, resulting in the observed space.

To prevent this carryover, add \chemnameinit{} between the two.

\documentclass{article}
\usepackage[dvipsnames, svgnames, x11names, table]{xcolor}
\usepackage[version=4]{mhchem}
\usepackage{chemfig}
\begin{document}
\chemname{\chemfig{[:-30]*5(-[,,,2]\textcolor{Grey}{H}|\textcolor{Grey}{N}>[,,,,Grey](-[:255,,,,Grey]\textcolor{Grey}{H})(-[:-30,,,,Grey](=[:-90,,,,Grey]\textcolor{Grey}{O})-[:30,,,,Grey]\textcolor{Grey}{O}|\textcolor{Grey}{H})---)}}
    {Prolina\\Pro, P}
\chemnameinit{}
\chemname{\chemfig{\color{Grey}{\ce{H2}}|\textcolor{Grey}{N}>[:60,,,,Grey](-[:195,,,,Grey]\textcolor{Grey}{H})
    (-[:90]-[::-60]*6(=-=-=-))
    -[:-30,,,,Grey](=[:-90,,,,Grey]\textcolor{Grey}{O})-[:30,,,,Grey]\textcolor{Grey}{O}|\textcolor{Grey}{H}}}{Fenilalanina\\Phe, F}
\end{document}

result

You must log in to answer this question.

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