TransWikia.com

How can I split my equation into lines and have it boxed at the same time

TeX - LaTeX Asked by Santiago G. on April 4, 2021

I want to split my equation into two lines and have it boxed at the same time. I’ve tried split but can’t figure it out. Thanks in advance!

begin{equation}
    boxed{
     int limits_{Omega} frac{1}{mu}nablatimesmathbf{A}cdotnablatimesmathbf{hat{A}}dOmega + int limits_{Omega_{b}} sigmafrac{partial mathbf{A}}{partial t}cdotmathbf{hat{A}}dOmega_{b} +
int limits_{Omega_{b}} sigmafrac{partial(nabla V)}{partial t}cdotmathbf{hat{A}}dOmega_{b} = int limits_{Gamma_{b}} left[frac{1}{mu}nablatimesmathbf{A}timesmathbf{n}right]cdotmathbf{hat{A}}dGamma_{b}}
    label{eq:debil1}
end{equation}

3 Answers

It is not clear (to me), what you like to have in box. So, below are two options:

documentclass[margin=3mm, preview]{standalone} % you not say, which document class you use ...
usepackage{amsmath}

begin{document}
begin{equation}label{eq:debil1}
boxed{
begin{split}
& intlimits_{Omega} frac{1}{mu}nablatimesmathbf{A}cdotnablatimesmathbf{hat{A}}dOmega +
intlimits_{Omega_{b}} 
    sigmafrac{partialmathbf{A}}{partial t}cdotmathbf{hat{A}}dOmega_b +
    intlimits_{Omega_{b}} sigmafrac{partial(nabla V)}{partial t} cdotmathbf{hat{A}}dOmega_b  
& = intlimits_{Gamma_{b}}
    left[frac{1}{mu}nablatimesmathbf{A}timesmathbf{n}right]
    cdotmathbf{hat{A}}dGamma_b
end{split}
}
end{equation}

or 

medskip
fbox{begin{minipage}{dimexprtextwidth-2fboxsep+2fboxrulerelax}
begin{equation}label{eq:debil1}
begin{split}
& intlimits_{Omega} frac{1}{mu}nablatimesmathbf{A}cdotnablatimesmathbf{hat{A}}dOmega +
intlimits_{Omega_{b}}
    sigmafrac{partialmathbf{A}}{partial t}cdotmathbf{hat{A}}dOmega_b +
    intlimits_{Omega_{b}} sigmafrac{partial(nabla V)}{partial t} cdotmathbf{hat{A}}dOmega_b  
& = intlimits_{Gamma_{b}}
        left[frac{1}{mu}nablatimesmathbf{A}timesmathbf{n}right]
        cdotmathbf{hat{A}}dGamma_b
end{split}
end{equation}
    end{minipage}}
end{document}

enter image description here

Correct answer by Zarko on April 4, 2021

The breqn package -- http://www.tug.org/TUGboat/Articles/tb18-3/tb56down.pdf

enter image description here

documentclass[10pt,a4paper]{article}

usepackage{amsmath}

usepackage{breqn}
begin{document}

begin{dmath*}
 int limits_{Omega} frac{1}{mu}nablatimesmathbf{A}cdotnablatimesmathbf{hat{A}}dOmega + int limits_{Omega_{b}} sigmafrac{partial mathbf{A}}{partial t}cdotmathbf{hat{A}}dOmega_{b} +
int limits_{Omega_{b}} sigmafrac{partial(nabla V)}{partial t}cdotmathbf{hat{A}}dOmega_{b} = int limits_{Gamma_{b}} left[frac{1}{mu}nablatimesmathbf{A}timesmathbf{n}right]cdotmathbf{hat{A}}dGamma_{b}
end{dmath*}

end{document}

Answered by js bibra on April 4, 2021

I have two proposals, one with aligned and one with multlined.

enter image description here

documentclass{article}
usepackage{amsmath}
usepackage{mathtools} % necessary for the second solution

newcommand{intl}{intlimits}
newcommand{diff}{mathop{}!d}

begin{document}

begin{equation}
label{eq:debil1}
  boxed{
    begin{aligned}
    &!% because of the following int
    intl_{Omega}
      frac{1}{mu}nablatimesmathbf{A}cdotnablatimeshat{mathbf{A}}
    diffOmega
    +
    intl_{Omega_{b}}
      sigmafrac{partial mathbf{A}}{partial t}cdothat{mathbf{A}}
    diffOmega_{b}
    +
    intl_{Omega_{b}}
      sigmafrac{partial(nabla V)}{partial t}cdothat{mathbf{A}}
    diffOmega_{b}
    
    &=
    intl_{Gamma_{b}}
      left[frac{1}{mu}nablatimesmathbf{A}timesmathbf{n}right]cdothat{mathbf{A}}
    diffGamma_{b}
    end{aligned}
  }% end of boxed
end{equation}

begin{equation}
label{eq:debil1-bis}
  boxed{
    begin{multlined}
    intl_{Omega}
      frac{1}{mu}nablatimesmathbf{A}cdotnablatimeshat{mathbf{A}}
    diffOmega
    +
    intl_{Omega_{b}}
      sigmafrac{partial mathbf{A}}{partial t}cdothat{mathbf{A}}
    diffOmega_{b}
    +
    intl_{Omega_{b}}
      sigmafrac{partial(nabla V)}{partial t}cdothat{mathbf{A}}
    diffOmega_{b}
    
    =
    intl_{Gamma_{b}}
      left[frac{1}{mu}nablatimesmathbf{A}timesmathbf{n}right]cdothat{mathbf{A}}
    diffGamma_{b}
    end{multlined}
  }% end of boxed
end{equation}

end{document}

Some points to note.

  1. the command for the differential ensures the required thin space in front of it; also, you can simply modify its definition if somebody wants you to make all d’s upright (I hope not, but…);

  2. instead of typing intlimits all along, define a command;

  3. I think that “hatting a boldface variable” is better than “boldfacing a hatted variable” (your opinion may vary).

Answered by egreg on April 4, 2021

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