Hi,
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.
Math & Science ⇒ Inline aligned matrices
Inline aligned matrices
Last edited by gjm on Wed Sep 15, 2010 4:19 pm, edited 1 time in total.
NEW: TikZ book now 40% off at Amazon.com for a short time.

Inline aligned matrices
Hi,
there was an extra \hfil command in the rsmallmatrix environment that I posted in the thread you linked to; here's the corrected version:
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}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Inline aligned matrices
A slightly different approach to that from the gmedina in the mentioned topic.
Best regards and welcome to the board
Thorsten
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
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
Re: Inline aligned matrices
Perfect (I prefer the first approach
) and thank you again.
GJM.

GJM.
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Re: Inline aligned matrices
Now that the problem is obviously solved, please be so kind and mark the topic accordingly as you have already been directed in my last reply.
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