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.
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
- 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: 10335
- 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