每 3 行的数组标签

每 3 行的数组标签

我想要像图片一样标记数组的每三行。

在此处输入图片描述

有人可以帮忙吗?

答案1

[以超级英雄的口吻朗读!]

这看起来像是一个蒂克兹 matrix of nodes(手册第 57.1 节tikz):

在此处输入图片描述

代码如下:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{matrix,decorations.pathreplacing}
\begin{document}

\[ \mathbf{d}_e =
\begin{tikzpicture}[baseline=(current bounding box.center)]
      \matrix (M)[matrix of math nodes, nodes in empty cells, column sep=10mm ]{
        u_1 &\\ v_1 &\\w_1&\\
        u_2 &\\ v_2 &\\w_2&\\
        u_3 &\\ v_3 &\\w_3&\\
        u_4 &\\ v_4 &\\w_4&\\
       };
       \draw[decorate, decoration={brace, mirror}](M-1-1.north west)--(M-12-1.south west);
       \draw[decorate, decoration={brace}](M-1-1.north east)--(M-12-1.south east)node[right]{\tiny{$12\times1$}};
       \draw[decorate, decoration={brace}](M-1-2.north east)--node[right=2mm]{displacements at node 1}(M-3-2.south east);
       \draw[decorate, decoration={brace}](M-4-2.north east)--node[right=2mm]{displacements at node 2}(M-6-2.south east);
       \draw[decorate, decoration={brace}](M-7-2.north east)--node[right=2mm]{displacements at node 3}(M-9-2.south east);
       \draw[decorate, decoration={brace}](M-10-2.north east)--node[right=2mm]{displacements at node 4}(M-12-2.south east);
    \end{tikzpicture}
\]

\end{document}

“最漂亮”的部分是使用装饰来绘制括号。我给矩阵的每一行都设置了两列,以便更容易定位“位移”标签。

答案2

为您提供的一个起点,而不是答案,而是一种可用于排版的可能方式答案。

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning,decorations.pathreplacing}
%https://tex.stackexchange.com/questions/112175/brace-diagram-in-tikz
\begin{document}

\begin{tikzpicture}
\node (main) {$d_e=$};
\begin{scope}[node distance=1em]
    \node [right=0.2em of main] (tm) {$w_2$};
    \node [above=0.2em of tm]   (tu5) {$v_2$};
    \node [above=0.2em of tu5]   (tu4) {$u_2$};
    \node [above=0.2em of tu4]   (tu3) {$w_1$};
    \node [above=0.2em of tu3]   (tu2) {$v_1$};
    \node [above=0.2em of tu2]   (tu1) {$u_1$};
    \node [below=0.2em of tm]   (tb1) {$u_3$};
    \node [below=0.2em of tb1]   (tb2) {$v_3$};
    \node [below=0.2em of tb2]   (tb3) {$w_3$};
    \node [below=0.2em of tb3]   (tb4) {$u_4$};
    \node [below=0.2em of tb4]   (tb5) {$v_4$};
    \node [below=0.2em of tb5]   (tb6) {$w_4$};
\end{scope}
 \draw[decorate,decoration={brace,mirror}] (tu1.north west) -- (tb6.south west);
\draw[decorate,decoration={brace}] (tu1.north east) -- (tb6.south east);
\node [right= of tb6, align=left,xshift=-6.5ex,yshift=-1.5ex,font=\scriptsize] { $12\times1$};
% drawing the small nodes
\begin{scope}[node distance=1cm]
\node [right =of tu2,yshift= 1.5em] (st11) {};
\node [right =of tu2,yshift=0em] (st12) {displacements at node 1};
\node [right =of tu2,yshift=-1.5em] (st13) {};
\end{scope}
\draw[decorate,decoration={brace}] (st11.north west) -- (st13.south west);
\begin{scope}[node distance=1cm]
\node [right =of tu5,yshift= 1.5em] (st21) {};
\node [right =of tu5,yshift=0em] (st22) {displacements at node 2};
\node [right =of tu5,yshift=-1.5em] (st23) {};
\end{scope}
\draw[decorate,decoration={brace}] (st21.north west) -- (st23.south west);
\begin{scope}[node distance=1cm]
\node [right =of tb2,yshift= 1.5em] (st31) {};
\node [right =of tb2,yshift=0em] (st32) {displacements at node 3};
\node [right =of tb2,yshift=-1.5em] (st33) {};
\end{scope}
\draw[decorate,decoration={brace}] (st31.north west) -- (st33.south west);
\begin{scope}[node distance=1cm]
\node [right =of tb5,yshift= 1.5em] (st41) {};
\node [right =of tb5,yshift=0em] (st42) {displacements at node 4};
\node [right =of tb5,yshift=-1.5em] (st43) {};
\end{scope}
\draw[decorate,decoration={brace}] (st41.north west) -- (st43.south west);
\end{tikzpicture}

\end{document}

您可以获得:

在此处输入图片描述

相关内容