Math & ScienceImproving a Matrix

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
Lucasqcgroup
Posts: 1
Joined: Fri Jan 04, 2013 4:32 pm

Improving a Matrix

Post by Lucasqcgroup »

Dear all,

I'm trying to type the following matrix:
matrixf.png
matrixf.png (3.24 KiB) Viewed 3460 times
But I could only get this:
mymatrix.png
mymatrix.png (10.32 KiB) Viewed 3460 times
I used the following code:

Code: Select all

\renewcommand{\arraystretch}{2}
\[
g :=\left(
\begin{array}{c|c}
\mathbf{2^D} & \textbf{1} \\ \hline
\textbf{1} & \begin{array}{cc}
\boldsymbol{1^\alpha} & \textbf{0} \\
\textbf{0} & \boldsymbol{1^\beta}
\end{array} \\ 
\end{array}
\right)
\]
There is too much space between the entries of the matrix and the vertical and horizontal lines.

How could I improve my matrix [typeset it correctly] ?

Any help would be greatly appreciated.

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

percusse
Posts: 3
Joined: Mon Nov 12, 2012 11:24 pm

Improving a Matrix

Post by percusse »

You might better avoid the nesting of arrays as much as you can in order to avoid such spacing and padding problems.

Here is something that comes to close to the given example. You can still modify the array stretch to 1.3 or higher, alternatively add some \mathstruts etc. I recommend reading Hendrik Vogt's nice answer on TeX.sx.

Code: Select all

\documentclass{article}
\usepackage{amsmath,array,multirow}

\begin{document}
    \[
    g :=\left(
    \begin{array}{c|cc}
    2^D                & \multicolumn{2}{c}{1} \\ \hline
    \multirow{2}{*}{1} & 1^\alpha              & 0 \\
                       & 0                     & 1^\beta
    \end{array}
    \right)
    \]   
\end{document}
Attachments
texse.png
texse.png (7.14 KiB) Viewed 3462 times
Post Reply