我的表格中的箭头不直。如何才能使它们变直?
\documentclass{ieeeaccess}
\usepackage{tikz}
\usetikzlibrary{tikzmark}
\begin{document}
\begin{table*}[htb]
\setlength\extrarowheight{2pt}
\centering
\begin{tabular}{|ll|c:c|c|}\cline{1-5}
\multicolumn{2}{|c|}{\multirow{2}{*}{… }} &
\multicolumn{3}{c|}{ …}\\\cline{3-5}
& & \multicolumn{1}{c}{\textsc{..}} & & {\textsc{..}} \\ \cline{1-5}
& & …… & \\
\leftpointright & … & \tikzmark{aa} $ 1,2 $ \tikzmark{a} & $ 3,4 $ \tikzmark{b} & \tikzmark{cc} $ 5,6 $ \tikzmark{c} \\ & & & & \\\cline{1-5}
& & … & …. & \\
\leftpointright & … & \tikzmark{dd} $ 7,8,9,10$ \tikzmark{d} & $ 11,12 $ \tikzmark{e} & \tikzmark{ff} $ 0 $ \tikzmark{f} \\
& & & & \\ \cline{1-5}
\end{tabular}
\begin{tikzpicture}[overlay, remember picture, shorten >=0.5pt, shorten <=0.5pt, transform canvas={yshift=.8\baselineskip}]
\draw [->] ([yshift=.1pt]{pic cs:b}) -- ({pic cs:cc});
\draw [->] ([yshift=.1pt]{pic cs:e}) -- ({pic cs:ff});
\end{tikzpicture}
\begin{tikzpicture}[overlay, remember picture, shorten >=0.5pt, shorten <=5.5pt, transform canvas={yshift=.8\baselineskip}]
\draw [->] ([yshift=.95pt]{pic cs:aa}) -- ({pic cs:dd});
\draw [->] ([yshift=.95pt]{pic cs:c}) -- ({pic cs:f});
\end{tikzpicture}
\begin{tikzpicture}[overlay, remember picture, shorten >=0.5pt, shorten <=0.5pt, transform canvas={yshift=-.5\baselineskip}]
\draw [->] ([yshift=.1pt]{pic cs:a}) -- ({pic cs:cc});
\draw [->] ([yshift=.1pt]{pic cs:d}) -- ({pic cs:ff});
\end{tikzpicture}
\end{table*}
\end{document}
答案1
作为起点:
\documentclass[border=5mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{tikzmark}
\usepackage{tabularray}
\begin{document}
\tikzset{is/.style = {inner sep=2pt}}
\begin{tblr}{hlines,
vline{1,2, 4,5}=solid, vline{3}=dashed,
colspec = {l*{3}{Q[c,m]}},
row{1,2}= {rowsep=1pt},
row{3,4}= {rowsep=5pt},
}
\SetCell[r=2]{c}
& \SetCell[c=3]{c} \dots
& & \\
? & \textsc{..}
& & \textsc{..} \\
? & \tikzmarknode[is]{a}{$1,2$}
& \tikzmarknode[is]{b}{$3,4$}
& \tikzmarknode[is]{c}{$5,6$} \\
? & \tikzmarknode[is]{d}{$7,8,9,10$}
& \tikzmarknode[is]{e}{$11,12$}
& \tikzmarknode[is]{f}{$0\vphantom{,}$} \\
\end{tblr}
\begin{tikzpicture}[overlay, remember picture,
shorten >=0.5pt, shorten <=0.5pt]
]
\draw [->] (d.west |- a) -- (d.west);
\draw [->] (b.east) -- (c.west);
\draw [->] (a.south east) -- (c.south west);
\draw [->] (c.east) -- (f -| c.east);
\draw [->] (e.east) -- (f.west);
\draw [->] (d.south east) -- (f.south west);
\end{tikzpicture}
\end{document}