0

I've read several posts explaining the difference between align and alignat such as this TeX SE answer. I want to make a new environment with the capabilities of align (create as many as desired based on the environment's content without having to input a <number> argument) but with the "no horizontal spaces" property of alignat.

Is this possible? If so how can I define such an environment, (let's say altalign)?

Thank you.

user202729
  • 7,143

1 Answers1

1

A simple approach is to make a new environment that forwards 99 to alignat: (remark, this is the "standard" method to redefine environment; nevertheless it will not work for some particular environments that hard codes the environment name. Fortunately it works with this one)

\newenvironment{alignatz}{\alignat{99}}{\endalignat}

\catcode*=11 \newenvironment{alignatz*}{\alignat*{99}}{\endalignat*} \catcode*=12

Usage:

%! TEX program = pdflatex
\documentclass{article}
\usepackage{amsmath}
\begin{document}

\newenvironment{alignatz}{\alignat{99}}{\endalignat}

\catcode*=11 \newenvironment{alignatz*}{\alignat*{99}}{\endalignat*} \catcode*=12

\begin{alignatz} a &= b \quad & c &= d \ a &= b & c &= d \end{alignatz}

\begin{alignatz} a &= b \quad & c &= d \ a &= b & c &= d \end{alignatz}

\end{document}

user202729
  • 7,143
  • Change the environment name yourself. Sometimes people here name custom commands/environments by the asker's name, but I don't like doing that – user202729 May 21 '22 at 15:03