If I want to know the width of a text I use


Is there something similar for equations?

More specifically I have

a & b & c & d\\
c & d & c & d

and I would like to have the width of this align section. How can I get this?

  • Does this include the equation number associated with using align? – Werner Jun 14 '12 at 20:47
  • Welcome to TeX.sx! Your question was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other (by using the same OpenID), otherwise you won't be able to comment on or accept answers or edit your question. – Werner Jun 14 '12 at 23:38
  • Use \settowidth{\MyLength}{$<equation>$}, bacailly use math mode for the equation you want to measure. Of course it can not contain align points &. – Peter Grill Jun 15 '12 at 0:00
  • 2
    An align is as wide as the text, so the answer is \textwidth. Do you mean the width of the math itself from leftmost to rightmost symbol? This is dependent on the text width, since the align environment will add space between the columns to space them evenly. If you want a "generic" aligned width, you could try using the aligned environment inside Peter Grill's suggestion, i.e. \settowidth{\MyLength}{$\begin{aligned}...\end{aligned}$}. This environment "shrinks to fit". – Ryan Reich Jun 15 '12 at 2:46

One can get the sum of the widths of the "equation" parts, as the spacing between alignment groups is computed dynamically and is stored nowhere.

The column widths are stored in a special format in the macro \maxcolumn@widths, which is available at the end of the construction, when the conditional \ifmeasuring@ is false. The format is

\or <dimen1> \or <dimen2> \or ... 

where each <dimen> is the maximum width of the respective column (align builds rlrl... alignments).




a & b & c & d\\
c & d & c & d



One may add to this the computation of the horizontal space really used from the left to the right.

|improve this answer|||||

Your Answer

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