![nicematrix: 最後の列に ttfamily を追加します](https://rvso.com/image/461900/nicematrix%3A%20%E6%9C%80%E5%BE%8C%E3%81%AE%E5%88%97%E3%81%AB%20ttfamily%20%E3%82%92%E8%BF%BD%E5%8A%A0%E3%81%97%E3%81%BE%E3%81%99.png)
nicematrix
最後の注釈列を自分用に\footnotsize
入力するにはどうすればいいでしょうか?\ttfamily
注: ここでは通常、記号+, -, ·
とローマ数字 ( I, II, III,...
) を使用します。
したがって、ここで数式モードを維持する必要はありません。
したがって、考えられる結果は次のようになります。
私のMWE:
\documentclass{article}
\usepackage{amsmath}
\usepackage{nicematrix}
\usepackage{tikz}
\begin{document}
$\begin{bNiceArray}{c c c | c}[
last-col,
%code-for-last-col = ???,
]
1 & -2 & 3 & 5 & \\
0 & 3 & 2 & 2 & II + 2\mathord{\cdot} I - III \\
0 & 1 & 1 & 3 &
\end{bNiceArray}$
\end{document}
ところで、ここでは括弧 '[ ]' の代わりに括弧を\lgroup
使いたいのですが、マニュアルでそのことは知っていますが、初めての試みなので、他のものとはうまく合いません。ここでグループ括弧を使用する簡単な方法はありますか?\rgroup
NiceArrayWithDelims
答え1
アップデート
の最新バージョン(v. 6.16) では、 などの環境のプリアンブルに、区切り文字と(および を介して)nicematrix
を直接配置できるようになりました。\lgroup
\rgroup
\left\lbroup
\right\rgroup
{NiceArray}
新しいバージョンでは、次のように記述できます。
\documentclass{article}
\usepackage{nicematrix}
\usepackage{amsmath}
\begin{document}
\newcolumntype{L}{>{$\ttfamily\footnotesize}l<{$}}
$\begin{NiceArray}{\left\lgroup ccc|c\right\rgroup L}
1 & -2 & 3 & 5 & \\
0 & 3 & 2 & 2 & II + 2I - III \\
0 & 1 & 1 & 3 & \\
0 & 1 & 1 & 5 &
\end{NiceArray}$
\end{document}
nicematrix
申し訳ありませんが、現在のバージョン(6.15)ではそれができません。
必要に応じて、回避策があります。キーは使用せずlast-col
、配列のプリアンブルに列を明示的に追加し、プリアンブル内に括弧を配置します。
\documentclass{article}
\usepackage{nicematrix}
\usepackage{amsmath}
\begin{document}
\newcolumntype{L}{>{$\ttfamily\footnotesize}l<{$}}
$\begin{NiceArray}{(ccc|c)L}
1 & -2 & 3 & 5 & \\
0 & 3 & 2 & 2 & II + 2I - III \\
0 & 1 & 1 & 3 & \\
0 & 1 & 1 & 5 &
\end{NiceArray}$
\end{document}
プリアンブルに区切り文字とを入れることはできませんが\lgroup
、ここでは、以前に再定義されたと\rgroup
を入れるというトリックがあります...\{
\}
\documentclass{article}
\usepackage{nicematrix}
\usepackage{amsmath}
\begin{document}
\newcolumntype{L}{>{$\ttfamily\footnotesize}l<{$}}
\NewDocumentEnvironment{MyNiceArray}{}
{%
\let \{ \lgroup
\let \} \rgroup
\begin{NiceArray}%
}
{\end{NiceArray}}
$\begin{MyNiceArray}{\{ccc|c\}L}
1 & -2 & 3 & 5 & \\
0 & 3 & 2 & 2 & II + 2I - III \\
0 & 1 & 1 & 3 & \\
0 & 1 & 1 & 5 &
\end{MyNiceArray}$
\end{document}
答え2
おそらく次のようなものが解決策になるでしょうが、ノードの内容はデフォルトで数式モードになっているため\ttfamily
使用できないため、注釈を\texttt
マクロに配置する必要があります。
\documentclass{article}
\usepackage{nicematrix}
\usepackage{tikz}
\begin{document}
$\begin{NiceArrayWithDelims}{\lgroup}{\rgroup}{ c c c | c }[
last-col,
code-for-last-col={\footnotesize}
]
1 & -2 & 3 & 5 & \\
0 & 3 & 2 & 2 & \texttt{II + 2\cdot I - III} \\
0 & 1 & 1 & 3 &
\end{NiceArrayWithDelims}$
\end{document}
私の知る限り、 ではnicematrix
最後の列の内容を何らかのマクロで囲む方法は提供されておらず、 を使用してマクロを先頭に追加することしかできませんが、ここではあまり役に立ちません。また、環境が完全に数式モードである必要があるcode-for-last-col
ため、逆に、関連する列のみを数式モードでタイプセットすることもできません。NiceArrayWithDelims
\SubMatrix
区切り文字をもう少し大きくしたい場合は、オプションを提供するネストされたを使用できますextra-height
(この解決策はパッケージの作者によって提案されています)。たとえば、ここ):
\documentclass{article}
\usepackage{nicematrix}
\usepackage{tikz}
\NewDocumentEnvironment{ MybNiceArray } { } {
\NiceMatrixOptions{exterior-arraycolsep}
\begin{NiceArray}
} {
\CodeAfter
\SubMatrix\lgroup{1-1}{last-last}\rgroup[extra-height=1ex]
\end{NiceArray}
}
\begin{document}
$\begin{MybNiceArray}{ c c c | c }[
last-col,
code-for-last-col={\footnotesize}
]
1 & -2 & 3 & 5 & \\
0 & 3 & 2 & 2 & \texttt{II + 2\cdot I - III} \\
0 & 1 & 1 & 3 &
\end{MybNiceArray}$
\end{document}