1

I want to write the following chemical equation in Latex:

I'm trying to put the parentheses in ():

\documentclass[fontsize=11pt]{article}
\usepackage{braket}
\usepackage{pdfpages}
\usepackage{geometry}
\usepackage{chemist}
\usepackage{chemformula}
\geometry{margin=2.5cm}
\usepackage{mathptmx}
\newtheorem{theorem}{Teorema}
\usepackage{tocloft}
\usepackage{tocstyle}
\newtocstyle[standard][leaders]{mytocstyle}{\settocfeature[1]{entryhook}{\normalfont}}
\usetocstyle{mytocstyle}
\renewcommand{\baselinestretch}{1.15}
\usepackage[justification=centering]{caption}
\usepackage{array}
\usepackage{setspace}
\usepackage{imakeidx}
\usepackage{adjustbox}
\usepackage{enumitem}
\usepackage{amsfonts}
\usepackage{varwidth}
\usepackage{booktabs}
\usepackage{array,tabularx,threeparttablex}
\usepackage{indentfirst}
\usepackage{amsmath}
\usepackage{multirow}
\usepackage[normalem]{ulem}
\usepackage{mathtools}
\usepackage{blindtext}
\usepackage{color}
\usepackage{caption}
\usepackage{float}
\usepackage{listings}
\usepackage{xcolor}
\usepackage{verbatim}
\usepackage[utf8]{inputenc}
\usepackage[document]{ragged2e}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{fancyhdr}
\addtocontents{toc}{\protect\thispagestyle{empty}}
\usepackage[T1]{fontenc}
\usepackage[portuguese]{babel}
\usepackage{graphicx}
\usepackage{subfig}
\usepackage{amssymb,amsmath,bbm}
\usepackage{multirow}
\usepackage{acro}
\acsetup{first-style=short}
\begin{document}
\begin{chemmath}
  \text{MoS}_{2}+\emph{x}\,\,\text{n-BuLi}
  \reactrarrow{0pt}{1cm}{}{}
  \frac{\emph{x}}{2}\,\,\text{n-Oct} + \text{Li}_{x}\text{MoS}_2\,\,\, (x\approx 1)
\end{chemmath}
\end{document}

Output:

enter image description here

How can I fix the code?

0

3 Answers 3

3

Instead of using parenthesis directly, use the associated LaTeX commands. In your code replace ( with \left( and ) with \right).

\documentclass[fontsize=11pt]{article}
\usepackage{braket}
\usepackage{chemist}
\usepackage{chemformula}
\begin{document}

\begin{chemmath}
    \text{MoS}_{2}+\emph{x}\,\,\text{n-BuLi}
    \reactrarrow{0pt}{1cm}{}{}
    \frac{\emph{x}}{2}\,\,\text{n-Oct} + 
    \text{Li}_{x}\text{MoS}_2\,\,\, 
    \left(x\approx 1\right)
\end{chemmath}

\end{document}

enter image description here

1
  • 5
    Welcome to TeX.SX! Please add an MWE (minimal working example) showing your solution in tex code for the given issue. And add a screenshot of your result to your answer too. Then you have written a valid answer ;-)
    – Mensch
    Commented Feb 13, 2020 at 10:22
5

You load chemformula, so use it.

\documentclass{article}
\usepackage{chemformula}

\begin{document}

\[
\ch{MoS2 + \(x\) 'n-BuLi' ->
\(\frac{x}{2}\) 'n-Oct' + Li\(\sb{x}\)MoS2 '\quad(\(x\approx{1}\))'}
\]

\end{document}

enter image description here

1

The chemical formula may be composed using the ChemEquation environment provided by XymTeX (c.f. Part VIII. Molecular Formulas and Reaction Schemes).

\documentclass{article}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

% c.f. XymTeX manual (p.6,7...)
\usepackage{xymtexpdf}
\usepackage{xcolor}
\usepackage{graphicx}


\begin{document}

% c.f. XymTeX manual (Part VIII)
\begin{chemmath}
   MoS_2+\mathit{x}\,\hbox{\rm n-BuLi}\llongrightarrow
     \frac{\mathit{x}}{2}\,\hbox{\rm n-Oct}+Li_\mathit{x}MoS_2\qquad
   (\mathit{x}\approx 1)
\end{chemmath}

\end{document}

a chemical formula

This input document may be processed with (PDF/Xe)LaTeX.

You must log in to answer this question.

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