Массив как нижний индекс

Массив как нижний индекс

Хотя $\begin{matrix} 2 & 4 & 6 & 5 & 4 & 3 & 2 \\ && 3 \end{matrix}$выглядит отлично для самого высокого корня из $\mathsf E_8$, $s_{\begin{matrix} 2 & 4 & 6 & 5 & 4 & 3 & 2 \\ && 3 \end{matrix}}$выглядит ужасно. Я могу приблизиться к разумному результату, используя $s_{\begin{smallmatrix} 2 & 4 & 6 & 5 & 4 & 3 & 2 \\ && 3 \end{smallmatrix}}$, но, похоже, должен быть какой-то вариант среды типа array/ matrix, который автоматически изменяет размер в индексах и других соответствующих контекстах. Существует ли такая вещь, или мне нужно использовать какую-то комбинацию \mathchoice, matrixи smallmatrix?

В качестве дополнительного вопроса: какой параметр управляет пространством до и после окружения arrayили matrix?

решение1

Вы можете использовать вариант , smallmatrixкоторый использует \scriptscriptstyleвместо \scriptstyleдля записей. Также \vcenterследует изменить на \vtopтак, чтобы верхняя строка находилась на уровне обычных нижних индексов.

\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}

введите описание изображения здесь

Вместо трех патчей вы можете определить его, отредактировав определение smallmatrixиз 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}

введите описание изображения здесь

Если вы передумали насчет стиля текста, измените второе {\spicematrixaux{matrix}{#1}}на

{\null\!\spicematrixaux{smallmatrix}{#1}\!}

чтобы удалить тонкие промежутки слева и справа smallmatrix.

Связанный контент