2

I would like to use \intertext inside an array, so I'm using

\usepackage{amsmath}
...
\begin{gather*}
    \begin{array}{lll}
        u & v & w
\intertext{Blah, blah, blah} 
        x & y & z
\intertext{Blah, blah, blah}
        a & b & c
    \end{array}
\end{gather*}

This results in the maths being left-aligned. How can I align the maths in the center?

  • 1
    Please make your code compilable; e.g., do state which document class is in use and which packages are being loaded. And please exlain why the array environment is defined to have 6 columns even though only 3 appear to be in actual use. – Mico Aug 25 '17 at 13:23
  • I've added amsmath and switched 6 columns for 3. (My original source uses six columns, but three columns suffice to demonstrate the problem.) – user2768 Aug 25 '17 at 13:38
  • 4
    I think it is pure luck that this does not give you an error. \intertext was never meant to be used inside array. Exactly why are you using this combination? – daleif Aug 25 '17 at 13:46
  • @daleif, because it looks like it has the potential to do what I want... – user2768 Aug 25 '17 at 14:07
6

I suggest you replace the gather* environment with an alignat* environment -- and not use an array environment.

Use the following code to get three left-aligned columns, separated from each other by 2\arraycolsep. Why 2\arraycolsep, you might ask? Because that's the amount of intercolumn whitespace that's inserted between two columns of an array environment.

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{alignat*}{3}
        &uvw &\hspace*{2\arraycolsep}& abc &\hspace*{2\arraycolsep}& def \\
\intertext{Blah, blah, blah}
        &x && y && z \\
\intertext{Blah, blah, blah}
        &\alpha && \beta && \gamma
\end{alignat*}
\end{document}
| improve this answer | |

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.