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.
Math & Science ⇒ Matrix in LaTeX
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
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.
The mathtools manual tells you more. General information about math typesetting is available with the »Math mode« document.
Best regards
Thorsten
Code: Select all
\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}
Best regards
Thorsten
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10