0

Here's my code -

\documentclass[12pt,x11names]{book}
\usepackage[T1]{fontenc}
\usepackage[version=4]{mhchem}
\usepackage{chemfig}
\usepackage{xcolor}

\definecolor{Powder blue}{HTML}{A8DADC}


\usepackage{garamondlibre}

\usepackage[most]{tcolorbox}

%geometry package
\usepackage{geometry}
\geometry{papersize={23cm,28cm}, right=9.3cm, left=3cm, top=2.5cm, bottom=3cm, marginparwidth=4.8cm, marginparsep=1.5cm, headheight=0cm}

\usepackage{siunitx}

\begin{document}

\begin{tcolorbox}[colback=Powder blue!50!white, colframe=Powder blue!50!white,ams equation]
\ce{N2(g) + 3H2 (g) -> 2NH3(g)} \tag{ \Delta \textbf{H}_{r}^{\ominus} = -92\ \unit{kJ}}
\end{tcolorbox}

\end{document}

For some reason, I'm getting extra vertical space - enter image description here

How do I remove this extra vertical space?

2
  • Maybe using top=0pt,bottom=0pt as options to the box?
    – Sigur
    Commented Sep 27, 2022 at 17:01
  • I don't know why but looks like \ce is adding the vertical space above the formula.
    – Sigur
    Commented Sep 27, 2022 at 17:04

1 Answer 1

0

Try the following:

\documentclass[12pt,x11names]{book}
\usepackage[T1]{fontenc}
\usepackage[version=4]{mhchem}
\usepackage{chemfig}
\usepackage{siunitx}

\definecolor{Powder blue}{HTML}{A8DADC}


\usepackage{garamondlibre}

\usepackage[most]{tcolorbox}

%geometry package
\usepackage[papersize={23cm,28cm}, 
            hmargin={3cm, 9.3cm}, vmargin={2.5cm, 3cm}, 
            marginparwidth=4.8cm, marginparsep=1.5cm, 
            headheight=0cm]{geometry}

\usepackage{siunitx}

\begin{document}

\begin{tcolorbox}[colback=Powder blue!50!white, colframe=Powder blue!50!white, ams gather*]  % <---
\ce{N2(g) + 3H2 (g) -> 2NH3(g)} \qquad(\Delta\mathbf{H}_{r}^{\ominus} = \qty{-92}{kJ})  % <---
\end{tcolorbox}

\end{document}

enter image description here

Changes in comparison with your MWE:

  • used is option ams gather*
  • removed is \tag and instead of it inserted \qquad distance
  • used is siunitx package

addendum:

It also works fine by use of \tag:

...
\begin{tcolorbox}[colback=Powder blue!50!white, 
                  colframe=Powder blue!50!white, 
                  ams gather]  % <---
\ce{N2(g) + 3H2 (g) -> 2NH3(g)} \tag{$\Delta\mathbf{H}_{r}^{\ominus} = \qty{-92}{kJ}$}  % <---
\end{tcolorbox}
...

Compilation result is almost the same as before:

enter image description here

2
  • Do you agree that the problem is caused by \ce?
    – Sigur
    Commented Sep 27, 2022 at 18:24
  • @Sigur, is hard to say. It seems, that \ce doesn't work well with equation environment (which is more complex than gather), but sufficient well with ams math environments (in tcolorbox). So, on my answer can be look as workaround how to solve OP problem.
    – Zarko
    Commented Sep 27, 2022 at 19:38

You must log in to answer this question.

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