我正在使用 Overleaf 上一个包含两列的贡献中的加密代码包。我有以下示例代码,但在修复与第二列的重叠时遇到了一些问题。这里是示例:
\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}
答案1
您可以通过选项控制\pseudocode
或命令中的列间距。将其设置为负空间会折叠列,这尤其适用于协议,可实现更紧凑的显示。以下示例使用。\procedure
colspace
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}
答案2
该数字不可能放在一列中。请使用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}