2

I am working with the cryptocode packet in a contribution with two columns on Overleaf. I have the following sample code, but I have some problem to fix the overlap with the second column. Here the example:

\documentclass[10pt,journal,compsoc]{IEEEtran}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel} % English language/hyphenation
\usepackage[linesnumbered]{algorithm2e}
\usepackage{amsmath,amsfonts, amssymb} % Math packages
\usepackage{mathtools}
\usepackage{acronym}
\usepackage{longtable}
\usepackage{textcomp}
\usepackage{multirow}
\usepackage{makecell}
\usepackage{subfigure}
\usepackage{graphicx}
\usepackage{color}
\usepackage{epsfig}
\usepackage{url}
\usepackage{balance}
\usepackage{float}
\usepackage{comment}
\usepackage{pifont}
\usepackage{xr}
\usepackage{array}
\usepackage{cite}

\usepackage{dashbox}
\usepackage[
    n,
    operators,
    advantage,
    sets,
    adversary,
    landau,
    probability,
    notions,    
    logic,
    ff,
    mm,
    primitives,
    events,
    complexity,
    asymptotics,
    keys]{cryptocode}

\usepackage{hyperref}

    
\begin{document}
\bstctlcite{IEEEexample:BSTcontrol}

\title{Hello World}
\author{XXX,XXX
\IEEEcompsocitemizethanks{\IEEEcompsocthanksitem XXX, XXX  \protect\\
% note need leading \protect in front of \\ to get a newline within \thanks as
% \\ is fragile and will error, could use \hfil\break instead.
}% <-this % stops an unwanted space

}

\maketitle

\begin{abstract}
    Hello world
\end{abstract}

\begin{IEEEkeywords}
bla,bla,bla
\end{IEEEkeywords}

\IEEEpeerreviewmaketitle

\section{Introduction}
\begin{figure}[H]
\centering
\dbox{%
\procedure{My Protocol}{%
 \textbf{Alice} \< \< \textbf{Bob}  \\
 b \sample \bin \< \< \\
 \< \sendmessageright*{\text{send over } b} \<  \\
 \< \< \text{do something}    \\
 \<\< \dbox{\begin{subprocedure}\procedure{Subprotocol}{
 \< \< \textbf{Charlie}  \\
\text{something more} \< \<  \\
 \< \sendmessageright*[1.5cm]{\text{message}} \<  \\
 \< \< \text{some processing}  \\
 \< \< \text{more processing}  \\ 
 \< \sendmessageleft*[1.5cm]{\text{message}} \<  \\
 \< \sendmessageright*[1.5cm]{\text{message}} \<  \\
 \< \sendmessageleft*[1.5cm]{\text{message}} \<  \\
}\end{subprocedure}}  \\
 \< \sendmessageleft*{\text{send over sth. else}} \<   \\
 \text{finalize} \< \< }
}
\caption{Caption}
\label{fig:my_label}
\end{figure}
\end{document}

Screenshot screenshot of my problem

14
  • As always on the site please provide a full minimal example others can just copy and test as is. Not these sniplets.
    – daleif
    Commented Jul 2, 2020 at 13:54
  • Unrelated: it is not a good idea to use the center env to center a figure. The center end adds vertical space above and below its contents, so does the figure env, thus double space. The standard method is to replace \begon{center} by \centering and remove \end{center}
    – daleif
    Commented Jul 2, 2020 at 13:55
  • @daleif I followed your first suggestion and I modified the post. By the way I put the centering without solve my problem.
    – CipherX
    Commented Jul 2, 2020 at 14:00
  • As I already mentioned in the comment it was not related to your problem. Note that in general hyperref needs to be loaded last.
    – daleif
    Commented Jul 2, 2020 at 14:05
  • 1
    Please show an image of what you see? I see no obvious overlap.
    – daleif
    Commented Jul 2, 2020 at 14:19

2 Answers 2

1

You can control the spacing between columns in a \pseudocode or \procedure command via the colspace option. Setting it to a negative space collapses the columns which, in particular for protocols, allows for more compact presentation. The following example is with colspace=-1cm.

\documentclass[10pt,journal,compsoc]{IEEEtran}
\usepackage{float}

\usepackage{dashbox}
\usepackage[
    n,
    operators,
    advantage,
    sets,
    adversary,
    landau,
    probability,
    notions,    
    logic,
    ff,
    mm,
    primitives,
    events,
    complexity,
    asymptotics,
    keys]{cryptocode}

