0

I have a paper divided into 2 columns and I am "drawing" on the second column, I am trying to create a linked list there using the code given here: https://tex.stackexchange.com/a/19288/233406 however, my linked list is too big and getting cut off, how can I solve this?

Minimum reproducible example:

\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}

Here the list is on the first column so it just passes to the second one but in the original document it is in the second column which just makes it cut Picture of what is happening: enter image description here

Any help would be appreciated. I don't mind continuing the linked list on multiple lines/rows as long as it is clear, I don't necessarily want to fit it all in the same space as that might be unplausible.

4
  • Please extend your code snippet to complete small document which reproduce your problem. We need t know, wow wide is your text area on page. Try to use smaller font size ...
    – Zarko
    Commented Mar 19, 2022 at 12:25
  • @Zarko done. also changing font isn't an option as certain requirements are demanded including the font size I am using,
    – Sergio
    Commented Mar 19, 2022 at 12:40
  • You could rotate the image 90^\circ. You might even use wrapfig, although squeezing text into a tiny space looks bad. Commented Mar 19, 2022 at 16:27
  • thanks @JohnKormylo
    – Sergio
    Commented Mar 19, 2022 at 16:37

2 Answers 2

1

Your figure is too large to stay on one column only and if you scale it it becomes unreadable.

You figure* environment to print it on two columns.

\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}

enter image description here

If you would like to scale it:

\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}

enter image description here

5
  • I can't put it two columns, is there a way to make it on one?
    – Sergio
    Commented Mar 19, 2022 at 12:46
  • 1
    @Sergio You can, see my edit, but it is unreadable, in my opinion.
    – CarLaTeX
    Commented Mar 19, 2022 at 12:50
  • thanks a lot!!!
    – Sergio
    Commented Mar 19, 2022 at 12:54
  • @Sergio You're welcome!
    – CarLaTeX
    Commented Mar 19, 2022 at 12:57
  • @DavidCarlisle Done, thanks!
    – CarLaTeX
    Commented Mar 19, 2022 at 13:00
1

Mostly off-topic, however it may be useful ...

Your image is to wide that can be for in one column. Consequently, for image you should use figure* float. In cases, that you like image on the bottom of the same page, use stfloats package.

If this is not satisfactory, i.e. that image should be somewhere on a middle of the page, use cute package:

\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}

enter image description here

This site is temporarily in read-only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .