Register to reply

Latex question

by kdv
Tags: latex
Share this thread:
kdv
#1
Jan13-08, 03:11 PM
P: 329
I am not sure if this is the right place to post a Latex question. If not, tell me where I should go.

I would like to put equations inside a box. Now, I have found two ways to do this butthey work only for single line equations. The best method is to simply put the equations between boxed braces, i.e. \boxed{ equation}

this works if I am in an equation array i.e.

\begin{equation} \boxed{equation} \end{equation}

I have tried the same thing in an eqnarray but I get compilations errors. I would like to have equations spanning several lines which would be inside a box.

Anybody can help?

Thanks
Phys.Org News Partner Science news on Phys.org
'Office life' of bacteria may be their weak spot
Lunar explorers will walk at higher speeds than thought
Philips introduces BlueTouch, PulseRelief control for pain relief
OmCheeto
#2
Jan13-08, 03:25 PM
PF Gold
OmCheeto's Avatar
P: 1,435
Quote Quote by kdv View Post
I am not sure if this is the right place to post a Latex question. If not, tell me where I should go.

I would like to put equations inside a box. Now, I have found two ways to do this butthey work only for single line equations. The best method is to simply put the equations between boxed braces, i.e. \boxed{ equation}

this works if I am in an equation array i.e.

\begin{equation} \boxed{equation} \end{equation}

I have tried the same thing in an eqnarray but I get compilations errors. I would like to have equations spanning several lines which would be inside a box.

Anybody can help?

Thanks
There are instructions in the LaTeX thread here at the forum. I haven't read the entire thing. There are over 700 posts.
kdv
#3
Jan27-08, 07:57 PM
P: 329
Quote Quote by kdv View Post
I am not sure if this is the right place to post a Latex question. If not, tell me where I should go.

I would like to put equations inside a box. Now, I have found two ways to do this butthey work only for single line equations. The best method is to simply put the equations between boxed braces, i.e. \boxed{ equation}

this works if I am in an equation array i.e.

\begin{equation} \boxed{equation} \end{equation}

I have tried the same thing in an eqnarray but I get compilations errors. I would like to have equations spanning several lines which would be inside a box.

Anybody can help?

Thanks
I found a way but I am not sure if it will work on the forums here, so here's the trick:
[tex]
\begin{equation*}
\addtolength{\fboxsep}{5pt}
\boxed{
\begin{gathered}
\Pi_{i=1}^m \int d^4x_i \, e^{-i (k \cdot x)_i} ~\Pi_{j=1}^n \int d^4y_j \, e^{+ i (p \cdot y)_j} \\
<0| T\{ \phi(x_1) \ldots \phi(x_m) \phi(y_1) \ldots \phi(y_n) \} |0>
\\ = \biggl( \Pi_{i=1}^m \frac{i \sqrt{Z}}{k_i^2 - m^2} \biggr) \biggl(\Pi_{j=1}^n \frac{i \sqrt{Z}}{p_j^2 - m^2} \biggr) ~<\vec{p}_1 \ldots \vec{p_n}|i T| \vec{k_1} \ldots \vec{k_m}>
\end{gathered}
}
\end{equation*}
[/tex]

It worked!!!!!!

(For anybody interested, left click on the equation to see the source code)

Bob505
#4
May13-10, 11:17 AM
P: 1
Latex question

Thanks a lot for this tip kdv I'd been wondering how to get boxes around multiline equations.

Also, for alignment you can use the 'split' environment rather than 'gathered'.

[tex]
\begin{equation*}
\addtolength{\fboxsep}{10pt}
\boxed{
\begin{split}
\int \frac{d^D P}{(2\pi)^D} \frac{{\cal P}_n(P)}
{P^{2\alpha}(P-Q)^{2\beta}} =
&\frac{1}{(4\pi)^2}(Q^2)^{D/2-\alpha-\beta}\sum_{\sigma \ge 0}^{[n/2]}
G(\alpha,\beta,n,\sigma) \cdot \\
&\cdot Q^{2\sigma} \left\{ \frac{1}{\sigma !}
\left( \frac {\Box} {4} \right) ^\sigma {\cal P}_n(P)\right\}_{P=Q}
\end{split}
}
\end{equation*}
[/tex]

For anybody compiling this remember to include \usepackage{amsmath} in your preamble and for this particular example also \usepackage{amssymb} for the D'Alembertian.

Thanks again.
SadScholar
#5
Jul19-12, 07:40 PM
P: 36
kdv, thanks for posting your answer after finding it. Google funneled me here, and your post has helped me out.


Register to reply

Related Discussions
Latex question: Math & Science Software 4
LaTex Question Math & Science Software 1
LaTeX Question Forum Feedback & Announcements 3
Latex question Math & Science Software 4
Latex Question #2 Introductory Physics Homework 4