10

I'm trying to write the line diagram of the glass electrodo to measure pH. I've got a working code:

\documentclass{article}
\usepackage{xcolor}
\usepackage{amsmath}
\usepackage[version=4]{mhchem}
\begin{document}
\begin{equation*}
\overbrace{\underbrace{\ce{Ag (\textit{s}) | AgCl (\textit{s}) | KCl  (\textit{aq, sat}) }}_{E_{ref1}} \underbrace{||}_{E_j}}^{\text{Electrodo de referencia 1}} \overbrace{\ce{H^+ (\textit{aq}, a_1)}}^{\text{Analito}} \overbrace{\underbrace{|}_{E_1} \text{Membrana de vidrio} \underbrace{|}_{E_2} \textcolor{blue}{\ce{H^+ (\textit{aq}, 0,1M), }} \underbrace{\textcolor{blue}{\ce{Cl^- (\textit{aq}, 0,1 M)}}\ce{|AgCl (\textit{s})|Ag (\textit{s})}}_{\text{Electrodo de referencia 2, }E_{ref2}}}^{\text{Electrodo de vidrio}}
\end{equation*}
\end{document}

and the result look like this: enter image description here I need to make it a little more narrow without losing information, and my best option is to save the empty space in the brackets for the interfaces (Ej, E1 and E2).

Is there a way to do that?

4
  • Welcome to TeX.SE!
    – Mensch
    Nov 22, 2021 at 2:40
  • 2
    Are you looking for something like this?
    – Werner
    Nov 22, 2021 at 3:00
  • I've tried the makebox and is not working, in fact it makes the text even bigger
    – FFG
    Nov 22, 2021 at 3:08
  • 1
    Yes @Werner, how did you do it?
    – FFG
    Nov 22, 2021 at 3:09

2 Answers 2

13

To really economize on space, I'd ditch the \underbrace machinery and instead resort to vertical arrows as pointers that direct explanatory stuff towards the items being explained.

enter image description here

\documentclass{article}
\usepackage[margin=2.5cm]{geometry} % set page parameters suitably
\usepackage{xcolor}
\usepackage{mathtools}
\usepackage[version=4]{mhchem}

\begin{document}
\small % so that formula fits within the textblock
\begin{equation*}
\overbrace{%
  \underbrace{\ce{Ag (\textit{s})} \mid 
              \ce{AgCl (\textit{s})} \mid 
              \ce{KCl^{\vphantom{+}}  (\textit{aq, sat})}
             }_{E_{\textrm{ref1}}} 
  %\underbrace{||}_{E_j}
  \underset{\substack{\uparrow\\\mathclap{E_j}}}{\mathrel{\Vert}}
}^{\text{Electrodo de referencia 1}} 
\overbrace{\ce{H^+ (\textit{aq}, a_1)}}^{\text{Analito}} 
\overbrace{%
  %\underbrace{|}_{E_1} 
  \underset{\substack{\uparrow\\\mathclap{E_1}}}{\mid}
  \text{Membrana de vidrio} 
  %\underbrace{|}_{E_2} 
  \underset{\substack{\uparrow\\\mathclap{E_2}}}{\mid}
  \textcolor{blue}{\ce{H^+ (\textit{aq}, 0,1M), }} 
  \underbrace{%
    \textcolor{blue}{\ce{Cl^- (\textit{aq}, 0,1 M)}} \mid 
    \ce{AgCl (\textit{s})}\mid
    \ce{Ag (\textit{s})}
  }_{\text{Electrodo de referencia 2, $E_{\textrm{ref2}}$}}
}^{\text{Electrodo de vidrio}}
\end{equation*}
\end{document}
2
  • Thanks! It worked perfectly :D
    – FFG
    Nov 22, 2021 at 3:50
  • 1
    Too late but i have upvoted now
    – Sebastiano
    Nov 22, 2021 at 20:21
2

Try \hspace*{-3cm} just before the \overbrace: ...

\begin{equation*}
\hspace*{-3cm}\overbrace{\underbrace{\ce{Ag (\textit{s}) | AgCl (\textit{s}) | KCl  (\textit{aq, sat}) ...
\end{equation*}

The result is: enter image description here

You must log in to answer this question.

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