![tikzmark:如何在内容上添加“[”括号/方括号?](https://linux22.com/image/479130/tikzmark%EF%BC%9A%E5%A6%82%E4%BD%95%E5%9C%A8%E5%86%85%E5%AE%B9%E4%B8%8A%E6%B7%BB%E5%8A%A0%E2%80%9C%5B%E2%80%9D%E6%8B%AC%E5%8F%B7%2F%E6%96%B9%E6%8B%AC%E5%8F%B7%EF%BC%9F.png)
€dit-新文本:
我有一些内容(pgfplotstable 和一些文本),并且想添加一个左侧方括号,就像这是一个“bmatrix”。
最好的方法是什么?
我该怎么办?使用 tikzmark 或 tikzmarknode 还是……?
€dit - 新 MWE,但实施起来却不太好……
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{tikzmark}
\usepackage{pgfplotstable}
\begin{document}
\noindent\tikzmarknode[]{OL}{} \\
Hello World. \\
\pgfplotstabletypeset[]{
1 2 3
4 5 6
7 8 9
} \\[0.1em]
Goodbye World. \\[-3mm]
\tikzmarknode[]{UL}{}
\tikz[overlay,remember picture, red, transform canvas={xshift=-3pt}]{
\draw (OL.center) -- +(1ex,0);
\draw (UL.center) -- +(1ex,0);
\draw[line cap=rect, blue] (OL.center) -- (UL.center);
}
\end{document}
答案1
\documentclass{article}
\usepackage{tikz}
\usepackage{pgfplotstable}
\newsavebox\cistable
\begin{document}
\begin{lrbox}{\cistable}
\pgfplotstabletypeset[]{
1 2 3
4 5 6
7 8 9
}
\end{lrbox}%
\noindent\begin{tikzpicture}
\begin{scope}[local bounding box=OL]
\path node(tab){\usebox{\cistable}}
(tab.north) node[above] {Hello World.}
(tab.south) node[below] {Goodbye World.};
\end{scope}
\draw[red] ([xshift=-3pt,yshift=3pt]OL.north west) -- ++(1ex,0)
([xshift=-3pt,yshift=-3pt]OL.south west) -- ++(1ex,0)
([xshift=3pt,yshift=3pt]OL.north east) -- ++(-1ex,0)
([xshift=3pt,yshift=-3pt]OL.south east) -- ++(-1ex,0);
\draw[blue,line cap=rect]
([xshift=-3pt,yshift=3pt]OL.north west) -- ([xshift=-3pt,yshift=-3pt]OL.south west)
([xshift=3pt,yshift=3pt]OL.north east) -- ([xshift=3pt,yshift=-3pt]OL.south east);
\end{tikzpicture}
\end{document}