我正在尝试将一个包含一些 tikz 代码的图形放在一个两列文档中。该图形包含一个包含 tikz 命令的表格。但我希望该图形出现在页面上的一列中。最低工作代码如下:
\documentclass[a4paper,twocolumn]{article}
\usepackage{tikz}
\usetikzlibrary{arrows.meta, chains, positioning}
\usepackage{geometry}
\usepackage{graphicx}
\usepackage{lipsum}
\def\myScale{0.15}
%%%%%%%%%%%%%%%%%%
\begin{document}
\lipsum[1]
\tikzset{thisbox/.append style={rectangle, minimum height=5pt, minimum width=5pt, draw=gray, ultra thin, inner sep=0pt},}
\begin{figure}[htb]
\resizebox{\hsize}{!}
\centering
\begin{tabular}{cccc}
Spirit
&
&
&
Adaptive
\\
\fbox{
\resizebox{2.2cm}{!}{
\begin{tikzpicture}[scale=\myScale]
\node[thick, fill=blue] (notetop1) at (6,18) {Strided Head};
\draw[<->,red, line width=0.2mm] (-0.5,-1) -- (15.5,-1) node[midway, below] (box3) {\Large $n_l$};
\draw[<->,blue, line width=0.2mm] (4.5,7) -- (11.5,7) node[midway, above] (box4) {\Large $2w+1$};
\end{tikzpicture}
}
\resizebox{2.2cm}{!}{
\begin{tikzpicture}[scale=\myScale]
\draw[<->,red, line width=0.2mm] (-0.5,-1) -- (15.5,-1) node[midway, below] (box3) {\Large $n_l$};
\draw[<->,blue, line width=0.2mm] (3.5,7) -- (7.5,7) node[midway, above] (box4) {\Large $w$};
\end{tikzpicture}
}
}
&
\resizebox{2.2cm}{!}{
\begin{tikzpicture}[scale=\myScale]
\draw[<->,red, line width=0.2mm] (-0.5,-1) -- (15.5,-1) node[midway, below] (box3) {$n_p$};
\draw[<->,red, line width=0.1mm] (-0.5,-1.5) -- (1.5,-1.5) node[midway, below] (box3) {$mona$};
\draw[<->,blue, line width=0.2mm] (5.5,7) -- (10.5,7) node[midway, above] (box4) {\Large $2w+1$};
\end{tikzpicture}
}
&
\resizebox{2.2cm}{!}{
\begin{tikzpicture}[scale=\myScale]
\draw[<->,blue, line width=0.2mm] (6.5,7) -- (9.5,7) node[midway, above] (box4) {$\int 2x+1 dx$};
\end{tikzpicture}
}
&
\fbox{
\resizebox{2.2cm}{!}{
\begin{tikzpicture}[scale=\myScale]
\draw[<->,red, line width=0.2mm] (-0.5,-1) -- (15.5,-1) node[midway, below] (box3) {\Large $n_l$};
\end{tikzpicture}
}
\resizebox{2.2cm}{!}{
\begin{tikzpicture}[scale=\myScale]
\draw[<->,red, line width=0.2mm] (-0.5,-1) -- (15.5,-1) node[midway, below] (box3) {\Large $n_l$};
\end{tikzpicture}
}
}\\
\scriptsize{$m=36$}
&
\scriptsize{$n=404$}
&
\scriptsize{$p=40$}
&
\scriptsize{$q=812$}
\\
\scriptsize{$r=8/16/32$}
&
\scriptsize{$r=256/512$}
&
\scriptsize{$r=512/1024$}
&
\\
&
\scriptsize{right way}
&
\scriptsize{$g=128/256$}
&
\\
&
signature
&
\scriptsize{$r=192$}
&\\
\end{tabular}
%%%%%%%%%%%%%%%%%%%%%%%subtext
\begin{tikzpicture}%[scale=\myScale]
\node[thisbox,fill=blue,label=right:Local] at (5,0){};
\node[thisbox,fill=yellow,label=right:Global] at (9,0){};
\end{tikzpicture}
%%%%%%%%%%%%%%%%%%%%%%%
\caption{my caption}\label{fig:myfigure}
\end{figure}
\lipsum[1-5]
\end{document}
显示如下: 我已经用 subfigure、minipage、adjustbox、mbox、fbox 等测试过它,但它不能正常工作。