General ⇒ Matrix
Matrix
Simple example:
$$\begin{matrix} x\\ abc \end{matrix}$$
now the above x is over the b but I like to have the x over the a and but there should not be a gap between abc so they should be in one cell.
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
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Matrix
Code: Select all
\[
\begin{array}{l} x \\ abc \end{array}
\]
Best regards
Thorsten¹
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
- Stefan Kottwitz
- Site Admin
- Posts: 10360
- Joined: Mon Mar 10, 2008 9:44 pm
Matrix
regarding matrices and mathematics in general I recommend to use the amsmath package, see for instance the amsmath user's guide 4.1 Matrices. It provides matrices with different delimiters like (), [], {} and || and with more economical horizontal spacing.
Though the column entries will be centered too here's a small modification for the internal macro \env@matrix. By copying this code to your preamble you will be able to use \matrix, \pmatrix, \bmatrix, \Bmatrix, \vmatrix and \Vmatrix with an optional parameter l,r or c (default) for the alignment:
Code: Select all
\usepackage{amsmath}
...
\makeatletter
\renewcommand*\env@matrix[1][c]{\hskip -\arraycolsep
\let\@ifnextchar\new@ifnextchar
\array{*\c@MaxMatrixCols #1}}
\makeatother
Stefan