2

I am using the following code but the result obtained is not setting in the space (left column of the page). I have it on my page but it is overlapping the text on the right column of the page. How can I decrease the size of math equations or is there any other way I can make it settle in that particular space?

\Bigg(
\begin{tabular}{c}
$x_n$ \\
$y_n$ \\
$z_n$ 
\end{tabular} 
\Bigg)  = \Bigg( 
\begin{tabular}{ccc}
$\cos\theta\cos\psi$ & $-\cos\phi\sin\psi +\sin\phi\sin\theta\cos\psi$ & $\sin\phi\sin\psi +\cos\phi\cos\psi\sin\theta$ \\

$\cos\theta\sin\psi$ & $\cos\phi\cos\psi +\sin\phi\sin\theta\sin\psi$ & $\sin\theta\sin\psi\cos\phi - \cos\psi\sin\phi$ \\

$\sin\theta$ & $cos\theta\sin\phi$ & $cos\theta\cos\phi$
\end{tabular}  \Bigg( \begin{tabular}{c}
$x_b$ \\
$y_b$ \\
$z_b$
\end{tabular} \Bigg)
3
  • 1
    Please search this site for questions such as "how do I break an equation". If you still can't find a satisfactory solution, create a minimal example to show what you've tried and didn't work. (Hint: use amsmath) Commented Jul 7, 2015 at 7:15
  • If you literally want to decrease the size, use \tiny. That's probably not what you meant. So you have to decide how you want it to look. Then someone here can maybe help you make it look like that. (Also, the number of open parens in your text does not match the number of close parens. Is this intended?)
    – Mark
    Commented Jul 7, 2015 at 7:25
  • To add to Will Robertson's comment, the amsmath docs can be found at mirrors.ctan.org/macros/latex/required/amslatex/math/…. You may be particularly interested in the smallmatrix environment.
    – Mark
    Commented Jul 7, 2015 at 7:40

4 Answers 4

5

It is best to divide this up into smaller elements, the 3x3 matrix is simply too big. Giving names to the columns and writing them out separately provides narrower text. Below I give two version, the first using the convenient amsmath package, the second with standard LaTeX commands. In the standard LaTeX version, note that array is appropriate in math mode, rather than tabular.

Sample output

\documentclass[twocolumn]{article}

\usepackage{amsmath}

\begin{document}

\begin{equation*}
  \begin{pmatrix}
    x_n \\
    y_n \\
    z_n
  \end{pmatrix}
  =
  \begin{pmatrix}    
    v_1& v_2& v_3
  \end{pmatrix}
  \begin{pmatrix}
    x_b \\
    y_b \\
    z_b
  \end{pmatrix}
  ,
\end{equation*}
where
\begin{gather*}
  v_1 =
  \begin{pmatrix}
    \cos\theta\cos\psi \\
    \cos\theta\sin\psi  \\
    \sin\theta
  \end{pmatrix}
  ,\\
  v_2 =
  \begin{pmatrix}
    -\cos\phi\sin\psi +\sin\phi\sin\theta\cos\psi\\
    \cos\phi\cos\psi +\sin\phi\sin\theta\sin\psi\\
    \cos\theta\sin\phi
  \end{pmatrix}
  , \\
  v_3 = \begin{pmatrix}
    \sin\phi\sin\psi +\cos\phi\cos\psi\sin\theta \\
    \sin\theta\sin\psi\cos\phi - \cos\psi\sin\phi \\
    \cos\theta\cos\phi
  \end{pmatrix}.
\end{gather*}

Poorer version in standard LaTeX:
\begin{displaymath}
  \left(\begin{array}{c}
    x_n \\
    y_n \\
    z_n
  \end{array}\right)
  =
  \left(\begin{array}{ccc}    
    v_1& v_2& v_3
  \end{array}\right)
  \left(\begin{array}{c}
    x_b \\
    y_b \\
    z_b
  \end{array}\right)
  ,
\end{displaymath}
where
\begin{eqnarray}
  v_1 &=&
  \left(\begin{array}{c}
    \cos\theta\cos\psi \\
    \cos\theta\sin\psi  \\
    \sin\theta
  \end{array}\right)
  ,\nonumber \\
  v_2 &=&
  \left(\begin{array}{c}
    -\cos\phi\sin\psi +\sin\phi\sin\theta\cos\psi\\
    \cos\phi\cos\psi +\sin\phi\sin\theta\sin\psi\\
    \cos\theta\sin\phi
  \end{array}\right)
  ,\nonumber \\
  v_3 &=& \left(\begin{array}{c}
    \sin\phi\sin\psi +\cos\phi\cos\psi\sin\theta \\
    \sin\theta\sin\psi\cos\phi - \cos\psi\sin\phi \\
    \cos\theta\cos\phi
  \end{array}\right)
  \nonumber.
\end{eqnarray}

\end{document}

See the amsmath documentation for other math environments with differental alignment possibilities.

4
  • Possibly with align* instead of gather*?
    – egreg
    Commented Jul 7, 2015 at 9:33
  • I prefer gather in this case. Had two of the expressions been narrow, then I would have put them on one line. Commented Jul 7, 2015 at 10:22
  • I wasn't objecting to your choice, just pointing to an alternative. :)
    – egreg
    Commented Jul 7, 2015 at 10:36
  • @egreg There is an endless road of different choices :-) I have add general ref to the amsmath documentation. Commented Jul 7, 2015 at 10:39
