我怎样才能将 tikzpicture 放入单侧列中?
在这篇双栏论文中
我使用的 MWE 如下:
\documentclass[a4paper,10pt,oneside]{article}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
chains,
positioning}
\begin{document}
\begin{tikzpicture}[
node distance = -1mm and -1mm,
start chain = A going below right,
arr/.style = {-{Triangle[length=4mm,width=6mm]},
line width=4mm, gray!75},
box/.style = {draw, rounded corners=3mm, semithick,
text width=28mm, minimum height=16mm,
inner xsep=3mm,
font=\sffamily, align=flush left, on chain=A},
]
% nodes in chaon
\node[box] {Sample Acquisition}; % A-1
\node[box] {Sample Checking};
\node[box] {Dimensionality Sample Check};
\node[box] {Sample\\ Synthesis\\ Techniques};
%
\draw[arr] (A-1) |- (A-2);
\draw[arr] (A-2) |- (A-3);
\draw[arr] (A-3) |- (A-4);
\end{tikzpicture}
\end{document}
答案1
在 MWE 中,您使用一列文档(默认选项),但用两列显示所需的结果...看看,如果以下围绕图像的工作能够达到您的预期:
\documentclass[a4paper,10pt,twocolumn]{article}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
chains,
positioning}
\usepackage{lipsum}
\begin{document}
\lipsum[1]
\begin{figure}[ht]
\centering
\begin{tikzpicture}[
node distance = 1mm and -5mm, % <---
start chain = A going below right,
arr/.style = {-{Triangle[length=4mm,width=6mm]},
line width=4mm, gray!75, shorten >=-5mm}, % <---
box/.style = {draw, rounded corners=2mm, semithick,
text width=19mm, minimum height=16mm, % <---
inner xsep=2mm,
font=\small\sffamily, align=flush left, on chain=A}, % <---
]
% nodes in chaon
\node[box] {Sample Acquisition}; % A-1
\node[box] {Sample Checking};
\node[box] {Dimensionality Sample Check};
\node[box] {Sample\\ Synthesis\\ Techniques};
%
\begin{scope}[transform canvas={xshift=-5mm}] % <---
\draw[arr] (A-1) |- (A-2);
\draw[arr] (A-2) |- (A-3);
\draw[arr] (A-3) |- (A-4);
\end{scope}
\end{tikzpicture}
\caption{Flowchart ...}
\label{fig:flowchart}
\end{figure}
\lipsum[2-6]
\end{document}
图像代码的改变以 标记% <---
。