TeX - LaTeX Asked by Jaredan Durbin on April 17, 2021
I want to put a box around the final two lines in this
begin{equation}
begin{split}
leftlanglevec{u}rightrangle&=frac{1}{4}Releft(epsilon_0vec{overset{sim}{E}}cdotvec{overset{sim}{E}}^*+frac{1}{mu_0}vec{overset{sim}{B}}cdotvec{overset{sim}{B}}^*right)
&=frac{1}{4}left[epsilon_0left(frac{piomega B_0}{left(frac{omega}{c}right)^2-k^2}right)^2left[left(frac{n}{b}right)^2cos^2left(frac{mpi}{a}xright)sin^2left(frac{npi}{b}yright)+left(frac{m}{a}right)^2sin^2left(frac{mpi}{a}xright)cos^2left(frac{npi}{b}yright)right]right.
&qquad+frac{1}{mu_0}left(frac{pi kB_0}{left(frac{omega}{c}right)^2-k^2}right)^2left[left(frac{m}{a}right)^2sin^2left(frac{mpi}{a}xright)cos^2left(frac{npi}{b}yright)+left(frac{n}{b}right)^2cos^2left(frac{mpi}{a}xright)sin^2left(frac{npi}{b}yright)right.
&qquadqquadleft.left(frac{left(frac{omega}{c}right)^2-k^2}{pi k}right)cos^2left(frac{mpi}{a}xright)cos^2left(frac{npi}{b}yright)right]
%Box starting here
&=left(frac{pi B_0}{2left[left(frac{omega}{c}right)^2-k^2right]}right)^2left[left(epsilon_0omega+frac{k}{mu_0}right)left[left(frac{n}{b}right)^2cos^2left(frac{mpi}{a}xright)sin^2left(frac{npi}{b}yright)right.right.
&qquadleft.left.+left(frac{m}{a}right)^2sin^2left(frac{mpi}{a}xright)cos^2left(frac{npi}{b}yright)right]+left(frac{left(frac{omega}{c}right)^2-k^2}{pimu_0k}right)cos^2left(frac{mpi}{a}xright)cos^2left(frac{npi}{b}yright)right]
%and ending here
end{split}
end{equation}
I want it to pretty much look like this
begin{equation}
begin{split}
leftlanglevec{S}rightrangle&=frac{1}{2mu_0}Releft(vec{overset{sim}{E}}timesvec{overset{sim}{B}}^*right)
&=frac{1}{2mu_0}Releft(frac{ipi B_0}{left(frac{omega}{c}right)^2-k^2}left[leftlanglefrac{-nomega}{b}left[cosleft(frac{mpi}{a}xright)sinleft(frac{npi}{b}yright)right],frac{momega}{a}left[sinleft(frac{mpi}{a}xright)cosleft(frac{npi}{b}yright)right],0rightrangleright.right.
&qquadtimesleftlanglefrac{mk}{a}left[sinleft(frac{mpi}{a}xright)cosleft(frac{npi}{b}yright)right],frac{nk}{b}left[cosleft(frac{mpi}{a}xright)sinleft(frac{npi}{b}yright)right],right.
&qquadqquadleft.left.left.frac{-ileft[left(frac{omega}{c}right)^2-k^2right]}{pi}cosleft(frac{mpi}{a}xright)cosleft(frac{npi}{b}yright)rightrangleright]right)
&=frac{1}{2mu_0}Releft(frac{ipi B_0}{left(frac{omega}{c}right)^2-k^2}leftlanglefrac{-imomegaleft[left(frac{omega}{c}right)^2-k^2right]}{pi a}sinleft(frac{mpi}{a}xright)cosleft(frac{mpi}{a}xright)cos^2left(frac{npi}{b}yright),right.right.
&qquadfrac{inomegaleft[left(frac{omega}{c}right)^2-k^2right]}{pi b}cos^2left(frac{mpi}{a}xright)sinleft(frac{npi}{b}yright)cosleft(frac{npi}{b}yright), frac{-n^2omega k}{b^2}left[cos^2left(frac{mpi}{a}xright)sin^2left(frac{npi}{b}yright)right]
&qquadqquadleft.left.-frac{m^2omega k}{a^2}left[sin^2left(frac{mpi}{a}xright)cos^2left(frac{npi}{b}yright)right]rightrangleright)
&fbox{$=frac{omega B_0}{2mu_0}leftlanglefrac{m}{a}sinleft(frac{mpi}{a}xright)cosleft(frac{mpi}{a}xright)cos^2left(frac{npi}{b}yright),frac{n}{b}cos^2left(frac{mpi}{a}xright)sinleft(frac{npi}{b}yright)cosleft(frac{npi}{b}yright),0rightrangle$}
end{split}
end{equation}
I’ve tried using fbox, but I cannot seem to get it to span multiple lines keeping my paragraphing and tabs. Also sorry for the messy code!
The amsmath
package provides a macro called boxed
for just this purposes. Note that I encased an aligned
environment inside the boxed
directive. And I also replaced all instances of left(frac{omega}{c}right)
with (omega/c)
to achieve a more compact appearance of the formulas.
In the following solution, the =
symbol is not inside the box. If it has to be inside the box, you'll need to replace
%Box starting here
&=boxed{begin{aligned}[t]
&biggl(frac{pi B_0}{2left[(omega/c)^2-k^2right]}biggr)^{!2}
with
%Box starting here
&boxed{begin{aligned}
&=biggl(frac{pi B_0}{2left[(omega/c)^2-k^2right]}biggr)^{!2}
in the code given below.
documentclass{article}
usepackage[letterpaper,margin=1in]{geometry} % set page parameters appropriately
usepackage{amsmath}
usepackage{mleftright} % for tightly-spaced left...right constructs
mleftright
begin{document}
begin{equation}
begin{split}
langlevec{u}mkern1.5murangle
&=frac{1}{4}ReBigl( epsilon_0vec{widetilde{E}}cdotvec{widetilde{E}}^*
+frac{1}{mu_0}vec{widetilde{B}}cdotvec{widetilde{B}}^* Bigr)
&=frac{1}{4}
Biggl[
epsilon_0
left(frac{piomega B_0}{(omega/c)^2-k^2}right)^{!2}
left[left(frac{n}{b}right)^2cos^2
left(frac{mpi}{a}xright)sin^2
left(frac{npi}{b}yright)
+left(frac{m}{a}right)^2sin^2
left(frac{mpi}{a}xright)cos^2
left(frac{npi}{b}yright)right]
&qquad+frac{1}{mu_0}
left(frac{pi kB_0}{(omega/c)^2-k^2}right)^{!2}
left[left(frac{m}{a}right)^2sin^2
left(frac{mpi}{a}xright)cos^2
left(frac{npi}{b}yright)
+left(frac{n}{b}right)^2cos^2
left(frac{mpi}{a}xright)sin^2
left(frac{npi}{b}yright)right.
&qquadqquad
left(frac{(omega/c)^2-k^2}{pi k}right)cos^2
left(frac{mpi}{a}xright)cos^2
left(frac{npi}{b}yright)
Biggr]
%Box starting here
&=boxed{begin{aligned}[t]
&biggl(frac{pi B_0}{2left[(omega/c)^2-k^2right]}biggr)^{!2}
Biggl[
left(epsilon_0omega+frac{k}{mu_0}right)
biggl[left(frac{n}{b}right)^2cos^2
left(frac{mpi}{a}xright)sin^2
left(frac{npi}{b}yright)
&qquad+left(frac{m}{a}right)^2sin^2
left(frac{mpi}{a}xright)cos^2
left(frac{npi}{b}yright)biggr]
+left(frac{(omega/c)^2-k^2}{pimu_0k}right)cos^2
left(frac{mpi}{a}xright)cos^2
left(frac{npi}{b}yright)
Biggr]
end{aligned}}
%and ending here
end{split}
end{equation}
end{document}
Correct answer by Mico on April 17, 2021
The Aboxed
command from mathtools
alows for including the alignment point in a framebox. To enclose several lines I use the multlined
environment from the same package, and aligned
for the lines above:
documentclass{article}
usepackage{geometry}
usepackage{mathtools}
begin{document}
begin{equation}
begin{split}
leftlanglevec{u}rightrangle&=frac{1}{4}Releft(epsilon_0vec{overset{sim}{E}}cdotvec{overset{sim}{E}}^*+frac{1}{mu_0}vec{overset{sim}{B}}cdotvec{overset{sim}{B}}^*right)
&=begin{alignedat}[t]{2} frac{1}{4}Biggl[& epsilon_0left(frac{piomega B_0}{left(frac{omega}{c}right)^2-k^2}right)^{mkern-5mu 2} left[left(frac{n}{b}right)^2cos^2left(frac{mpi}{a}xright)sin^2left(frac{npi}{b}yright)+left(frac{m}{a}right)^2sin^2left(frac{mpi}{a}xright)cos^2left(frac{npi}{b}yright)right] & &
& +frac{1}{mu_0}left(frac{pi kB_0}{left(frac{omega}{c}right)^2 - k^2}right)^{mkern-5mu 2} biggl[left(frac{m}{a}right)^2sin^2left(frac{mpi}{a}xright)cos^2left(frac{npi}{b}yright)%
& & mathllap{+left(frac{n}{b}right)^2cos^2left(frac{mpi}{a}xright)sin^2left(frac{npi}{b}yright)
left(frac{left(frac{omega}{c}right)^2-k^2}{pi k}right)cos^2left(frac{mpi}{a}xright)cos^2left(frac{npi}{b}yright)Biggr]} &
end{alignedat}
%Box starting here
Aboxed{&=begin{multlined}[t] left(frac{pi B_0}{2left[left(frac{omega}{c}right)^2-k^2right]}right)^{mkern-5mu 2} left[left(epsilon_0omega+frac{k}{mu_0}right)left[left(frac{n}{b}right)^2cos^2left(frac{mpi}{a}xright)sin^2left(frac{npi}{b}yright)right.right.
left.left.+left(frac{m}{a}right)^2sin^2left(frac{mpi}{a}xright)cos^2left(frac{npi}{b}yright)right]+left(frac{left(frac{omega}{c}right)^2-k^2}{pimu_0k}right)cos^2left(frac{mpi}{a}xright)cos^2left(frac{npi}{b}yright)right]
end{multlined}}
%and ending here
end{split}
end{equation}
end{document}
Answered by Bernard on April 17, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP