0

im a LaTeX beginner and i keep running into this one issue compiling a .tex file.

the error is as following:

*geometry* driver: auto-detecting
*geometry* detected driver: pdftex
! Missing $ inserted.
<inserted text> 
                $
l.31 \quad \rightarrow
                       \quad
? 

the code around line 31 is:

\begin{center}
\chemfig{*6(-F-NO_2-NC)}
\quad +
\quad 3Sn \quad + \quad 6HCl
\quad \rightarrow \quad
\chemfig{*6(-F-NH_2-NC)}
\quad + \quad 3SnCl_2 \quad + \quad 2H_2O
\end{center}

Any help appreciated.

0

1 Answer 1

0

Macros like _ or \rightarrow are math commands. They need to be used in math mode, e.g. $\rightarrow$.

However you could make your life easier by using one of the packages to typeset chemistry formulas:

\documentclass{article}

\usepackage{chemfig}
\usepackage[version=4]{mhchem}

\begin{document}

\begin{center}
\ce{
  \chemfig{*6(-F-NO_2-NC)}
  +
  3Sn  +  6HCl
  ->
  \chemfig{*6(-F-NH_2-NC)}
  +  3SnCl2  +  2H2O
}
\end{center}


\end{document}

enter image description here

2
  • thanks, it worked nicely except for the last one which was a jumbled mess but that may be my issue, code following: '\begin{center} \ce{ \chemfig{*6(-F-NHCH_3-CONH_2)} + \chemfig{C_6H_4(COCl)-CN-CF_3} -> \chemfig{*6(-F-NHCH_3-CONHC_6H_3(CN-CF_3))} } \end{center}' Commented Aug 14 at 21:28
  • @MartinBabka If you have a new question, please ask a new question. Commented Aug 15 at 9:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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