5

These are the outputs without and with the subscript (the 3 between Phi and P)

enter image description here

enter image description here

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\usepackage[italian]{babel}
\usepackage{chemfig}

\begin{document}

\begin{figure}[!htb]
\centering
\schemestart
    \chemfig{\Phi{P}(=[0]CH\Phi)}
\schemestop
\end{figure}

\begin{figure}[!htb]
\centering
\schemestart
    \chemfig{\Phi_{3}{P}(=[0]CH\Phi)}
\schemestop
\end{figure}

\end{document}

As you can see, it changes both the length and the position of the bond itself, which in the case of the molecule with the subscript is shorter and is positioned lower. Is there a way to make them equal in length and position?

1 Answer 1

5

You can enforce a fixed bond length with the keyval fixed length=true (default is false), then if the resulting bond length is too long, use atom sep to adjust, as I did.

For the vertical alignment issue, just remove braces from the P.

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\usepackage{chemfig}

\begin{document}
\setchemfig{%
    scheme debug=true,% set to false in your document
    fixed length=true,
    atom sep=2em,
}

\begin{figure}[!htb]
    \centering
    \schemestart
    \chemfig{\Phi{P}(=CH\Phi)}
    \schemestop
\end{figure}

\begin{figure}[!htb]
    \centering
    \schemestart
    \chemfig{\Phi_{3}P(=CH\Phi)}
    \schemestop
\end{figure}
\end{document}

enter image description here

2
  • The usual problem: my Miktex distribuition can't update chemfig package, so \setchemfig is not defined yet. By the way, thanks! May 11, 2018 at 11:18
  • Could you figure it out with the old commands, or would you like me to add it into my answer as well? I'm just reluctant to do so because eventually it'll be outdated. (it already is) :p
    – Troy
    May 11, 2018 at 11:20

You must log in to answer this question.

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