[texhax] aligned nested in a multlined nested in an align

Ignacy Gawedzki texhax at qult.net
Fri Jun 22 16:43:26 CEST 2007


On Fri, Jun 22, 2007 at 03:08:43PM +0100, thus spake Morten Høgholm:
> On 6/21/07, Ignacy Gawedzki <texhax at qult.net> wrote:
> 
> Hi Ignacy,
> 
> >It's been already a few times when I wanted to nest an aligned environment 
> >in
> >a multlined environment (from mathtools), itself being nested in an align
> >environment.  As soon as there are '&' in the aligned environment, LaTeX
> >complains:
> >
> >  ERROR: Argument of \multlined has an extra }.
> 
> Ah yes, I see. Best thing to do is to contact the author... Oh wait,
> that's me. :-)

So it seems I'm lucky. =)

> Fixing the problem is relatively simple given that one knows which
> dirty trick to use. Place the following in your preamble and it'll fix
> the problem.
> 
> \MHInternalSyntaxOn
> 
> \renewenvironment{multlined}[1][]{
>  \MT_test_for_tcb_other:nnnnn {#1}
>    {\def\MT_mult_default_pos:{#1}}
>    {\def\MT_mult_default_pos:{#1}}
>    {\def\MT_mult_default_pos:{#1}}
>    {
>      \if_meaning:NN \@empty#1\@empty
>      \else:
>        \setlength \l_MT_multwidth_dim{#1}
>      \fi:
>    }
>    \iffalse{\fi\ifnum0=`}\fi % added
>    \MT_multlined_second_arg:w
>  }
>  {
>    \hfilneg  \endaligned
>    \ifnum0=`{\fi\iffalse}\fi % added
>  }
> 
> \MHInternalSyntaxOff

Thanks for the fix, it works like a charm indeed.

> The latter \iffalse ... \fi can be shortened even more but this way
> there is at least a small chance you will keep your sanity. See
> Appendix D of The TeXbook for more on this.

Thanks for the pointer, I'll certainly look at it in details as soon as
possible.

> I will fix this in the source.

Very nice, thank you very much.

-- 
Sex on TV doesn't hurt....unless you fall off.


More information about the texhax mailing list