2

There is some problem with my code. It don't show Mg(OH)X correctly and arrow passes to reactant sites also

\documentclass[11pt]{article}

\usepackage{chemfig}

\begin{document}
    \schemestart
     \chemname{\chemfig{HC~CH}}{Acetylene}
     \arrow{->[Red Hot \chemfig{Cu} tube][400C]}
     \chemname{\chemfig{**6(------)}}{Benzene}
     \+ \chemfig{Mg (OH) Cl}
    \schemestop
\end{document}

It gives me output like these :( enter image description here

Clearly they are not aligned and the arrow length is very short and how to show degree at 400 degree celcius below arrow and how to display Mg(OH)X correctly .

Thank YOU :)

2

Like this?

enter image description here

The code:

\documentclass[11pt]{article}
\usepackage{chemfig}
\usepackage{siunitx}

\begin{document}
    \schemestart
     \chemname{\chemfig{HC~CH}}{Acetylene}
     \arrow(.{15.5}--){->[Red Hot \chemfig{Cu} tube][\SI{400}{\celsius}]}[0,2,]
     \chemname{\chemfig{**6(------)}}{Benzene}
     \arrow{0}[,0] \+ \chemfig{Mg {(OH)} Cl}
    \schemestop
\end{document}

Remarks

  • For units,such as degree Celsius, use the siunitx package. In your concrete case I used \SI{400}{\degreeCelsius}.

  • \arrow admits an optional argument with three values: angle, length coefficient and style, so I used [0,2,,] (i.e., angle=0, double the length and no style modification).

  • I used an extra pair or braces arround (OH), as in \chemfig{Mg {(OH)} Cl} (I am not sure if this is the desired result, though).

  • An invisible arrow \arrow{0}[,0] was used so that "+ Mg(OH)Cl" is vertically aligned with the arrow to the left.

  • To improve the vertical alignment with the acetylene, the anchor specification (.{15.5}--) was used for the \arrow (thanks to clemens for his comment).

  • Thanks , This is what exactly i want :) And your explanation is very good i understand every thing now :) – aftershock Jun 22 '15 at 16:59
  • Would it be possible to adjust the vertical alignment of the last bit? – egreg Jun 22 '15 at 17:34
  • @egreg I guess so; you mean align the elements in such a way that "+ Mg(OH)Cl" vertically aligns with the middle of the Benzene, right? When I return home I'll do it. – Gonzalo Medina Jun 22 '15 at 17:39
  • At least aligned with the arrow at the left side. – egreg Jun 22 '15 at 17:41
  • A better alignment with the acetylene can be achieved by giving an anchor to \arrows(<name1>.<anchor1>--<name2>.<anchor2>) (where all <name>s and <anchor>s are optional). Here 15.5 seems about right: \arrow(.{15.5}--){->[Red Hot \chemfig{Cu} tube][\SI{400}{\celsius}]}[,2] – clemens Jun 22 '15 at 19:45

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.