Math & ScienceHow to write a code for this ?

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
M.A
Posts: 58
Joined: Sun Nov 30, 2008 10:42 am

How to write a code for this ?

Post by M.A »

Hello

How to write a LaTeX code to generate the matrix shown in the following image?
matrix.png
matrix.png (2.16 KiB) Viewed 3269 times
Regards

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

How to write a code for this ?

Post by localghost »

My first idea was to do this without any additional package.

Code: Select all

\[
%  \renewcommand{\arraystretch}{1.2}
  \left[
  \begin{array}{ccc}
    A_{11} & \multicolumn{1}{c|}{A_{12}} & 0 \\ \cline{2-3}
    A_{21} & \multicolumn{1}{|c|}{A_{22}} & A_{23} \\ \cline{1-2}
    0 & \multicolumn{1}{|c}{A_{32}} & A_{33}
  \end{array}
  \right]
\]
But perhaps there is a more elegant solution.


Best regards
Thorsten
M.A
Posts: 58
Joined: Sun Nov 30, 2008 10:42 am

How to write a code for this ?

Post by M.A »

Thanks for the response,
but your code doesn't produce the required result, it produces this:
matrix2.png
matrix2.png (1.97 KiB) Viewed 3255 times
Nevertheless, using the same idea, a valid code is:

Code: Select all

\[
  \left[
  \begin{array}{ccc}
    A_{11} & \multicolumn{1}{c|}{A_{12}} & 0 \\ \cline{2-3}
    A_{21} & \multicolumn{1}{|c|}{A_{22}} & 0 \\ \cline{1-2}
    0 & \multicolumn{1}{|c}{A_{32}} & A_{33}
  \end{array}
  \right]
\]
Thanks !
but it doesn't look elegant as you said.
Last edited by M.A on Sat Sep 05, 2009 3:27 pm, edited 1 time in total.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

How to write a code for this ?

Post by localghost »

I corrected my code while you were answering. But you are right. Initially I forgot two vertical lines and did a copy & paste error. My sample code was only meant to be a basic structure you could build upon. Perhaps you will find more ideas in the "[url=http://ctan.org&pkg/voss-mathmode]Math mode[/url]" document.
M.A
Posts: 58
Joined: Sun Nov 30, 2008 10:42 am

Re: How to write a code for this ?

Post by M.A »

Thanks for the math mode document, it is a comprehensive reference.
Regards,
M.A
Post Reply