1

How can one left align a single text line ("and", in the following example) within a block of math. equations? \shortintertext{and} seems to generate larger interline spacing which is undesirable.

Thanks.

\documentclass{article} 
\usepackage{amsmath}
\usepackage{mathtools} 

\begin{document} 
    \begin{align*} 
        2x - 5y &=  8, \\
        \text{and} \\
        3x + 9y &=  -12.
    \end{align*}
    
    \begin{align*} 
        2x - 5y &=  8, \\
        \shortintertext{and} \\
        3x + 9y &=  -12.
    \end{align*}
    
\end{document}

enter image description here

6
  • 2
    no \\ after interline text Commented May 22, 2023 at 23:14
  • 2
    Use \shortintertext{and} (mathtools), with no following \\ as noted by @DavidCarlisle. Commented May 22, 2023 at 23:19
  • 2
    I’m voting to close this question because the OP's issue was solved in the comments.
    – Mico
    Commented May 23, 2023 at 2:09
  • 2
    @Mico We already have two answers. So wouldn't it be better to have one more answer with David's comment and a MWE showing this?
    – cabohah
    Commented May 23, 2023 at 6:36
  • 1
    I agree, voting to leave open.
    – Marijn
    Commented May 23, 2023 at 7:24

3 Answers 3

2

Use \shortintertext{and} (from mathtools), with no following \\

1

The align environment opens display math mode and starts it by \halign primitive, which controls the alignment. There is a TeX primitive \noalign{vertical material} which can be used at the end of each row in \halign, i.e. just after \cr. The LaTeX macro \shortintertext is implemented by \noalign primitive. Your example ca be we-written using this primitive like this (note that LaTeX's \\ is \cr in this context):

\begin{align*} 
    &2x - 5y =  8, \cr  \noalign{\hbox{and}}
    &3x + 9y =  -12.
\end{align*}

If you add another \cr just after \noalign{...} then next empty row is appended. But you don't want such empty row here.

0

Have you tried placing the alignment point on the left of expressions? It will make all lines to be left-aligned

\documentclass{article} 
\usepackage{amsmath}
\usepackage{mathtools} 

\begin{document} 
    \begin{align*} 
        &2x - 5y =  8, \\
        &\text{and} \\
        &3x + 9y =  -12.
    \end{align*}
    
\end{document}
1
  • 1
    Thank you for the answer. The text "and" needs to be justified to the left. The comments above solve it.
    – AEW
    Commented May 22, 2023 at 23:31

You must log in to answer this question.

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