Here is a minimal example of what I want to do.
\documentclass{article}\usepackage{amsmath}\makeatletter\newcommand{\mylinebreak}{\@ifstar\@mylinebreak\@@mylinebreak}\newcommand{\@mylinebreak}{&\\}\newcommand{\@@mylinebreak}{&&\\}%\let\mylinebreak\@@mylinebreak\makeatother\begin{document}\begin{align*} a&=b\mylinebreak&=c.\end{align*}\end{document}
This gives the error message
! Misplaced alignment tab character &.\@@mylinebreak ->&&\\l.16 \end{align*}
What is wrong? How can I get this to work?
Curiously, I get no error message if I remove the %
or if I use \mylinebreak*
instead.
I am guessing that the problem can be solved using the tricks involving master/balance counters, but I could not make this work.