Math & ScienceMatrix in LaTeX

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
izza
Posts: 3
Joined: Tue Mar 23, 2010 2:58 pm

Matrix in LaTeX

Post by izza »

hi there,

How do I get a matrix nicer than the one with the commands below?

\begin{center}
$Q_3$=\begin{pmatrix}-3&3&0&0\\1&-3&2&0\\0&2&-3&1\\0&0&0&0\end{pmatrix}
\end{center}

This will give me the correct matrix but the "-"signs make it look ugly for bigger matrices....
Does anyone know how to get the "-"signs a bit to the left so that the actual numbers form smooth columns?

Thanks alot!

Kind regards,
A.

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

Matrix in LaTeX

Post by localghost »

You seem to lack the fundamentals of typesetting math expressions. For such a matrix you have to switch to math mode. Here it's an unnumbered displayed equation environment.

Code: Select all

Code, edit and compile here:
\documentclass[11pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{mathtools} % loads »amsmath«
\begin{document}
\[
Q_3=
\begin{pmatrix*}[r]
-3 & 3 & 0 & 0 \\
1 & -3 & 2 & 0 \\
0 & 2 & -3 & 1 \\
0 & 0 & 0 & 0
\end{pmatrix*}
\]
\end{document}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
The mathtools manual tells you more. General information about math typesetting is available with the »Math mode« document.


Best regards
Thorsten
Post Reply