Math & ScienceMatrix within a matrix

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
davefulton
Posts: 8
Joined: Wed May 05, 2010 8:36 pm

Matrix within a matrix

Post by davefulton »

Hello all,
I am trying to get this array

Code: Select all

\begin{equation}U = \left( \begin{array}{c}
\rho\\
\rho u\\
\rho v\end{array} \right),\end{equation}
into the values marked x in this array

Code: Select all

\[ F^+(U) = \left\{ \begin{array}{ll}
         x & \mbox{$x \geq 0$};\\
         x & \mbox{$x \geq 0$};\\
        -x & \mbox{$x < 0$}.\end{array} \right. \]
so something like

Code: Select all

\[ F^+(U) = \left\{ \begin{array}{ll}
     \begin{equation}U = \left( \begin{array}{c}
     \rho\\
     \rho u\\
     \rho v\end{array} \right),\end{equation}        
     & \mbox{$x \geq 0$};\\
         x & \mbox{$x \geq 0$};\\
        -x & \mbox{$x < 0$}.\end{array} \right. \]
however this won't compile. Any help

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Stefan Kottwitz
Site Admin
Posts: 10340
Joined: Mon Mar 10, 2008 9:44 pm

Matrix within a matrix

Post by Stefan Kottwitz »

Hi,

it would work without the equation environment:

Code: Select all

\[ F^+(U) = \left\{ \begin{array}{ll}
     U = \left( \begin{array}{c}
     \rho\\
     \rho u\\
     \rho v\end{array} \right),
     & \mbox{$x \geq 0$};\\
         x & \mbox{$x \geq 0$};\\
        -x & \mbox{$x < 0$}.\end{array} \right. \]
Stefan
LaTeX.org admin
php1ic
Posts: 192
Joined: Wed Jan 28, 2009 8:17 pm

Matrix within a matrix

Post by php1ic »

As another option, try using the 'cases' environment together with the 'pmatrix' environment provided by the amsmath package.

Code: Select all

\documentclass{article}

\usepackage{amsmath}

\begin{document}

\[
F^+(U) =
  \begin{cases}
\begin{pmatrix}
\rho\\
\rho u\\
\rho v
\end{pmatrix} & \mbox{$x \geq 0$};\\[5ex]
\begin{pmatrix}
\rho\\
\rho u\\
\rho v
\end{pmatrix} & \mbox{$x \geq 0$};\\[5ex]
-\begin{pmatrix}
\rho\\
\rho u\\
\rho v
\end{pmatrix} & \mbox{$x < 0$}
  \end{cases}
\]

\end{document}
davefulton
Posts: 8
Joined: Wed May 05, 2010 8:36 pm

Re: Matrix within a matrix

Post by davefulton »

Thank you, thank you, thank you x
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Matrix within a matrix

Post by localghost »

Now that the problem is solved, please mark the topic accordingly as described in Section 3 of the Board Rules. This applies to all your other requests.


Best regards
Thorsten
Post Reply