9

I'm writing a reaction but the names of the D-Glucose and D-Mannose are not aligned with the name of the D-Fructose. Here's what I have. I tried to use \chemnameinit{} but it simply didn't work :(

Also, I'd like to put a title like a table or image but I don't know how.

\usepackage{chemfig}
\begin{document}

\definesubmol{x}{(-[4]H)(-[0]OH)}
\definesubmol{y}{(-[0]H)(-[4]HO)}

\begin{center}
\schemestart
    \chemname{\chemfig{[2]CH_2 \cdot OH-!x-!x-!y-!x-(-[3]H)=[1]O}}{D-Glucosa}
    \arrow{<=>[Base][]}
    \chemname{\chemfig{[2]CH_2 \cdot OH-!x-!x-!y-(=[0]O)-CH_2 \cdot OH}}{D-Fructosa}
    \arrow{<=>[Base][]}
    \chemname{\chemfig{[2]CH_2 \cdot OH-!x-!x-!y-!y-(-[3]H)=[1]O}}{D-Manosa}
\schemestop
\end{center}

\end{document}

enter image description here

6

chemfig places the molecules in a bounding box defined by TikZ. I haven't found how to modify or act on this bounding box. So, I propose a quick hack by adding 35 pt to the default size of the text of the \chemname[35pt] command.

screenshot

\documentclass[12pt]{article}
\usepackage{chemfig}
\begin{document}

\definesubmol{x}{(-[4]H)(-[0]OH)}
\definesubmol{y}{(-[0]H)(-[4]HO)}

\begin{center}

\schemestart
    \chemname{\chemfig{[2]CH_2 \cdot OH-!x-!x-!y-!x-(-[3]H)=[1]O}}{D-Glucosa}
    \arrow{<=>[Base][]}
    \chemname[35pt]{\chemfig{[2]CH_2 \cdot OH-!x-!x-!y-(=[0]O)-CH_2 \cdot OH}}{D-Fructosa}
    \arrow{<=>[Base][]}
    \chemname{\chemfig{[2]CH_2 \cdot OH-!x-!x-!y-!y-(-[3]H)=[1]O}}{D-Manosa}
\schemestop

\end{center}

\end{document}
  • 2
    Thank you very much! It worked pretty well. – AJMC2002 Aug 12 at 6:35
6

A solution with vphantom

\documentclass[12pt]{article}
\usepackage{chemfig}
\begin{document}

\definesubmol{x}{(-[4]H)(-[0]OH)}
\definesubmol{y}{(-[0]H)(-[4]HO)}

\begin{center}

\schemestart
    \chemname{\chemfig{ [2]CH_2 \cdot OH-!x-!x-!y-!x-(-[3]H)=[1]O}}{D-Glucosa}
    \arrow{<=>[Base][]}
    \chemname{\vphantom{\chemfig{[2]CH_2 \cdot OH-!x-!x-!y-!x-(-[3]H)=[1]O}}
        \chemfig{[2]CH_2 \cdot OH-!x-!x-!y-(=[0]O)-CH_2 \cdot OH}}{D-Fructosa}
    \arrow{<=>[Base][]}
    \chemname{\chemfig{[2]CH_2 \cdot OH-!x-!x-!y-!y-(-[3]H)=[1]O}}{D-Manosa}
\schemestop

\end{center}

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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