As many, I have been a regular visitor of TeX StackExchange for several years. Up to now, careful research in the different existing questions and threads had solved almost all my troubles and questions about LaTeX, but this time I take the plunge and ask my own question. Many thanks in advance for your dedicated help.
Please, be aware that I have been reading really a lot of threads related to my question: alignments and spacing issues when combining the split
environnement and a phantom
.
This topic also led me to read some basics about the complicated notions of atoms, the particular "problems" introduced by the \left
and \right
delimiters, by \phantom
.
Any link to related questions will be welcome, but know that I couldn't solve all my question by going through the site.
Here is my MWE (I hope it is minimal enough; I think it is important to have my actual equations in this case and not something more canonical):
\documentclass[journal][enter image description here][1]{IEEEtran} % two column
\usepackage{mathtools} % general math package
\usepackage{bm} % bold math
\usepackage{commath} % for the () delimiters
% Gray phantom for debugging
\usepackage{xcolor}
\newcommand*{\gphantom}[1]{{\color[gray]{.75}#1}}
%%% Some notation commands
\newcommand*\Vthn{V_{\textnormal{th,n}}}
\newcommand*\Vthp{V_{\textnormal{th,p}}}
\newcommand*\Vthon{V_{\textnormal{th0,n}}}
\newcommand*\Vthop{V_{\textnormal{th0,p}}}
\newcommand*\Vthh{\widehat{V}_{\textnormal{th}}}
\newcommand*\Vthnih{\widehat{V}_{\textnormal{th,n,1}}}
\newcommand*\Vthpih{\widehat{V}_{\textnormal{th,p,1}}}
\newcommand*\Vthniih{\widehat{V}_{\textnormal{th,n,2}}}
\newcommand*\Vthpiih{\widehat{V}_{\textnormal{th,p,2}}}
\begin{document}
%%% "Solution", with several \!
"Solution", with several \textbackslash! required to get the proper alignment (for which I don't fully understand the need)
\begin{equation}
\begin{split}
& w\left( \bm{\Vthh} \right)
=
\left(\frac{\widehat{\sigma}_{\Vthn}}{\sigma_{\Vthn}}\right)^2
\cdot
\left(\frac{\widehat{\sigma}_{\Vthp}}{\sigma_{\Vthp}}\right)^2
\cdot{}\\
&\! \exp \left( - \frac{1}{2} \left(
\left( \left( \frac{\Vthnih - \Vthon}{\sigma_{\Vthn}} \right)^2 + \left( \frac{\Vthniih - \Vthon}{\sigma_{\Vthn}} \right)^2 \right)
\right. \right. \\
& \qquad \qquad \qquad \qquad \qquad \cdot \left(1 - \left( \frac{\widehat{\sigma}_{\Vthn}}{\sigma_{\Vthn}} \right)^2 \right)
\\
&
\phantom{
\exp \left( - \frac{1}{2} \left(
\vphantom{
\left( \left( \frac{\Vthpih - \Vthop}{\sigma_{\Vthp}} \right)^2 + \left( \frac{\Vthpiih - \Vthop}{\sigma_{\Vthp}} \right)^2 \right)
} \!
\right. \right.
} \!
\left( \left( \frac{\Vthpih - \Vthop}{\sigma_{\Vthp}} \right)^2 + \left( \frac{\Vthpiih - \Vthop}{\sigma_{\Vthp}} \right)^2 \right)
\\
& \qquad \qquad \qquad \qquad \qquad \left. \left. \!
\cdot \left(1 - \left( \frac{\widehat{\sigma}_{\Vthp}}{\sigma_{\Vthp}} \right)^2 \right)
\right) \right)
\text{.}
\end{split}
\end{equation}
%%% Original version with \!
% Gray phantom for debugging
Original version without \textbackslash!, resulting in
incorrect alignment:
\begin{equation}
\begin{split}
& w\left( \bm{\Vthh} \right)
=
\left(\frac{\widehat{\sigma}_{\Vthn}}{\sigma_{\Vthn}}\right)^2
\cdot
\left(\frac{\widehat{\sigma}_{\Vthp}}{\sigma_{\Vthp}}\right)^2
\cdot{}\\
& \exp \left( - \frac{1}{2} \left(
\left( \left( \frac{\Vthnih - \Vthon}{\sigma_{\Vthn}} \right)^2 + \left( \frac{\Vthniih - \Vthon}{\sigma_{\Vthn}} \right)^2 \right)
\right. \right. \\
& \qquad \qquad \qquad \qquad \qquad \cdot \left(1 - \left( \frac{\widehat{\sigma}_{\Vthn}}{\sigma_{\Vthn}} \right)^2 \right)
\\
&
\gphantom{
\exp \left( - \frac{1}{2} \left(
\vphantom{
\left( \left( \frac{\Vthpih - \Vthop}{\sigma_{\Vthp}} \right)^2 + \left( \frac{\Vthpiih - \Vthop}{\sigma_{\Vthp}} \right)^2 \right)
}
\right. \right.
}
\left( \left( \frac{\Vthpih - \Vthop}{\sigma_{\Vthp}} \right)^2 + \left( \frac{\Vthpiih - \Vthop}{\sigma_{\Vthp}} \right)^2 \right)
\\
& \qquad \qquad \qquad \qquad \qquad \left. \left.
\cdot \left(1 - \left( \frac{\widehat{\sigma}_{\Vthp}}{\sigma_{\Vthp}} \right)^2 \right)
\right) \right)
\text{.}
\end{split}
\end{equation}
\end{document}
And you can find attached the output, embellished with some color lines to emphasize the alignment and spacing issues.
I hope my summarizing picture helps you to understand why, with either of my two "solutions", I am not satisfied of the imperfect alignment which results.
I wish that you could help me in:
- Understanding why the "apparently sound" solution 2 (without any introduced
\!
) is visually unsatisfying. Do not hesitate to refer to quite theoretical concepts like those of atoms or specific LaTeX spacing issues. - Telling me how to solve the different causes of different spacing. I suspect that there are different things to be discussed: the small alignment mismatch between w and the exp (corresponding to one thin space, corrected with a
\!
); the introduced spaces by the combination ofphantom
and multiple\left
and\right
delimiters. - Is the introduced "fix"
\cdot{}\\
at the end of the first equation line correct and the right way to do it? Can you tell me what stands the{}
for in this situation? - Biefly outlying and advising me about a systematic approach in solving those alignment issues (like by introducing artificial atom or space corrections at the appropriate places?), as I spent multiple hours only on this case with a limited success in the end. I must confess that I am a bit tired, even though I am usually quite a LaTeX driller (yet probably much less that some experts among all of you).
Thanks in advance and don't hesitate to ask me to improve my question.
Update
A "+" was missing between lines 3 et 4.
But the core of my questions remains.
\left\right
introduces unwanted extra horizontal space even when it does not stretch the brackets, it makes them too large here as well. I'd use( \bm{\Vthh} )
for example, not\left( \bm{\Vthh} \right)
&=
for the first row so the long expression wrapped to the right of the =.