Math & ScienceHelp with aligning

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
xerion
Posts: 7
Joined: Wed Oct 20, 2010 8:29 am

Help with aligning

Post by xerion »

Seems like I need the precious help of the community again !
I did my best to bring it close to a form that i would like but there are probably better ways to do it. I am open to any suggestions !

So I have this matrix that is shown in the code below which is fine if i can get the vertical line of the last submatrix to align with the bracket. Trying to do so gives me a lot of trouble with \right. stuff which i can not sort out.

Any ideas ?

Code: Select all

Code, edit and compile here:
\documentclass{article}
\usepackage{amssymb}
\usepackage{amsmath}
\makeatletter
\renewcommand*\env@matrix[1][*\c@MaxMatrixCols c]{%
\hskip -\arraycolsep
\let\@ifnextchar\new@ifnextchar
\array{#1}}
\makeatother
\begin{document}
\setcounter{MaxMatrixCols}{12}
\begin{equation*}
\begin{split}
A =&
\begin{bmatrix}[c|c|c]
A_1 & A_2 & A_3
\end{bmatrix}
\\ =& \left[
\begin{matrix}[cccc|]
\frac{\partial f_x}{\partial a} & \frac{\partial f_x}{\partial b} & \frac{\partial f_x}{\partial c} & \frac{\partial f_x}{\partial d} \\
\frac{\partial f_y}{\partial a} & \frac{\partial f_y}{\partial b} & \frac{\partial f_y}{\partial c} & \frac{\partial f_y}{\partial d}
\end{matrix} \right. \quad \cdots
\\ & \left.
\begin{matrix}[|cccccccc|ccc]
-A & -B & -C & -D & 0 & 0 & 0 & 0 & -A_1 & -A_2 & -A_3 \\
0 & 0 & 0 & 0 & -A & -B & -C & -D & -A_1 & -A_2 & -A_3
\end{matrix} \right]
\end{split}
\end{equation*}
\end{document}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Recommended reading 2024:

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

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

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Help with aligning

Post by localghost »

An invisible equal sign with some negative space should do the trick.

Code: Select all

Code, edit and compile here:
\documentclass{article}
\usepackage{amssymb}
\usepackage{amsmath}
\makeatletter
\renewcommand*\env@matrix[1][*\c@MaxMatrixCols c]{%
\hskip -\arraycolsep
\let\@ifnextchar\new@ifnextchar
\array{#1}}
\makeatother
\begin{document}
\setcounter{MaxMatrixCols}{12}
\begin{equation*}
\begin{split}
A =&
\begin{bmatrix}[c|c|c]
A_1 & A_2 & A_3
\end{bmatrix}
\\ =& \left[
\begin{matrix}[cccc|]
\frac{\partial f_x}{\partial a} & \frac{\partial f_x}{\partial b} & \frac{\partial f_x}{\partial c} & \frac{\partial f_x}{\partial d} \\
\frac{\partial f_y}{\partial a} & \frac{\partial f_y}{\partial b} & \frac{\partial f_y}{\partial c} & \frac{\partial f_y}{\partial d}
\end{matrix} \right. \quad \cdots
\\ & \phantom{=}\!\left.
\begin{matrix}[|cccccccc|ccc]
-A & -B & -C & -D & 0 & 0 & 0 & 0 & -A_1 & -A_2 & -A_3 \\
0 & 0 & 0 & 0 & -A & -B & -C & -D & -A_1 & -A_2 & -A_3
\end{matrix} \right]
\end{split}
\end{equation*}
\end{document}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Thorsten
xerion
Posts: 7
Joined: Wed Oct 20, 2010 8:29 am

Re: Help with aligning

Post by xerion »

Thank you for your help, much appreciated !
Sorry for replying this late but was quite busy ! Seems that I am not able to actually mark the topic as solved.
Post Reply