TiKz 图形由于尺寸过大而被截断

TiKz 图形由于尺寸过大而被截断

我有一张分为两列的纸,我在第二列上“绘图”,我尝试使用此处给出的代码在那里创建一个链接列表:https://tex.stackexchange.com/a/19288/233406但是,我的链接表太大并且被截断了,我该如何解决这个问题?

最小可重现示例:

\documentclass[conference]{IEEEtran}
\IEEEoverridecommandlockouts
\usepackage{cite}
\usepackage{amsmath,amssymb,amsfonts}
\usepackage{graphicx}
\usepackage{textcomp}
\usepackage{caption}
\usepackage{xcolor}
\usepackage{tabularx}
\usepackage{algorithm}
\usepackage[noend]{algpseudocode}
\usepackage [english]{babel}
\usepackage [autostyle, english = american]{csquotes}
\usepackage{tikz}
\usetikzlibrary{calc,shapes.multipart,chains,arrows}
\MakeOuterQuote{"}
\raggedbottom
\def\BibTeX{{\rm B\kern-.05em{\sc i\kern-.025em b}\kern-.08em
    T\kern-.1667em\lower.7ex\hbox{E}\kern-.125emX}}
\begin{document}

\title{test\\}


\maketitle

\begin{abstract}
dsfvdsfdsdsfdsfsd fsddsfvdsfdsdsfdsfsdfsddsfvdsfds dsfdsfsdfsddsfvdsfdsdsfdsfsdfsddsf vdsfdsdsfdsfsdfsddsfvdsf dsdsfdsfsdfsddsfvdsfdsdsfdsfsdfsddsfvdsfdsdsf dsfsdfsddsfvdsfdsdsfdsfsdfsddsf vdsfdsdsfdsfsdfsddsfvds fdsdsfdsfsdfsddsfvdsfdsdsfdsfsdfsd dsfvdsfdsdsfdsfsdfsddsfv dsfdsdsfdsfsdfsddsfvd sfdsdsfdsfsdfsddsfvdsfdsdsfdsfs dfsddsfvdsfdsdsf dsfsdf sddsfvdsfdsdsfdsfsdfs ddsfvdsf dsdsfdsfsdfsddsfvd sfdsdsfdsfsdfsdds fvdsfdsdsfdsfsdfsdddsfvdsfdsdsfdsfsdfsddsf vdsfdsdsfdsfsdf  sddsfvdsfdsdsfdsfsdfsddsfvds fdsdsfdsfsdfsddsfvd sfdsdsfdsfsdfsd dsfvds fdsdsfdsfsdfsddsfvdsfdsdsfdsfsdfs ddsfvdsfdsdsfdsfsdfsddsfvdsfdsdsfdsfsd fsddsfvdsfdsdsfdsfs dfsddsfvdsfds dsfdsfsdf sddsfvdsfdsdsfdsfsdfsdsfvdsfdsdsfds fsdfsddsfv dsfdsdsfdsfs dfsddsfvds fdsdsfdsf   sdfsddsfvdsfdsdsfdsfsdfsddsfvdsfdsdsfdsfsdfsd
\end{abstract}



\section{Introduction}
\begin{figure}[h]
\begin{tikzpicture}[list/.style={rectangle split, rectangle split parts=2,
    draw, rectangle split horizontal}, >=stealth, start chain]
  \node[list,on chain] (A) {$w(B,4,1)$};
  \node[list,on chain] (B) {$r_3(B,4)$};
  \node[list,on chain] (C) {$r_3(B,4)$};
  \node[list,on chain] (D) {$w_3(B,4,6)$};
  \node[list,on chain] (E) {$r_4.fog.2(B,6)$};
  \node[on chain,draw,inner sep=6pt] (F) {};
  \draw (F.north east) -- (F.south west);
  \draw (F.north west) -- (F.south east);
  \draw[*->] let \p1 = (A.two), \p2 = (A.center) in (\x1,\y2) -- (B);
  \draw[*->] let \p1 = (B.two), \p2 = (B.center) in (\x1,\y2) -- (C);
    \draw[*->] let \p1 = (C.two), \p2 = (C.center) in (\x1,\y2) -- (D);
      \draw[*->] let \p1 = (D.two), \p2 = (D.center) in (\x1,\y2) -- (E);
        \draw[*->] let \p1 = (E.two), \p2 = (E.center) in (\x1,\y2) -- (F);
\end{tikzpicture}
\caption{Linked list corresponding to the $Fog.1$}
\end{figure}
\end{document}

这里的列表在第一列,所以它只是传递到第二列,但在原始文档中,它在第二列,这只是使它剪切正在发生的事情的图片: 在此处输入图片描述

任何帮助都将不胜感激。只要清晰,我不介意在多行/多列上继续链接列表,我不一定想把它全部放在同一个空间里,因为这可能不合理。

答案1

您的图形太大,无法仅停留在一列上,如果缩放它,它将变得不可读。

figure*可以在两列上打印它。

\documentclass[twocolumn]{article}
\usepackage{mwe}% <--- for testing purpose only
\usepackage{tikz}
\usetikzlibrary{shapes, calc}
\usetikzlibrary{chains}
\usetikzlibrary{arrows.meta}
\begin{document}
\blindtext[3]% <--- for testing purpose only
\begin{figure*}\centering
\begin{tikzpicture}[list/.style={rectangle split, rectangle split parts=2,
    draw, rectangle split horizontal}, >=stealth, start chain]
  \node[list,on chain] (A) {$w(B,4,1)$};
  \node[list,on chain] (B) {$r_3(B,4)$};
  \node[list,on chain] (C) {$r_3(B,4)$};
  \node[list,on chain] (D) {$w_3(B,4,6)$};
  \node[list,on chain] (E) {$r_4.fog.2(B,6)$};
  \node[on chain,draw,inner sep=6pt] (F) {};
  \draw (F.north east) -- (F.south west);
  \draw (F.north west) -- (F.south east);
  \draw[Circle->] let \p1 = (A.two), \p2 = (A.center) in (\x1,\y2) -- (B);
  \draw[Circle->] let \p1 = (B.two), \p2 = (B.center) in (\x1,\y2) -- (C);
    \draw[Circle->] let \p1 = (C.two), \p2 = (C.center) in (\x1,\y2) -- (D);
      \draw[Circle->] let \p1 = (D.two), \p2 = (D.center) in (\x1,\y2) -- (E);
        \draw[Circle->] let \p1 = (E.two), \p2 = (E.center) in (\x1,\y2) -- (F);
\end{tikzpicture}
\caption{Linked list corresponding to the $Fog.1$}
\end{figure*}
\blindtext[7]% <--- for testing purpose only
\end{document}

在此处输入图片描述

如果你想扩大其规模:

\documentclass[twocolumn]{article}
\usepackage{mwe}% <--- for testing purpose only
\usepackage{tikz}
\usetikzlibrary{shapes, calc}
\usetikzlibrary{chains}
\usetikzlibrary{arrows.meta}
\begin{document}
\blindtext[3]% <--- for testing purpose only
\begin{figure}[h]\centering
\scalebox{.47}{\begin{tikzpicture}[list/.style={rectangle split, rectangle split parts=2,
    draw, rectangle split horizontal}, >=stealth, start chain]
  \node[list,on chain] (A) {$w(B,4,1)$};
  \node[list,on chain] (B) {$r_3(B,4)$};
  \node[list,on chain] (C) {$r_3(B,4)$};
  \node[list,on chain] (D) {$w_3(B,4,6)$};
  \node[list,on chain] (E) {$r_4.fog.2(B,6)$};
  \node[on chain,draw,inner sep=6pt] (F) {};
  \draw (F.north east) -- (F.south west);
  \draw (F.north west) -- (F.south east);
  \draw[Circle->] let \p1 = (A.two), \p2 = (A.center) in (\x1,\y2) -- (B);
  \draw[Circle->] let \p1 = (B.two), \p2 = (B.center) in (\x1,\y2) -- (C);
    \draw[Circle->] let \p1 = (C.two), \p2 = (C.center) in (\x1,\y2) -- (D);
      \draw[Circle->] let \p1 = (D.two), \p2 = (D.center) in (\x1,\y2) -- (E);
        \draw[Circle->] let \p1 = (E.two), \p2 = (E.center) in (\x1,\y2) -- (F);
\end{tikzpicture}}
\caption{Linked list corresponding to the $Fog.1$}
\end{figure}
\blindtext[7]% <--- for testing purpose only
\end{document}

在此处输入图片描述

答案2

大部分内容都离题了,但可能会有用......

您的图片太宽,无法放在一列中。因此,对于图片,您应该使用figure*浮动。如果您希望将图片放在同一页面的底部,请使用stfloats包。

如果这不令人满意,即该图像应该位于页面中间的某个位置,请使用cute包:

\documentclass[conference]{IEEEtran}
%---------------- Show page layout. Don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\usepackage{lipsum}

\usepackage{tikz}
\usetikzlibrary{arrows.meta,
                chains,
                positioning,
                shapes.multipart}
\usepackage{cuted}
\usepackage{capt-of}


\begin{document}
\lipsum[1]
%---------------------------------------------------------------%
\begin{strip}
    \centering
    
\begin{tikzpicture}[
node distance = 0mm and 6mm,
  start chain = A going right,
  list/.style = {rectangle split, rectangle split parts=2,
                 rectangle split horizontal, draw, inner sep=3.2pt}, 
   mlt/.style = {draw, minimum size=1em,
                 append after command={\pgfextra{\let\LN\tikzlastnode
                  \draw  (\LN.north west) -- (\LN.south east)
                        (\LN.south west) -- (\LN.north east);
                                     }}, 
                node contents={}},
   arr/.style = {{Circle[length=2mm, sep=0pt -2]}-Stealth}, 
                    ]
    \begin{scope}[nodes={list, on chain}]
\node   {$w(B,4,1)$};           % A-1
\node   {$r_3(B,4)$};
\node   {$r_3(B,4)$};
\node   {$w_3(B,4,6)$};
\node   {$r_4.\mathit{fog}.2(B,6)$};     % A-5
    \end{scope}
\node[mlt, on chain] (A-6) {};
% arrows
\foreach \i [count=\j from 2] in {1,...,5}
    \draw[arr] (A-\i.two |- A-\i.east) -- (A-\j);
    \end{tikzpicture}
\captionof{figure}{Linked list corresponding to the $Fog.1$}
\end{strip}
%---------------------------------------------------------------%
\lipsum[2-7]
\end{document}

在此处输入图片描述

相关内容