5

I would like to format a 2-line (or any even number) equation with a centered tag and some left-justified text within the equation. In other words, can I achieve the tag placement as in the first case below while having some left-aligned text as in the 2nd or 3rd case below? (I'm okay with either.)

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

\begin{document}

\begin{equation}
\begin{aligned}
y&=ax+b\\
z&=cy+d
\end{aligned}
\end{equation}

\hrule

\begin{align}
y&=ax+b\\
\shortintertext{and} z&=cy+d
\end{align}

\hrule

\begin{flalign}
&& y&=ax+b&\\
\text{and} && z&=cy+d&
\end{flalign}

\end{document}

Align numbering example

1
  • You can get the tag with split environment but this no works properly with intertext command. Maybe you can do text and tag alining manually but this is non ellegant trick.
    – juanuni
    Commented Jul 23, 2017 at 18:47

2 Answers 2

1

These are two dirty hacks with flalign: a) put the intertext at the beginning of a middle line, adjust the spacing and number only this middle line; b) insert aligned inside an empheq{flalign} environment and use the `left= è optional argument for empheq.

I also propose a third solution with the text between the two lines, but not at the left margin:

 \documentclass{article}
\usepackage{empheq}
\usepackage[showframe]{geometry}

\begin{document}

\begin{flalign}
  && y&=ax+b&\notag\\[-1ex]
  \rlap{and} \\[-1ex]
  && z&=cy+d&\notag
\end{flalign}

\begin{empheq}[left =\rlap{and}\qquad]{flalign}
  \begin{aligned}
    y & =ax+b \\[2ex]
    z & =cy+d
  \end{aligned}
\end{empheq}
\smallskip

\begin{equation}\label{eq-c}
  \begin{alignedat}{2}
    && y&=ax+b\\
    \ArrowBetweenLines[\llap{and\qquad}]
    && z&=cy+d \quad
  \end{alignedat}
\end{equation}

\end{document} 

enter image description here

3
  • @Johnboy: Wait! I'll post two other possibilities.
    – Bernard
    Commented Jul 23, 2017 at 19:27
  • urk. one would hope that the "centering" of the main two equations would be uniform, but it's anything but! all are different ... something to be looked at ... Commented Jul 23, 2017 at 19:52
  • @barbarabeeton: Just not ‘llap’-ping \qquad in the second solution is not perfect, but acceptable, I think 'about 1pt of difference). I also improved the third solution. This being said, I don't understand why we can't use \intertext in an aligned environment.
    – Bernard
    Commented Jul 23, 2017 at 20:20
1

If you are using plain TeX then you can write something like this:

$$
  \eqalignno{
     y & =ax+b \cr
     \noalign{\hbox to\hsize{and\hfil (1)}}
     z & =cy+d \cr
  }
$$

\bye

You must log in to answer this question.

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