TransWikia.com

Framing an equation and equation array (boxed)

TeX - LaTeX Asked on August 7, 2021

I want to nicely put equations and equations arrays inside a box or a frame.
I also like to align objects in align environment like in the eqnarray environment [r|c|l], see example below.

Working example:

documentclass{article}[A4]
usepackage{amsmath,amssymb}

newenvironment{bbox}
{parsmallskipcenteringbegin{lrbox}{0}%
begin{minipage}[c]{0.99textwidth}}
{end{minipage}end{lrbox}%
framebox[0.99textwidth]{usebox{0}}%
parmedskip
ignorespacesafterend}

begin{document}

title{Box test}

I want to box equations. For a simple equation:
begin{equation} label{1}
boxed{ 1 + 2 = pi - 0.14 quad  implies quad pi in mathbb{Q}  }
end{equation}
Eqnarray:
begin{eqnarray}
1 + 2 = pi - 0.14  & implies & pi in mathbb{Q} 
end{eqnarray}
Align:
begin{align}
1 + 2 = pi - 0.14  & implies & pi in mathbb{Q} 
end{align}
I want the texttt{align} to be aligned like texttt{eqnarray}, how to do that?

For align and eqnarray the texttt{boxed} won't work,
begin{verbatim}
begin{align}
boxed{ 1 + 2 = pi - 0.14  & implies & pi in mathbb{Q} }
end{align}
end{verbatim}
Using the environment ``bbox'' it seems to work but has some space in the top so it looks a little bit ugly:
begin{bbox}
begin{align}
 1 + 2 = pi - 0.14  & implies & pi in mathbb{Q} 
end{align}
end{bbox}
I want it to look like equation eqref{1}

How to do that?

The result:
The result of this LaTeX code

Edit: What about multiline equations?

Multiline:
begin{align}
Aboxed{ 1 + 2 = pi - 0.14   implies & pi in mathbb{Q}  
3 ne pi implies & pi in mathbb{R} } 
end{align}

See also:
Create environment out of eqnarray with frame box

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP