Document ClassesRedefining \[ to \begin{align*}

Information and discussion about specific document classes and how to create your own document classes.
Post Reply
alukyane
Posts: 2
Joined: Thu Oct 30, 2008 8:18 pm

Redefining \[ to \begin{align*}

Post by alukyane »

Hello world,

This may not be proper style, but I would find it very convenient to

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

While this works,

\[5\]

produces the error "Paragraph ended before \align* was complete".

Does anyone have any ideas for making this work? I'm using MiKTeX and TeXnicCenter.

Thanks in advance,
-Anton

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Redefining \[ to \begin{align*}

Post by Stefan Kottwitz »

Hi Anton,

welcome to the board!
This approach should work:

Code: Select all

\def\[#1\]{\begin{align*}#1\end{align*}}
Stefan
LaTeX.org admin
alukyane
Posts: 2
Joined: Thu Oct 30, 2008 8:18 pm

Re: Redefining \[ to \begin{align*}

Post by alukyane »

Thanks Stefan, that works great!
-Anton
User avatar
Juanjo
Posts: 657
Joined: Sat Jan 27, 2007 12:46 am

Redefining \[ to \begin{align*}

Post by Juanjo »

alukyane wrote: This may not be proper style,...
Not, of course, even, IMHO, bad style, since you are changing completely the function of one basic LaTeX environment. I figure out that you pretend to always use your new \[...\] environment both for single and for multiline formulas. In such a case, please note that, for single formulas, the align* environment (implicitly used) is not equivalent to the default \[...\]. I conjecture that you will get many formulas with bad vertical space around, if not any other problems.
The CTAN lion is an artwork by Duane Bibby. Courtesy of www.ctan.org.
ampinto
Posts: 1
Joined: Wed Jul 18, 2012 7:27 pm

Redefining \[ to \begin{align*}

Post by ampinto »

I agree, it's bad style.

On the other hand, the previous solution gave me an idea:

Code: Select all

\def\bal#1\eal{\begin{align*}#1\end{align*}}
This works like a charm, and finally allows me to write \bal \eal instead of \begin{align} \end{align}.
Post Reply