2010年3月23日 星期二

boxing equations

作者: hantis (呢呢是豬) 看板: Hantis
標題: [隨寫] Note: boxing equations
時間: Tue Mar 23 12:11:12 2010


   With amsmath package, there is one simple command to box a
   displayed equation: \boxed. Here is an example:

   \begin{equation} % equation, align, ... all work
   \boxed{f = ma}
   \end{equation}

   The above will give a boxed equation like

     __________
    |                       |
    |     f = ma       |       (1)
    |__________|

   However, whenever multiple lines are involved, this does not work.
   The empheq package is helpful here. This package is compatible with
   many commonly used packages such as amsmath and fancybox.

   Simplest usage is like

   \begin{empheq}[box=\fbox]{align}
   f & = ma \\
   p & = mv
   \end{empheq}

   These will give something like
    _______
   |                 |
   |   f = ma   |     (1)
   |   p = mv  |     (2)
   |_______|

   There are other types of boxes that can be called within the help
   of fancybox package. They are doublebox, ovalbox, and shadowbox.
   The last one may cause problem and needs some advanced modification.
   For the other two, one can just, for example,

   \begin{empheq}[box=\doublebox]{align}
   ....
   \end{empheq}

   ovalbox actually sucks. So ignore it.

沒有留言:

張貼留言