Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

How to draw box for my math equation in latex

  1. Jan 8, 2012 #1
    I want to enclose my final equation inside a box but i find no way to do that in latex. please help me out as soon as possible.

    Thanks!!
     
  2. jcsd
  3. Jan 8, 2012 #2
    Use "\boxed{}"
     
  4. Jan 8, 2012 #3
    Not working

    My latex code is

    Code (Text):
    \begin{flalign*}
    E_1 & = \frac{e_{1max}}{\sqrt{2}}\\
    & = \frac{N_1.{\phi}_m.w}{\sqrt{2}}\\
    & = \frac{N_1{\phi}_m.2\pi.f}{\sqrt{2}}\\
    \\
    E_1 & = 4.44 N_1.{\phi}_m.f\\
    \\
    E_1 & = 4.44 N_1.B_m.A.f
    \end{flalign*}
    and after using \boxed in
    Code (Text):
    E_1 & = 4.44 N_1.B_m.A.f
    I get the following error:

    Code (Text):
    This is pdfTeX, Version 3.1415926-1.40.11 (MiKTeX 2.9)
    entering extended mode
    (E:/notes/test.tex
    LaTeX2e <2009/09/24>
    Babel <v3.8l> and hyphenation patterns for english, afrikaans, ancientgreek, ar
    abic, armenian, assamese, basque, bengali, bokmal, bulgarian, catalan, coptic,
    croatian, czech, danish, dutch, esperanto, estonian, farsi, finnish, french, ga
    lician, german, german-x-2009-06-19, greek, gujarati, hindi, hungarian, iceland
    ic, indonesian, interlingua, irish, italian, kannada, kurmanji, lao, latin, lat
    vian, lithuanian, malayalam, marathi, mongolian, mongolianlmc, monogreek, ngerm
    an, ngerman-x-2009-06-19, nynorsk, oriya, panjabi, pinyin, polish, portuguese,
    romanian, russian, sanskrit, serbian, slovak, slovenian, spanish, swedish, swis
    sgerman, tamil, telugu, turkish, turkmen, ukenglish, ukrainian, uppersorbian, u
    senglishmax, welsh, loaded.
    ("C:\Program Files\MiKTeX 2.9\tex\latex\base\report.cls"
    Document Class: report 2007/10/19 v1.4h Standard LaTeX document class
    ("C:\Program Files\MiKTeX 2.9\tex\latex\base\size12.clo"))
    ("C:\Program Files\MiKTeX 2.9\tex\latex\graphics\graphicx.sty"
    ("C:\Program Files\MiKTeX 2.9\tex\latex\graphics\keyval.sty")
    ("C:\Program Files\MiKTeX 2.9\tex\latex\graphics\graphics.sty"
    ("C:\Program Files\MiKTeX 2.9\tex\latex\graphics\trig.sty")
    ("C:\Program Files\MiKTeX 2.9\tex\latex\00miktex\graphics.cfg")
    ("C:\Program Files\MiKTeX 2.9\tex\latex\pdftex-def\pdftex.def"
    ("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\infwarerr.sty")
    ("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\ltxcmds.sty"))))
    ("C:\Program Files\MiKTeX 2.9\tex\latex\ams\math\amsmath.sty"
    For additional information on amsmath, use the `?' option.
    ("C:\Program Files\MiKTeX 2.9\tex\latex\ams\math\amstext.sty"
    ("C:\Program Files\MiKTeX 2.9\tex\latex\ams\math\amsgen.sty"))
    ("C:\Program Files\MiKTeX 2.9\tex\latex\ams\math\amsbsy.sty")
    ("C:\Program Files\MiKTeX 2.9\tex\latex\ams\math\amsopn.sty"))
    (E:\notes\test.aux)
    ======================================================================
    pdflatex.EXE: Cannot start MiKTeX package manager.
    pdflatex.EXE: Data: Invalid syntax

    ======================================================================
     (E:\notes\title.tex
    <./images/logo.png, id=1, 143.53625pt x 59.22125pt> <use ./images/logo.png>
    [1{C:/ProgramData/MiKTeX/2.9/pdftex/config/pdftex.map} <E:/notes/images/logo.pn
    g>])
    Chapter 1.
    <./images/1.jpg, id=12, 401.5pt x 301.125pt> <use ./images/1.jpg>
    <./images/2.jpg, id=13, 401.5pt x 303.1325pt> <use ./images/2.jpg>
    <./images/3.jpg, id=14, 401.5pt x 301.125pt> <use ./images/3.jpg>
    <./images/4.jpg, id=15, 201.75375pt x 225.09094pt> <use ./images/4.jpg>
    Overfull \hbox (2.61108pt too wide) in paragraph at lines 8--12
    [] []

    Overfull \hbox (2.61108pt too wide) in paragraph at lines 8--12
    [] []
    [1 <E:/notes/images/1.jpg> <E:/notes/images/2.jpg> <E:/notes/images/3.jpg> <E:/
    notes/images/4.jpg>] <./images/6.png, id=19, 208.52907pt x 125.71968pt>
    <use ./images/6.png>
    Underfull \hbox (badness 10000) in paragraph at lines 18--23


    Underfull \hbox (badness 10000) in paragraph at lines 18--23


    Underfull \hbox (badness 10000) in paragraph at lines 24--31


    Underfull \hbox (badness 10000) in paragraph at lines 24--31


    Underfull \hbox (badness 10000) in paragraph at lines 24--31

    [2 <E:/notes/images/6.png (PNG copy)>]

    Package amsmath Warning: Foreign command \over;
    (amsmath)                \frac or \genfrac should be used instead
    (amsmath)                 on input line 38.


    Underfull \hbox (badness 10000) in paragraph at lines 43--46


    Underfull \hbox (badness 10000) in paragraph at lines 50--51

    ! Missing } inserted.
    <inserted text>
                    }
    l.59 \end{flalign*}
                       
    ?
     
  5. Jan 8, 2012 #4
    To use the \boxed{} command, I think you need to load amsmath package.
     
  6. Jan 8, 2012 #5

    D H

    User Avatar
    Staff Emeritus
    Science Advisor

    snshusat161 is doing just that. Look at the LaTeX output:


    Well of course it's not working. You can't box around the separator character "&". That doesn't make sense.

    What you can do is to put a box around the right hand side of your final equation:
    Code (Text):
    \begin{align*}
    E_1 & = \frac{e_{1max}}{\sqrt{2}}\\
    & = \frac{N_1.{\phi}_m.w}{\sqrt{2}}\\
    & = \frac{N_1{\phi}_m.2\pi.f}{\sqrt{2}}\\
    \\
    E_1 & = 4.44 N_1.{\phi}_m.f \\
    \\
    E_1 &= \boxed{4.44 N_1.B_m.A.f}
    \end{align*}
    [tex]\begin{align}
    E_1 & = \frac{e_{1max}}{\sqrt{2}}\\
    & = \frac{N_1.{\phi}_m.w}{\sqrt{2}}\\
    & = \frac{N_1{\phi}_m.2\pi.f}{\sqrt{2}}\\
    \\
    E_1 & = 4.44 N_1.{\phi}_m.f \\
    \\
    E_1 &= \boxed{4.44 N_1.B_m.A.f}
    \end{align}[/tex]


    You can box the entire final equation as well, but you'll have to make your final equation standalone:
    Code (Text):
    \begin{align*}
    E_1 & = \frac{e_{1max}}{\sqrt{2}}\\
    & = \frac{N_1.{\phi}_m.w}{\sqrt{2}}\\
    & = \frac{N_1{\phi}_m.2\pi.f}{\sqrt{2}}\\
    \\
    E_1 & = 4.44 N_1.{\phi}_m.f
    \end{align*}
    \begin{equation*}
    \boxed{E_1 = 4.44 N_1.B_m.A.f}
    \end{equation*}
     
    [tex]\begin{align}
    E_1 & = \frac{e_{1max}}{\sqrt{2}}\\
    & = \frac{N_1.{\phi}_m.w}{\sqrt{2}}\\
    & = \frac{N_1{\phi}_m.2\pi.f}{\sqrt{2}}\\
    \\
    E_1 & = 4.44 N_1.{\phi}_m.f
    \end{align}[/tex][tex]
    \boxed{E_1 = 4.44 N_1.B_m.A.f}
    [/tex]



    BTW, it would have been helpful in the original post if you had specified that you wanted to do this in a flalign environment.
     
  7. Jan 8, 2012 #6
    Thanks D H. You are great! :)
     
  8. Jan 9, 2012 #7

    robphy

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    [tex]
    \begin{align*}
    E_1 & = \frac{e_{1max}}{\sqrt{2}}\\
    & = \frac{N_1.{\phi}_m.w}{\sqrt{2}}\\
    & = \frac{N_1{\phi}_m.2\pi.f}{\sqrt{2}}\\
    \\
    E_1 & = 4.44 N_1.{\phi}_m.f \\
    \\
    E_1 &= \fbox{$4.44 N_1.B_m.A.f$}
    \end{align*}
    [/tex]
    \fbox works in ordinary [itex]\LaTeX[/itex]... but you'll need to use \fbox{$math expression$}
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: How to draw box for my math equation in latex
Loading...