Math & ScienceMatrix Equation with Vertical Line

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
CDuke
Posts: 3
Joined: Sun Jul 24, 2011 1:46 pm

Matrix Equation with Vertical Line

Post by CDuke »

hello,
at the moment i am trying to recreate this equation in latex.
matrix-equation.png
matrix-equation.png (13.81 KiB) Viewed 18579 times
i am having a bit of a trouble creating the vertical lines. With an array i can create the vertical lines but it seems that latex doesn't accept multiple arrays in equations. Is there a way to create vertical lines in a pmatrix? OR another way to recreate this equation?

Code: Select all

\begin{equation}
\label{3.54}
\left[
\begin{array}{ccc|cc}
s & 0 & 0 & {RT \over AL} & -{RT \over AL}\\
  -p_{12}^* & p_1^* & 0 & {\alpha^* L \Phi ^* \over 2 A^2} & 0 \\
  p_{12}^* &0& -p_2^* & 0 &{\alpha^* L \Phi ^* \over 2 A^2} \\ \hline
  0& -1&0&0&0\\
  0&0&-1&0&0
\end{array}
\right]
\left[
\begin{array}{c}
\Delta p_{12} (s)\\
\Delta p_{1} (s)\\
\Delta p_{2} (s)\\ \hline
-\Delta \phi_1 (s)\\
-\Delta \phi_2 (s)
\end{array}
\right]
= 
\left[
\begin{array}
\\
0\\
\\ \hline
\Ddelta p_{1}(s)\\
\Delta p_{2}(s)
\end{array}
\right]

\end{equation}

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: 10345
Joined: Mon Mar 10, 2008 9:44 pm

Matrix Equation with Vertical Line

Post by Stefan Kottwitz »

Hi,

the array error is caused by missing column specifiers for the last array, the {c} was missing in

Code: Select all

\begin{array}{c}
Here's a compilable example:

Code: Select all

\documentclass{article}
\begin{document}
\begin{equation}
\label{3.54}
\left[
\begin{array}{ccc|cc}
s & 0 & 0 & {RT \over AL} & -{RT \over AL}\\
  -p_{12}^* & p_1^* & 0 & {\alpha^* L \Phi ^* \over 2 A^2} & 0 \\
  p_{12}^* &0& -p_2^* & 0 &{\alpha^* L \Phi ^* \over 2 A^2} \\ \hline
  0& -1&0&0&0\\
  0&0&-1&0&0
\end{array}
\right]
\left[
\begin{array}{c}
\Delta p_{12} (s)\\
\Delta p_{1} (s)\\
\Delta p_{2} (s)\\ \hline
-\Delta \phi_1 (s)\\
-\Delta \phi_2 (s)
\end{array}
\right]
=
\left[
\begin{array}{c}
\\
0\\
\\ \hline
\Delta p_{1}(s)\\
\Delta p_{2}(s)
\end{array}
\right]
\end{equation}
\end{document}
You could use for example \arraystretch to get some more spacing:

Code: Select all

\renewcommand*{\arraystretch}{1.4}
CDuke wrote:Is there a way to create vertical lines in a pmatrix? OR another way to recreate this equation?
With pmatrix, bmatrix etc. vertical lines (and more) would be possible too, with a redefinition of an internal amsmath matrix macro. Perhaps post a comment there to learn more or for an example.

Stefan
LaTeX.org admin
CDuke
Posts: 3
Joined: Sun Jul 24, 2011 1:46 pm

Re: Matrix Equation with Vertical Line

Post by CDuke »

thanks for the reply. The code works now, also thanks for the arraystretch. That really gives a better result.
I think i'll learn a bit more about LaTEX before i am going to adapt the internal amsmath matrix macro. Perhaps a good practice if doing more reports with this kind of things.
Post Reply