Math & Science ⇒ Inline aligned matrices
Inline aligned matrices
In http://www.latex-community.org/forum/vi ... 68&start=0, it is explained how to produce inline right-aligned vectors using the smallmatrix environment.
Could anyone give me the solution to inline right-aligned matrices?
Thank you very much,
GJM.
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
Inline aligned matrices
there was an extra \hfil command in the rsmallmatrix environment that I posted in the thread you linked to; here's the corrected version:
Code: Select all
\documentclass{article}
\usepackage{amsmath}
\makeatletter
% smallmatrix with right alignment
\newenvironment{rsmallmatrix}{\null\,\vcenter\bgroup
\Let@\restore@math@cr\default@tag
\baselineskip6\ex@ \lineskip1.5\ex@ \lineskiplimit\lineskip
\ialign\bgroup\hfil$\m@th\scriptstyle##$&&\thickspace\hfil
$\m@th\scriptstyle##$\crcr
}{%
\crcr\egroup\egroup\,%
}
\makeatother
\begin{document}
$\left(\begin{rsmallmatrix}
12 & -456 & -23 \\
1 & 6 & 1 \\
-12345 & 78 & 5 \\
\end{rsmallmatrix}\right)$
\end{document}
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Inline aligned matrices
Code: Select all
\documentclass[12pt,a4paper,english]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{graphicx}
\usepackage{mathtools} % Loads »amsmath«
\begin{document}
The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. \raisebox{0.5ex}{\scalebox{0.4}{\( \smash{\begin{pmatrix*}[r] -a_{11} & a_{12} & -a_{13} \\ a_{11} & -a_{12} & a_{13} \\ a_{11} & -a_{12} & -a_{13} \end{pmatrix*}} \)}} The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
\end{document}
Best regards and welcome to the board
Thorsten
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Re: Inline aligned matrices

GJM.
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Re: Inline aligned matrices
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10