1

My Chemistry equations come out looking a bit awkward when it comes to writing compounds, which require multiple letters. Here's an example, note the space between H and N, or B and F: enter image description here

I couldn't find any package to use that could help with this, nor any previously answered questions about this kind of thing.

If it is useful, here's the code:

\begin{equation}

\huge BF_3 + NH_3 \rightleftharpoons BF_3 NH_3

\end{equation}

What could I do to get rid of that sort of spacing?

6
  • You must get errors from that you can not have blank lines or font size commands such as \huge in an equation there are packages for setting chemisry such as mhchem Apr 9, 2022 at 22:12
  • Welcome to TeX.SE.
    – Mico
    Apr 9, 2022 at 22:13
  • Do search this site for postings with the chemistry tag.
    – Mico
    Apr 9, 2022 at 22:14
  • see for example tex.stackexchange.com/q/201835/1090 Apr 9, 2022 at 22:15
  • 1
    You get a warning not an error (the blank line is an error) huge generates LaTeX Font Warning: Command \huge invalid in math mode on input line 6 that is a warning you should not ignore though, the command does not work in math. Apr 9, 2022 at 22:28

1 Answer 1

2

As @DavidCarlisle has already noted in a comment, loading the mhchem package and using its \ce ("chemical equation") macro would constitute a good start.

\ce can be used in both text and math mode.

enter image description here

\documentclass{article}
\usepackage[version=4]{mhchem} % see https://www.ctan.org/pkg/mhchem
\begin{document}

\begin{center} % text mode
\huge
\ce{BF3 + NH3 \rightleftharpoons BF3NH3}
\end{center}

\[  % math mode
\ce{BF3 + NH3 \rightleftharpoons BF3NH3}
\]
\end{document}
2
  • 2
    you can write <=> instead of \rightleftharpoons in both mhchem and chemformula
    – cgnieder
    Apr 10, 2022 at 5:58
  • @cgnieder - Thanks for this. It's definitely easier (for me at least) to remember <=>.
    – Mico
    Apr 10, 2022 at 6:16

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