[texhax] problem with a defined command

Philip Taylor P.Taylor at Rhul.Ac.Uk
Fri Jan 17 11:14:35 CET 2014



Lars Madsen wrote:

> With more technical details
> 
> http://tex.stackexchange.com/questions/112558/some-newcommand-instructions-not-working

Interesting, but still does not document /exactly/ for what
\begin {align} is seeking as its terminating delimiter.

> And I still stand on the my comment about deferinging structures like
> \begin{eqaution} etc, the logic is no longer visible in the code and
> it becomes very hard for others to read.

"This one could run and run".  Yes, \beq/\eeq will be less familiar
to others, but in general LaTeX documents are read by a computer,
not by any human other than the author, so "very hard for others
to read" is not really a reason for eschewing custom markup unless
one is working on a collaborative project.

But to return to Mr Emery's original question :

>From a syntactic perspective, the following will work --

\documentclass {minimal}
\usepackage {amsmath}
\def \beq#1\eeq {\begin {equation}#1\end {equation}}
\begin {document}
	\beq
	x=sin(y)
	\eeq
\end {document}

However, the caveats noted at http://tinyurl.com/beqeeq, and in
particular :

> This has to do with unfortunately nontrivial technical complications:
> the given environments must read their contents as a delimited macro
> argument because they do multipass pro- cessing of the contents using
> algorithms inherited from Spivak's amstex.tex.

suggest that this approach may fail for more complex examples, although
even MJD appears to sanction its use [1]

Philip Taylor
--------
[1]
http://ctan.mirrorcatalogs.com/macros/latex/required/amslatex/math/technote.pdf


More information about the texhax mailing list