行列の次元のラベル付け

行列の次元のラベル付け

以下は、Latex で設定しようとしているものの図です。Word では、サイズが kxk のマトリックスがあり、行と列にそのようにラベルを付けたいと考えています。マトリックスの作成は問題ありませんが、ラベルを含めることが問題です。

ここに画像の説明を入力してください

答え1

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\[
\underbrace{
\begin{bmatrix}
1/2 & 1/2 & 0 & 0 & \cdots & 0\\
0 & 1/2 & 1/2 & 0 & \cdots & 0\\
0 & 0 & 1/2 & 1/2 & \cdots & 0\\
\vdots & \vdots & \vdots & \ddots & \vdots & \vdots\\
1/2 & 0 & 0 & 0 & \cdots & 1/2\\
\end{bmatrix}}_{\displaystyle k}
\left.\vphantom{\begin{bmatrix}
1/2 & 1/2 & 0 & 0 & \cdots & 0\\
0 & 1/2 & 1/2 & 0 & \cdots & 0\\
0 & 0 & 1/2 & 1/2 & \cdots & 0\\
\vdots & \vdots & \vdots & \ddots & \vdots & \vdots\\
1/2 & 0 & 0 & 0 & \cdots & 1/2\\
\end{bmatrix}}\right\}k\]
\end{document}

ここに画像の説明を入力してください

答え2

簡単ではありませんが、うまくいきます!

\documentclass{article}
\usepackage{amsmath}

\usepackage{lipsum}

\begin{document}

\lipsum*[3]
\[
\left.
\begin{bmatrix}\,
\smash{
  \underbrace{
    \begin{matrix}
    1/2 & 1/2 &  0  &  0  & \dots &  0 \\
     0  & 1/2 & 1/2 &  0  & \dots &  0 \\
     0  &  0  & 1/2 & 1/2 & \dots &  0 \\
     \vdots & \vdots & \vdots & \vdots & \ddots & \vdots \\
    1/2 &  0  &  0  &  0  & \dots & 1/2
    \end{matrix}
  }_{k}
}
\vphantom{
  \begin{matrix}
  \smash[b]{\vphantom{\Big|}}
  0\\0\\0\\vdots\\0
  \smash[t]{\vphantom{\Big|}}
  \end{matrix}
}
\,\end{bmatrix}
\right\rbrace{\scriptstyle k}
\vphantom{\underbrace{\begin{matrix}0\\0\\0\\vdots\\0\end{matrix}}_{k}}
\]
\lipsum[4]

\end{document}

マトリックスの内側部分はアンダーブレースで補強され、潰されているため、アンダーブレースは考慮されません。垂直サイズを設定するために、\vphantom少し大きめのマトリックスを含むを使用します。次に、右のブレースを簡単に作成できます。最後に、別のファントムがアンダーブレースによって占められる垂直スペースを処理します。

ここに画像の説明を入力してください

答え3

TikZ マトリックスと中括弧の装飾を使用するとシンプルになります。

\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{matrix}
\usetikzlibrary{decorations.pathreplacing}

\usepackage{mwe}% for testing purpose only

\begin{document}

\blindtext% for testing purpose only

Like this:
\[
\begin{tikzpicture}[decoration={brace,amplitude=6pt}]
    \matrix[matrix of math nodes,
    nodes={text width=2em, align=center},
    left delimiter={[},right delimiter={]},
    ] (m) {
    1/2 & 1/2 &  0  &  0  & \dots &  0 \\
     0  & 1/2 & 1/2 &  0  & \dots &  0 \\
     0  &  0  & 1/2 & 1/2 & \dots &  0 \\
     \vdots & \vdots & \vdots & \vdots & \ddots & \vdots \\
    1/2 &  0  &  0  &  0  & \dots & 1/2\\
    };
    \draw[decorate] ([xshift=16pt]m-1-6.north east) -- ([xshift=16pt]m-5-6.south east) node[midway, anchor=west, xshift=6pt]{$k$};
    \draw[decorate] ([yshift=-10pt]m-5-6.south east) -- ([yshift=-10pt]m-5-1.south west)  node[midway, anchor=north, yshift=-6pt]{$k$};
\end{tikzpicture}
\]
or, similarly, like this:
\[
\begin{tikzpicture}[decoration={brace,amplitude=6pt}]
    \matrix[matrix of math nodes,
    nodes={text width=2em, align=center},
    left delimiter={[},right delimiter={]},
    ] (m) {
    1/2 & 1/2 &  0  &  0  & \dots &  0 \\
     0  & 1/2 & 1/2 &  0  & \dots &  0 \\
     0  &  0  & 1/2 & 1/2 & \dots &  0 \\
     \vdots & \vdots & \vdots & \vdots & \ddots & \vdots \\
    1/2 &  0  &  0  &  0  & \dots & 1/2\\
    };
    \draw[decorate] ([xshift=12pt]m.north east) -- ([xshift=12pt]m.south east) node[midway, anchor=west, xshift=6pt]{$k$};
    \draw[decorate] ([yshift=-8pt]m.south east) -- ([yshift=-8pt]m.south west)  node[midway, anchor=north, yshift=-6pt]{$k$};
\end{tikzpicture}
\]
\blindtext% for testing purpose only

\end{document}

ここに画像の説明を入力してください

関連情報