2

A solution combining a smaller font size, the flalign* environment and breaking the middle matrix in two:

 \documentclass[twocolumn]{article}

\usepackage{geometry}
\usepackage{mathtools}
\usepackage{lipsum}
\setlength{\columnsep}{0.6cm}

\begin{document}

\lipsum[2]
%
{\footnotesize\setlength\arraycolsep{3pt}
  \begin{flalign*}
    & \mathrlap{ \begin{bmatrix}
      x_n \\
      y_n \\
      z_n
      \end{bmatrix}
      =
      \left[\begin{array}{cc}
        \cos\theta\cos\psi & -\cos\phi\sin\psi +\sin\phi\sin\theta\cos\psi \\
        \cos\theta\sin\psi & \cos\phi\cos\psi +\sin\phi\sin\theta\sin\psi \\
        \sin\theta & cos\theta\sin\phi
        \end{array} \right.} \\
      & & & & & \left.\begin{array}{c}
      \sin\phi\sin\psi +\cos\phi\cos\psi\sin\theta \\
      \sin\theta\sin\psi\cos\phi - \cos\psi\sin\phi \\
      cos\theta\cos\phi
    \end{array}\right]
    %
    \begin{bmatrix}
      x_b \\
      y_b \\
      z_b
    \end{bmatrix} \\[-2ex]
  \end{flalign*}}%
\lipsum[3-6]

\end{document} 

enter image description here

2
  • there's a small space, less than the paragraph indentation, starting the paragraph that follows the display. to get rid of it, you need to put a % sign at the end of the line \end{flalign}}; the extra } at the end of that line (needed because of the font size change) suppresses the usual test-for-continuation-of-paragraph. Commented Jul 7, 2015 at 15:15
  • @barbar beeton: Thanks for the tip. I'll correct it in a moment.
    – Bernard
    Commented Jul 7, 2015 at 16:02
2

Based on Bernard's answer, I propose using widetext. Yes, this fails "Fit [...] in a single column", but I assume this is useful nonetheless.

\documentclass[twocolumn]{article}

\usepackage{amsmath}
\usepackage{lipsum}
\usepackage{widetext}
\setlength{\columnsep}{0.6cm}

\begin{document}

\lipsum[2]
%
\begin{widetext}
\begin{align*}
    \begin{bmatrix}
        x_n \\
        y_n \\
        z_n
        \end{bmatrix}
        &=
        \begin{bmatrix}
            \cos\theta\cos\psi & -\cos\phi\sin\psi +\sin\phi\sin\theta\cos\psi & \sin\phi\sin\psi +\cos\phi\cos\psi\sin\theta\\
            \cos\theta\sin\psi & \cos\phi\cos\psi +\sin\phi\sin\theta\sin\psi & \sin\theta\sin\psi\cos\phi - \cos\psi\sin\phi\\
            \sin\theta & cos\theta\sin\phi & cos\theta\cos\phi
        \end{bmatrix}
    %
    \begin{bmatrix}
        x_b \\
        y_b \\
        z_b
    \end{bmatrix} \\[-2ex]
\end{align*}%
\end{widetext}
%
\lipsum[3-6]

\end{document}

widetext

0

Try this:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{equation*}\left(\begin{array}{c}
x_n \\
y_n \\
z_n 
\end{array} 
\right)  = \left( 
\begin{array}{ccc}
\cos\theta\cos\psi & -\cos\phi\sin\psi +\sin\phi\sin\theta\cos\psi & \sin\phi\sin\psi +\cos\phi\cos\psi\sin\theta \\

\cos\theta\sin\psi & \cos\phi\cos\psi +\sin\phi\sin\theta\sin\psi & \sin\theta\sin\psi\cos\phi - \cos\psi\sin\phi \\

\sin\theta & \cos\theta\sin\phi & \cos\theta\cos\phi
\end{array}\right)  \left( \begin{array}{c}
x_b \\
y_b\\
z_b
\end{array} \right)
\end{equation*}
\end{document}
1
  • This doesn't really help the OP I think, as he has a two-column document. And you get an overfull hbox because the equation is wider than the textblock. Commented Jul 7, 2015 at 8:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .