4

I'm writing my bachelor thesis. I wanted to insert a chemical equation, but the reactant and the product are not horizontally aligned well. I found in Chemfig manual a solution to this problem but when I write \arrow(.center--.base west){<=>[\ce{H2O}]}, TeXnicCenter returns 9 errors and in pdf document there is no equation at all. When I write only \arrow{<=>[\ce{H2O}]}, it works well ...

I'm using TeXnicCenter, MikTeX and SumatraPDF on Windows 7. I'm a beginner with LaTeX.

Thanks for help.

\documentclass{article}
\usepackage[czech]{babel}

\usepackage{chemfig}

\begin{document}

\schemedebug{true}
\schemestart
  AA
  % \arrow{<=>[xxx]} % works
  \arrow(.base east--.base west){<=>[xxx]}
  BB
\schemestop

\end{document}
9
  • Welcome to TeX.sx! You seem to use two custom packages. Can you make an example that shows the problem and that we can compile, too?
    – cgnieder
    Mar 9, 2014 at 12:22
  • Thanks. Well, the example is above in the code: \schemedebug{true} \schemestart \chemfig{*6(-=(-CH=[:0,0.8]O)-(-CH=[:0,0.8]O)=-=)} \arrow{<=>[\ce{H2O}]} \chemfig{*6(-=(-(-[:30]OH)(-[:-90]OH))-(-CH=[:0,0.8]O)=-=)} \schemestop
    – SabrielxD
    Mar 9, 2014 at 12:43
  • No: the example is not complete: a complete example starts with \documentclass and ends with \end{document} - I or someone else can copy and compile the example then as is and reproduce your issue.
    – cgnieder
    Mar 9, 2014 at 13:03
  • 1
    The code above produces: ! LaTeX Error: File `bakalarska_prace_en.sty' not found. because both bakalarska_prace_en and bakalarska_prace are packages that aren't part of a usual TeX distribution. Are they needed for the error? If so you should provide a link where to get them. Removing them and the dots from the preamble produces the error ! LaTeX Error: No \title given. and after that ! Undefined control sequence. for \ce... that means I have to fix quite a lot of errors before I can even try to look at your issue.
    – cgnieder
    Mar 9, 2014 at 13:18
  • 2
    Seems to be a conflict between babel with czech and chemfig. I'll edit your example to a smaller one that reproduces the issue clearly. then your private files aren't needed any more
    – cgnieder
    Mar 9, 2014 at 13:33

1 Answer 1

6

I was really a conflict between babel with czech and chemfig. I found the following solution on LaTeX community:

\documentclass[oneside,czech]{book}
\usepackage{babel}
\usepackage{chemfig}

\usepackage{etoolbox}
\pretocmd\schemestart{\shorthandoff{-}}{}{}
\apptocmd\schemestop{\shorthandon{-}}{}{}

\begin{document}

\schemestart
A \arrow(aa--bb) B
\schemestop

\end{document}

Thanks for help, cgnieder!

You must log in to answer this question.

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