我正在使用tikz
来制作一个附加行的矩阵的流程图。对于最后一个矩阵,我想在矩阵的右侧和顶部添加带有文本的花括号。下面是我的代码,它可以在右侧添加花括号和文本:
\documentclass[12pt]{article}
\usepackage{multirow,graphics,graphicx,supertabular}
\usepackage{mathtools}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{matrix,decorations.pathreplacing,calc,positioning}
\begin{document}
\begin{figure}[h]
\centering
\begin{tikzpicture}
\node (B) {
$\begin{bmatrix}
1 & 0 & \dots & 1 \\
2 & 0 & \dots & 1
\end{bmatrix}$};
\node[left=3.5cm of B] (A) {
$\begin{bmatrix}
1 & 0 & \dots & 1
\end{bmatrix}$};
\node[right=3.5cm of B] (C){
$\begin{rcases}\displaystyle
\begin{bmatrix}
1 & 0 & \dots & 1 \\
2 & 0 & \dots & 1 \\
3 & 1 & \dots & 4
\end{bmatrix}
\end{rcases}
\text{$N_{\mathrm{conf}}$}$};
\draw[->] (A)--(B) node[midway, above,font=\small] {
$+\begin{bmatrix}
1 & 0 & \dots & 3
\end{bmatrix}$};
\draw[->] (B)--(C) node[midway, above,font=\small] {
$+\begin{bmatrix}
1 & 0 & \dots & 3
\end{bmatrix}$};
\end{tikzpicture}
\caption{Flow diagram of the matrix.}
\label{bootstrap_flowchart}
\end{figure}
\end{document}
答案1
--添加代码
\draw[decorate, ultra thick] ($(C.north west)+(2ex,0pt)$) --
($(C.north east)-(9ex,0pt)$) node[above=3pt,midway] {some text};
应生产所需的支架
——在序言中添加书法
\usetikzlibrary{matrix,decorations.pathreplacing,calc,positioning,calligraphy}
\documentclass[12pt]{article}
\usepackage{multirow,graphics,graphicx,supertabular}
\usepackage{mathtools}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{matrix,decorations.pathreplacing,calc,positioning,calligraphy}
\begin{document}
\begin{figure}[h]
\centering
\begin{tikzpicture}[decoration={calligraphic brace,amplitude=6pt}]
\node (B) {
$\begin{bmatrix}
1 & 0 & \dots & 1 \\
2 & 0 & \dots & 1
\end{bmatrix}$};
\node[left=3.5cm of B] (A) {
$\begin{bmatrix}
1 & 0 & \dots & 1
\end{bmatrix}$};
\node[right=3.5cm of B] (C){
$\begin{rcases}\displaystyle
\begin{bmatrix}
1 & 0 & \dots & 1 \\
2 & 0 & \dots & 1 \\
3 & 1 & \dots & 4
\end{bmatrix}
\end{rcases}
\text{$N_{\mathrm{conf}}$}$};
\draw[->] (A)--(B) node[midway, above,font=\small] {
$+\begin{bmatrix}
1 & 0 & \dots & 3
\end{bmatrix}$};
\draw[->] (B)--(C) node[midway, above,font=\small] {
$+\begin{bmatrix}
1 & 0 & \dots & 3
\end{bmatrix}$};
\draw[decorate, ultra thick] ($(C.north west)+(2ex,0pt)$) -- ($(C.north east)-(9ex,0pt)$) node[above=3pt,midway] {some text};
\end{tikzpicture}
\caption{Flow diagram of the matrix.}
\label{bootstrap_flowchart}
\end{figure}
\end{document}
答案2
只需用以下命令包围矩阵\overbrace
即可:
\documentclass[12pt]{article}
\usepackage{amsmath}
\begin{document}
\begin{align*}
\begin{bmatrix}
1 & 0 & \dots & 1
\end{bmatrix}
\xrightarrow{+ \begin{bmatrix}
1 & 0 & \dots & 3
\end{bmatrix}}
\begin{bmatrix}
1 & 0 & \dots & 1 \\
2 & 0 & \dots & 1
\end{bmatrix}
\xrightarrow{+ \begin{bmatrix}
1 & 0 & \dots & 3
\end{bmatrix}}
\overbrace{\begin{bmatrix}
1 & 0 & \dots & 1 \\
2 & 0 & \dots & 1 \\
3 & 1 & \dots & 4
\end{bmatrix}}^{\text{Columns}}
\end{align*}
\end{document}
注意,不一定非要使用 Tikz,也可以使用命令\xrightarrow
生成箭头,并在其上方或下方书写任何内容。