[texhax] A question with regards to align*

Toby Cubitt toby-dated-1208099527.b21406 at dr-qubit.org
Tue Apr 8 17:12:01 CEST 2008


Christian Hans Aastrup wrote:
> Hello there!
> 
> I'm very happy to display mathematics in
> 
> \begin{align*}
> ...
> \end{align*}
> 
> and I'm wondering whether it is possible to make LaTeX read
> 
> $$ .... $$ as \begin{align*} ... \end{align*}???

Probably...but not easy. You'll have to change the catcode of $ to make 
it into an active character (not too difficult, but requires familiarity 
with low-level TeX), then define macros that expand to the right thing 
depending on whether you're opening or closing the environment (no idea 
how :) The flexisym and breqn packages from the mh bundle (available on 
CTAN) might give you some pointers.

It will undoubtedly be easier to define $$ to be a smart short-cut that 
inserts \begin{align*} or \end{align*} as appropriate, assuming you're 
using a decent editor (e.g. emacs, vim, or something fairly programmable 
-- no flame wars about the definition of "decent", please :)

If you were prepared to use \[...\] instead of $$...$$, then it would 
probably just be a case of (untested):

\renewcommand{\[}{\begin{align*}
\renewcommand{\]}{\end{align*}


HTH,

Toby


More information about the texhax mailing list