3

I am aware of Align in Substack, but I am trying another solution and would like to understand why it is not working:

\documentclass{article}%
\usepackage{amsmath}%
\newlength{\mylength}%
\newcommand{\before}{k_\rho k_\rho k_\rho k_\rho}%
\begin{document}%
\LARGE
\begin{align}%
%\substack{% <-- uncomment this line
\before=something\\%
\settowidth{\mylength}{\ensuremath{\before}}%
\hspace{\mylength}=something\\%
%}% <-- uncomment this line
\end{align}%
\end{document}%

First of all, alignment is working fine in a multline or align. But in a substack, it is not, the = are not aligned.

  • \settowidth{\mylength}{$\before$} does the same, by the way. – bers Oct 23 '14 at 18:07
6

It is the same as comparing $X_{a=b}$ with $X_{\mbox{$a=b$}}$ If you start a new math expression inside a box it will be textsize even if you are in a subscript. Explicitly adding \scriptstyle gets you back on track.

\documentclass{article}
\usepackage{amsmath}
\newlength{\mylength}
\newcommand{\before}{\scriptstyle k_\rho k_\rho k_\rho k_\rho}
\begin{document}
\LARGE
\begin{align}
\substack{% <-- uncomment this line
\before=something\\
\settowidth{\mylength}{\ensuremath{\before}}%
\hspace{\mylength}=something\\%
}% <-- uncomment this line
\end{align}
\end{document}
  • Awesome, thank you. I had suspected something like this, but my test with \LARGE worked as expected (LARGE font size was respected in settowidth). I was not aware there is a difference between text and subscript other than font size that might not be respected implicitly. – bers Oct 23 '14 at 18:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.