0

I want to produce the following output: equation

Notice - this is multiline, the equations are at the center of the page. There's alignment w.r.t. the inequality sign, and even though there's a large size difference in each side between the upper and lower terms, the shorter term (12) is aligned at the center w.r.t. the longer one (123456789).

Every solution I've tried aligns the shorter text to the left or the right. I've read many related questions and have spent many hours attempting to solve this, without any success.

1

2 Answers 2

1

This solution does not have fancy spacing features. But it is much simpler and requires no packages. If you care a lot about the spacing, there are ways to adjust that manually

\documentclass{article}


\begin{document}

Here is an equation:
\[
    \begin{array}{ccc}
        12 & < & 123456789 \\
        123456789 & < & 12
    \end{array}
\]
This was great.
\end{document}

code output

1

As long as you don't need each equation in the stack individually numbered, you can use a TABstack.

The baselineskip can be set with \setstackgap{L}{...}. By default the \Matrixstack sets itself in math mode.

Since the issue of tabular (array) came up in a comment to my answer, I have edited to show the equivalent array approach. In this case, one must employ @{} to turn off column gaps, pad the math operator with empty atoms {}<{}, and manually insert extra vertical space \\[6pt].

\documentclass{article}
\usepackage{tabstackengine}
\TABbinary
\begin{document}
\[
\setstackgap{L}{20pt}
\Matrixstack{12 &<& 123456789\\
             123456789 &>& 12}
\]
\[
\begin{array}{c@{}c@{}c}
 12 &{}<{}& 123456789\\[6pt]
 123456789 &{}>{}& 12
\end{array}
\]
\end{document}

enter image description here

2
  • +1 from me this would be roughly my goto solution but a tabular might work as well and is in my opinion a bit simpler...
    – der bender
    Apr 24, 2020 at 16:20
  • @derbender tabular (array) can work as long as you both turn off intercolumn spacing via @{} and pad your operator with empty math atoms, as in {}<{}. Apr 24, 2020 at 16:24

You must log in to answer this question.

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