Math & ScienceTypesetting a complex Matrix

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
whordijk
Posts: 2
Joined: Sat Oct 15, 2011 3:09 pm

Typesetting a complex Matrix

Post by whordijk »

Hello everyone,

I'm am looking to typeset a particular matrix, but I haven't got any good ideas on how to start with this. The matrix is the following:
matrix.png
matrix.png (150.64 KiB) Viewed 2935 times
Any help would be greatly appreciated, thanks in advance!
Last edited by whordijk on Tue Oct 18, 2011 10:07 pm, edited 2 times in total.

Recommended reading 2024:

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

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

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

Typesetting a complex Matrix

Post by localghost »

I would not do that with a common environment like array and additional packages because the final result would not be satisfactory. The pgf/tikZ offers some structures that let you do such a matrix.

Code: Select all

\documentclass[11pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage{tikz}
\usetikzlibrary{calc,fit,matrix}

\begin{document}
  \begin{equation}
    \begin{tikzpicture}[baseline={($(current bounding box.center)-(0,0.75ex)$)}]
      \matrix (example) [%
        matrix of math nodes,
        nodes in empty cells,
        left delimiter=(,
        right delimiter=),
        nodes={anchor=center,minimum size=2em}
      ] {%
        & |[draw]|I_{2^0} & & & & & & \\
        & & & & & & & \\
        & & & |[draw]|I_{2^0} & & & & \\
        & & & & & & & \\
        & & & & & |[draw]|I_{2^0} & & \\
        & & & & & & & \\
        & & & & & & & |[draw]|I_{2^0} \\
        & & & & & & & \\
      };
      \node[draw,inner sep=0pt,fit=(example-1-3) (example-2-4)] {$I_{2^1}$};
      \node[draw,inner sep=0pt,fit=(example-1-5) (example-4-8)] {$I_{2^2}$};  % produces warning about "Underfull hbox"
      \node[draw,inner sep=0pt,fit=(example-5-7) (example-6-8)] {$I_{2^1}$};
    \end{tikzpicture}
  \end{equation}
\end{document} 
The above example embeds the matrix into a math environment just to show that this is possible.


Best regards and welcome to the board
Thorsten
Attachments
The output as produced by the given example.
The output as produced by the given example.
tikZ-special-matrix.png (7.41 KiB) Viewed 2910 times
whordijk
Posts: 2
Joined: Sat Oct 15, 2011 3:09 pm

Re: Typesetting a complex Matrix

Post by whordijk »

Oh, wow: that's awesome! Thanks a lot localghost, much appreciated!
Post Reply