[OS X TeX] \newcommand\eal{\end{align}
David Arnold
dwarnold45 at suddenlink.net
Thu Nov 18 08:06:53 CET 2010
Ross,
Thanks for your kind reply.
That does help.
D.
On Nov 17, 2010, at 10:58 PM, Ross Moore wrote:
> Hi David,
>
> On 18/11/2010, at 5:06 PM, David Arnold wrote:
>
>> All,
>>
>> A colleague of mine asked why this won't compile.
>>
>> \documentclass[12pt]{article}
>> \usepackage{amsmath,amssymb}
>>
>> \newcommand{\bal}{\begin{align*}}
>> \newcommand{\eal}{\end{align*}}
>
> First the dogma:
>
> Definitions of this kind are prone to disasters.
> You should stick to the markup that is already defined,
> and not make such silly shorthands.
> Use editor templates if there is a need to reduce typing.
>
>
> Now the technical reason why it fails:
>
> The error message is:
>
>>>> Runaway argument?
>>>> \frac {3.5}{4.2} &= \frac {35}{42}\\ &= \frac {5}{6} \eal
>>>> ! Paragraph ended before \align* was complete.
>>>> <to be read again>
>>>> \par
>
>
> The problem is that the tokens in an alignment need to be processed
> *twice* before the display can be created. The first pass is for
> measuring widths (e.g., related to how much space for any \tag ,
> even if there is not one being used) and working out the space
> between columns in the alignment.
>
> To do this, the code needs to read ahead to where the environment
> finishes, *without* expanding macros. When the \end{align*} is
> wrapped up inside \eal then this step can only fail.
>
>
> If there was only a single pass over the code, then the \end{align*}
> would be found as \eal was being expanded. But that is not good
> enough for code, as here, that wants to capture the whole environment
> unambiguously, before proceeding with the finer details.
>
> Not that many of the alignments in amsmath.sty work this way.
> Furthermore, if the output needs to be further encapsulated,
> (e.g. for Tagged PDF) so that it has a chance of working on
> mobile devices, where the size of the output screen is variable,
> then proper unambiguous markup of the input is vital.
>
>
>>
>> \begin{document}
>>
>> \bal
>> \frac{3.5}{4.2} &= \frac{35}{42}\\
>> &= \frac{5}{6}
>> \eal
>>
>> \end{document}
>>
>> I just didn't have a good answer to give to him. Can some expert out there explain?
>>
>> Thanks.
>>
>> David
>
>
> Hope this helps,
>
> Ross
>
> ------------------------------------------------------------------------
> Ross Moore ross.moore at mq.edu.au
> Mathematics Department office: E7A-419
> Macquarie University tel: +61 (0)2 9850 8955
> Sydney, Australia 2109 fax: +61 (0)2 9850 8114
> ------------------------------------------------------------------------
>
>
>
> ----------- Please Consult the Following Before Posting -----------
> TeX FAQ: http://www.tex.ac.uk/faq
> List Reminders and Etiquette: http://email.esm.psu.edu/mac-tex/
> List Archive: http://tug.org/pipermail/macostex-archives/
> TeX on Mac OS X Website: http://mactex-wiki.tug.org/
> List Info: http://email.esm.psu.edu/mailman/listinfo/macosx-tex
>
More information about the macostex-archives
mailing list