LaTeX forum ⇒ Math & ScienceMatrix within a matrix

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

Matrix within a matrix

Postby davefulton » Sun Jul 25, 2010 3:00 pm

Hello all,
I am trying to get this array
  1. \begin{equation}U = \left( \begin{array}{c}
  2. \rho\\
  3. \rho u\\
  4. \rho v\end{array} \right),\end{equation}

into the values marked x in this array
  1. \[ F^+(U) = \left\{ \begin{array}{ll}
  2. x & \mbox{$x \geq 0$};\\
  3. x & \mbox{$x \geq 0$};\\
  4. -x & \mbox{$x < 0$}.\end{array} \right. \]

so something like
  1. \[ F^+(U) = \left\{ \begin{array}{ll}
  2. \begin{equation}U = \left( \begin{array}{c}
  3. \rho\\
  4. \rho u\\
  5. \rho v\end{array} \right),\end{equation}
  6. & \mbox{$x \geq 0$};\\
  7. x & \mbox{$x \geq 0$};\\
  8. -x & \mbox{$x < 0$}.\end{array} \right. \]

however this won't compile. Any help

User avatar
Stefan Kottwitz
Site Admin
Posts: 9616
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Sun Jul 25, 2010 3:31 pm

Hi,

it would work without the equation environment:
  1. \[ F^+(U) = \left\{ \begin{array}{ll}
  2. U = \left( \begin{array}{c}
  3. \rho\\
  4. \rho u\\
  5. \rho v\end{array} \right),
  6. & \mbox{$x \geq 0$};\\
  7. x & \mbox{$x \geq 0$};\\
  8. -x & \mbox{$x < 0$}.\end{array} \right. \]

Stefan
LaTeX.org admin

php1ic
Posts: 192
Joined: Wed Jan 28, 2009 8:17 pm

Postby php1ic » Sun Jul 25, 2010 3:55 pm

As another option, try using the 'cases' environment together with the 'pmatrix' environment provided by the amsmath package.
  1. \documentclass{article}
  2.  
  3. \usepackage{amsmath}
  4.  
  5. \begin{document}
  6.  
  7. \[
  8. F^+(U) =
  9. \begin{cases}
  10. \begin{pmatrix}
  11. \rho\\
  12. \rho u\\
  13. \rho v
  14. \end{pmatrix} & \mbox{$x \geq 0$};\\[5ex]
  15. \begin{pmatrix}
  16. \rho\\
  17. \rho u\\
  18. \rho v
  19. \end{pmatrix} & \mbox{$x \geq 0$};\\[5ex]
  20. -\begin{pmatrix}
  21. \rho\\
  22. \rho u\\
  23. \rho v
  24. \end{pmatrix} & \mbox{$x < 0$}
  25. \end{cases}
  26. \]
  27.  
  28. \end{document}

davefulton
Posts: 8
Joined: Wed May 05, 2010 8:36 pm

Postby davefulton » Sun Jul 25, 2010 4:14 pm

Thank you, thank you, thank you x

User avatar
localghost
Site Moderator
Posts: 9204
Joined: Fri Feb 02, 2007 12:06 pm

Postby localghost » Sun Jul 25, 2010 7:41 pm

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
LaTeX Community Moderator
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes


¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1


Return to “Math & Science”

Who is online

Users browsing this forum: No registered users and 2 guests