\usepackage{hyperref}
\usepackage{lipsum}
    
\begin{document}
\bstctlcite{IEEEexample:BSTcontrol}

\title{Hello World}
\author{XXX,XXX
\IEEEcompsocitemizethanks{\IEEEcompsocthanksitem XXX, XXX  \protect\\
% note need leading \protect in front of \\ to get a newline within \thanks as
% \\ is fragile and will error, could use \hfil\break instead.
}% <-this % stops an unwanted space

}

\maketitle

\begin{abstract}
    Hello world
\end{abstract}

\begin{IEEEkeywords}
bla,bla,bla
\end{IEEEkeywords}

\IEEEpeerreviewmaketitle

\section{Introduction}
\lipsum[1-4]
\begin{figure}[H]
\centering
\dbox{%
\procedure[colspace=-1cm]{My Protocol}{%
 \textbf{Alice} \< \< \textbf{Bob}  \\
 b \sample \bin \< \< \\
 \< \sendmessageright*{\text{send over } b} \<  \\
 \< \< \text{do something}    \\
 \<\< \dbox{\begin{subprocedure}\procedure{Subprotocol}{
 \< \< \textbf{Charlie}  \\
\text{something more} \< \<  \\
 \< \sendmessageright*[1.5cm]{\text{message}} \<  \\
 \< \< \text{some processing}  \\
 \< \< \text{more processing}  \\ 
 \< \sendmessageleft*[1.5cm]{\text{message}} \<  \\
 \< \sendmessageright*[1.5cm]{\text{message}} \<  \\
 \< \sendmessageleft*[1.5cm]{\text{message}} \<  \\
}\end{subprocedure}}  \\
 \< \sendmessageleft*{\text{send over sth. else}} \<   \\
 \text{finalize} \< \< }
}
\caption{Caption}
\label{fig:my_label}
\end{figure}
\lipsum[1]
\end{document}

Protocol with collapsed columns

1

There's no chance the figure fits in one column. Use figure*.

\documentclass[10pt,journal,compsoc]{IEEEtran}

\usepackage{dashbox}
\usepackage[
    n,
    operators,
    advantage,
    sets,
    adversary,
    landau,
    probability,
    notions,    
    logic,
    ff,
    mm,
    primitives,
    events,
    complexity,
    asymptotics,
    keys]{cryptocode}

\usepackage{hyperref}
\usepackage{lipsum}

    
\begin{document}
\bstctlcite{IEEEexample:BSTcontrol}

\title{Hello World}
\author{XXX,XXX
\IEEEcompsocitemizethanks{\IEEEcompsocthanksitem XXX, XXX  \protect\\
% note need leading \protect in front of \\ to get a newline within \thanks as
% \\ is fragile and will error, could use \hfil\break instead.
}% <-this % stops an unwanted space

}

\maketitle

\begin{abstract}
    Hello world
\end{abstract}

\begin{IEEEkeywords}
bla,bla,bla
\end{IEEEkeywords}

\IEEEpeerreviewmaketitle

\section{Introduction}

\lipsum[1]

\begin{figure*}[tp]
\centering
\dbox{%
\procedure{My Protocol}{%
 \textbf{Alice} \< \< \textbf{Bob}  \\
 b \sample \bin \< \< \\
 \< \sendmessageright*{\text{send over } b} \<  \\
 \< \< \text{do something}    \\
 \<\< \dbox{\begin{subprocedure}\procedure{Subprotocol}{
 \< \< \textbf{Charlie}  \\
\text{something more} \< \<  \\
 \< \sendmessageright*[1.5cm]{\text{message}} \<  \\
 \< \< \text{some processing}  \\
 \< \< \text{more processing}  \\ 
 \< \sendmessageleft*[1.5cm]{\text{message}} \<  \\
 \< \sendmessageright*[1.5cm]{\text{message}} \<  \\
 \< \sendmessageleft*[1.5cm]{\text{message}} \<  \\
}\end{subprocedure}}  \\
 \< \sendmessageleft*{\text{send over sth. else}} \<   \\
 \text{finalize} \< \< }
}
\caption{Caption}
\label{fig:my_label}
\end{figure*}

\lipsum[2-12]

\end{document}

enter image description here

You must log in to answer this question.

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