0

I was looking for the same solution to the problem explained by the OP in this question: How to make formulae take equal vertical space in the align environment?. I have implemented the solution suggested in user2478's answer.

However, one issue I am having is that my document is long, and I have the impression that when using the line of code \savebox\strutbox{$\vphantom{}$}, the effect carries on indefinitely until the end of the document or the next similar statement. I would need to be able to specify the scope of this statement.

I left a comment in that answer 5 days ago, unfortunately the original answerer seems to have no longer a StackExchange account, and I have not received any reply since then.

How can I control the scope of the above statement?

2 Answers 2

1

Since \savebox does a local box assignment, you can simply use it inside a TeX group:

\documentclass{article}
\usepackage{amsmath}

\begin{document}

{%
  \savebox\strutbox{$\vphantom{\dfrac11}$}%
  % or equivalently:
  % \sbox{\strutbox}{$\vphantom{\dfrac{1}{1}}$}%
  \begin{align}
    f_1(x) &= \frac{15x}{3} \\
    f_2(x) &= 3x + 5 \\
    f_3(x) &= 4x + 13
  \end{align}
}

\begin{align}
  f_1(x) &= \frac{15x}{3} \\
  f_2(x) &= 3x + 5 \\
  f_3(x) &= 4x + 13
\end{align}

\end{document}

enter image description here

(David Carlisle was a bit faster...).

1
  • Thank you, this provides a visual example that it is working. Oct 10, 2020 at 13:06
1

\savebox is a local assignment like \newcommand and is scoped to the current group or environment, like a font change or command definition.

1
  • Thank you, I should have tested this before asking actually... Oct 10, 2020 at 13:07

You must log in to answer this question.

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