1

I want to have some equations aligned in two columns followed by a single centered equation, i.e. something that looks like multiple align enviroments, one after another, but with no excessive space between them. Ideally, there would be an align-like environment where the number of columns may be different in different rows, but all rows that have the same number of columns would be horizontally aligned together.

Also, in the last equation I have cases and it doesn't work well with proof. I have found no place to put \qedhere that produces the result I want – the qed symbol on the righthand end, but with no extra line.

Finally, I'd appretiate any general advice how to treat issues like this – I'm writing some math, I want to do something natural that is a slight generalization of what I do in TeX regularly, but it is a big problem to explain this to TeX. It feels like (La)TeX doesn't work on the level of abstraction I desire, and issues like this interrupt my work.

An example follows.

\documentclass{article}

\usepackage{amsmath}
\usepackage{amsthm}

\begin{document}
    \begin{proof}
        We have the following equalities.
        \begin{align*}
            f^\leftrightarrow(x) &= f(-x) & f^{\mathrel{\text{\ooalign{$\swarrow$\cr$\nearrow$}}}}(x) &= -f(-x) \\
            f^+(x) &= \max(f, 0) & f^-(x) &= \min(f, 0) \\
            |x| = \begin{cases}
                +x \quad \text{if $x \ge 0$} \\
                -x \quad \text{if $x \le 0$} \\
            \end{cases} % \qedhere
        \end{align*} \qedhere
    \end{proof}
\end{document}
3

Use gather*, and nest an aligned enviroinment within it:

\documentclass{article}

\usepackage{amsmath}
 \usepackage{amsthm}

\begin{document}

    \begin{proof}
        We have the following equalities.
        \begin{gather*}
            \begin{aligned}
            f^\leftrightarrow(x) &= f(-x) & f^{\mathrel{\text{\ooalign{$\swarrow$\cr$\nearrow$}}}}(x) &= -f(-x) \\
            f^+(x) &= \max(f, 0) & f^-(x) &= \min(f, 0) \\
            \end{aligned}\\
            |x| = \begin{cases}
                +x \quad \text{if $x \ge 0$} \\
                -x \quad \text{if $x \le 0$}
            \end{cases}
            \qedhere%
        \end{gather*}
    \end{proof}

\end{document}

enter image description here

Using ntheorem you can have a better alignment of the end-of-proof symbol, as it allows the local replacement of a symbol with another symbol:

\documentclass{article}

\usepackage{stackengine}
\usepackage{amsmath, amssymb}
\usepackage[thmmarks, amsmath]{ntheorem}
\theoremstyle{nonumberplain}
\theoremheaderfont{\normalfont\itshape}
\theorembodyfont{\normalfont}
\theoremsymbol{$\square$}
\newtheorem{proof}{Proof}
\qedsymbol{\bllap[1.75ex]{$\square$}}

\begin{document}

    \begin{proof}%
        We have the following equalities.
        \qed%
        \begin{gather*}
            \begin{alignedat}{3}
            f^\leftrightarrow(x) &= f(-x) & f^{\mathrel{\text{\ooalign{$\swarrow$\cr$\nearrow$}}}}(x) &= -f(-x) \\
            f^+(x) &= \max(f, 0) &\hspace{6em} f^-(x) &= \min(f, 0) \\
            \end{alignedat}\\
           |x| = \begin{cases}
                +x \quad \text{if $x \ge 0$} \\
                -x \quad \text{if $x \le 0$}
            \end{cases}
        \end{gather*}
    \end{proof}

\end{document}

enter image description here

| improve this answer | |
  • Actually, that is one think I have tried. The problem is that the space between the columns is now smaller in original align*. – user87690 Jul 29 '17 at 13:53
  • You can use alignedat to have full control on the spacing of the columns. You can see the result in another code, based on ntheorem, that I've just added to show how to have a nicer placement of the end-of-proof symbol (on the same line as the last line of the cases environment). – Bernard Jul 29 '17 at 14:23
  • Thank you. Where did the magic constant 1.75ex came from? Do you share my frustration that we need so many modifications in the source to get the desired behavior? – user87690 Jul 29 '17 at 14:32
  • 1
    The value was found by trial and error. The \bllap command, from stackengine is a combination of llap , \smash and stackunder. It could be automatic if I knew how to measure the height of the cases environment. As this problem is rather exceptional, I think (all equations do not end up in a cases environment…), I'm not sure it's worth to delve into it – and personally, I don't know how to do it. – Bernard Jul 29 '17 at 14:46

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.