![在 tikzpicture 中的 `\matrix (m) [table]` 大括號中加入上標](https://rvso.com/image/472796/%E5%9C%A8%20tikzpicture%20%E4%B8%AD%E7%9A%84%20%60%5Cmatrix%20(m)%20%5Btable%5D%60%20%E5%A4%A7%E6%8B%AC%E8%99%9F%E4%B8%AD%E5%8A%A0%E5%85%A5%E4%B8%8A%E6%A8%99.png)
我想將上標加入 中的現有大括號中\matrix (m) [table]
。這將表示轉置。我需要裝飾大括號以保持與另一個大括號的間距\matrix (m) [table]
。
我的矩陣和嘗試由下式給出
\documentclass{article}
%%% tikz
\usepackage{tikz}
\usetikzlibrary{calc}
\usetikzlibrary{arrows}
\usetikzlibrary{decorations.text,decorations.pathreplacing,matrix,calc,positioning}
\usetikzlibrary{calligraphy}% AFTER decorations.text
\tikzset{
table/.style={
matrix of math nodes,
row sep=-\pgflinewidth,
column sep=-\pgflinewidth,
nodes={rectangle,text width=3em,align=center},
text depth=1.25ex,
text height=2.5ex,
nodes in empty cells,
left delimiter=[,
right delimiter={]},
ampersand replacement=\&
}
}
\newcommand*{\connectorH}[4][]{
\draw[#1] (#3) -| ($(#3) !#2! (#4)$) |- (#4);% https://hugoideler.com/wp-content/uploads/2013/01/connector.tex
}
\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}[baseline,decoration=brace]
\matrix (m) [table] {
%1 %2 %3 %4 %5 %6 %7
A_{1,:}^\top\\
A_{2,:}^\top\\
};
\node at (m-1-1.north east) {$\qquad\quad{\top}$};
\end{tikzpicture}
\end{figure}
\end{document}
但轉置僅在矩陣的中間結束,而不是裝飾矩陣的右大括號。有沒有一個好的方法可以在仍在使用時做到這一點\matrix (m) [table]
?
答案1
您可以使用類似 的內容\node[anchor=west, xshift=0.67em] at (m-1-1.north east) {$\top$};
,但實際上您也可以替換正確的分隔符號(這也會以正確的字體大小呈現上標):
\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{matrix}
\tikzset{
table/.style={
matrix of math nodes,
row sep=-\pgflinewidth,
column sep=-\pgflinewidth,
nodes={
text width=3em,
align=center
},
text depth=1.25ex,
text height=2.5ex,
nodes in empty cells,
left delimiter={[},
right delimiter={]},
ampersand replacement=\&
}
}
\begin{document}
\begin{tikzpicture}
\matrix (m) [table, right delimiter={]^{\top}}] {
A_{1,:}^{\top} \\
A_{2,:}^{\top} \\
};
\end{tikzpicture}
\end{document}