
Während $\begin{matrix} 2 & 4 & 6 & 5 & 4 & 3 & 2 \\ && 3 \end{matrix}$
es für die höchste Wurzel von großartig aussieht $\mathsf E_8$
, $s_{\begin{matrix} 2 & 4 & 6 & 5 & 4 & 3 & 2 \\ && 3 \end{matrix}}$
sieht es schrecklich aus. Ich kann mit einem vernünftigen Ergebnis näher kommen $s_{\begin{smallmatrix} 2 & 4 & 6 & 5 & 4 & 3 & 2 \\ && 3 \end{smallmatrix}}$
, aber es scheint, als ob es eine Variante einer array
/ matrix
-artigen Umgebung geben muss, die die Größe in Indizes und anderen geeigneten Kontexten automatisch anpasst. Gibt es so etwas oder muss ich eine Kombination aus \mathchoice
, matrix
, und verwenden smallmatrix
?
Als zusätzliche Bonusfrage: Welcher Parameter steuert den Raum vor und nach einer array
„oder“ matrix
-Umgebung?
Antwort1
Sie können eine Variante von verwenden, smallmatrix
die \scriptscriptstyle
anstelle von \scriptstyle
für die Einträge verwendet. Außerdem \vcenter
sollte in geändert werden, \vtop
sodass die oberste Zeile auf der Ebene der normalen Indizes steht.
\documentclass{article}
\usepackage{amsmath}
\usepackage{etoolbox}
\let\tinymatrix\smallmatrix
\let\endtinymatrix\endsmallmatrix
\patchcmd{\tinymatrix}{\scriptstyle}{\scriptscriptstyle}{}{}
\patchcmd{\tinymatrix}{\scriptstyle}{\scriptscriptstyle}{}{}
\patchcmd{\tinymatrix}{\vcenter}{\vtop}{}{}
\patchcmd{\tinymatrix}{\bgroup}{\bgroup\scriptsize}{}{}
\begin{document}
$s_{\begin{tinymatrix}2 & 4 & 6 & 5 & 4 & 3 & 2 \\ && 3 \end{tinymatrix}}$
\end{document}
Anstelle der drei Patches können Sie es durch Bearbeiten der Definition von smallmatrix
„from“ definieren amsmath
:
\makeatletter
\newenvironment{tinymatrix}{\null\,\vtop\bgroup\scriptsize % smallmatrix has \vcenter\bgroup
\Let@\restore@math@cr\default@tag
\baselineskip6\ex@ \lineskip1.5\ex@ \lineskiplimit\lineskip
\ialign\bgroup\hfil$\m@th\scriptscriptstyle##$\hfil&&\thickspace\hfil % smallmatrix has \scriptstyle
$\m@th\scriptscriptstyle##$\hfil\crcr % smallmatrix has \scriptstyle
}{%
\crcr\egroup\egroup\,%
}
\makeatother
If you want to use a single command for all styles, then it's necessary to use `\mathchoice`:
\documentclass{article}
\usepackage{amsmath}
\makeatletter
\newenvironment{tinymatrix}{%
% removed also \, from left and right
\null\vtop\bgroup\scriptsize % smallmatrix has \vcenter\bgroup
\Let@\restore@math@cr\default@tag
\baselineskip6\ex@ \lineskip1.5\ex@ \lineskiplimit\lineskip
\ialign\bgroup
\hfil$\m@th\scriptscriptstyle##$\hfil&&\thickspace\hfil % smallmatrix has \scriptstyle
$\m@th\scriptscriptstyle##$\hfil\crcr % smallmatrix has \scriptstyle
}{%
\crcr\egroup\egroup
}
\makeatother
\newcommand{\spicematrix}[1]{\mathchoice
{\spicematrixaux{matrix}{#1}}
{\spicematrixaux{matrix}{#1}}
{\spicematrixaux{tinymatrix}{#1}}
{\spicematrixaux{tinymatrix}{#1}}
}
\newcommand{\spicematrixaux}[2]{\begin{#1}#2\end{#1}}
\begin{document}
\begin{gather*}
A \spicematrix{2 & 4 & 6 & 5 & 4 & 3 & 2 \\ && 3} B
\\
\textstyle A\spicematrix{2 & 4 & 6 & 5 & 4 & 3 & 2 \\ && 3} B
\\
s_{\spicematrix{2 & 4 & 6 & 5 & 4 & 3 & 2 \\ && 3}}
\end{gather*}
\end{document}
Wenn Sie den Textstil ändern möchten, ändern Sie den zweiten {\spicematrixaux{matrix}{#1}}
in
{\null\!\spicematrixaux{smallmatrix}{#1}\!}
um die dünnen Leerzeichen links und rechts von zu entfernen smallmatrix
.