# gather* and autoaligne errors

I am getting errors with this very simple document:

\documentclass{article}

\usepackage{mathtools}
\usepackage{autoaligne}

\begin{document}
\begin{gather*}
\autoaligne{%
a_1+a_2=0\\%
2a_1-a_2=0%
}
\end{gather*}
\end{document}


The errors are "Missing } inserted." and "Extra }, or forgotten \$.". Why are these errors happening?

Also I plan on adding more equations so gather* is necessary.

• Why is gather* necessary?... If you remove it, you can add different equations as much as you want without any error. – Roboticist Feb 11 '17 at 3:09
• @Roboticist I found it interesting that I was getting an error. Additionally, it is a bit of a hassle to have to repeatedly type $...$. – carloabelli Feb 11 '17 at 3:23
• You don't need to repeatedly type $...$. Just remove gather*, add your equations and consider a break after each one in the \autoaligne. – Roboticist Feb 11 '17 at 3:26
• I filed a bug report. – egreg Feb 11 '17 at 11:04
• The author of autoaligne has already answered that a fixed version is on its way to CTAN. :-D. – egreg Feb 11 '17 at 18:31

# Update

With autoaligne version 1.3, released 2017/02/11, the issue has been solved.

It's a bug in autoaligne, which starts its working with

\iffalse{\fi\ifnum}=0\fi


but doesn't add the corresponding code at the end. Indeed, if I add

\ifnum{=0\fi\iffalse}\fi


at the end of the code for \autoaligne_iii, your code compiles.

Temporary patch, until the package code is fixed:

\documentclass{article}

\usepackage{mathtools}
\usepackage{autoaligne}

\chardef\saveduscatcode=\catcode_
\catcode_=11
\let\saved_autoaligne_iii\autoaligne_iii
\def\autoaligne_iii#1{\saved_autoaligne_iii{#1}\ifnum{=0\fi\iffalse}\fi}
\catcode_=\saveduscatcode

\begin{document}

\begin{align}
\autoaligne{
a_1+a_2=0\\
2a_1-a_2=0
}
\end{align}

\begin{gather*}
\autoaligne{
a_1+a_2=0\\
2a_1-a_2=0
}
\end{gather*}
\end{document}