使用数组对齐算法

使用数组对齐算法

为什么没有打印所有算法(仅显示 7 个中的 5 个)?此代码有什么问题?

我尝试使用数组来更好地对齐它,但它不起作用。有人可以建议如何使用数组环境正确对齐这些算法吗?

\documentclass[runningheads]{llncs}
\usepackage{graphicx}
\usepackage{epsfig}
\usepackage{subcaption}
\usepackage{calc}
\usepackage{amssymb}
\usepackage{amstext}
\usepackage{amsmath}
\let\proof\relax
\let\endproof\relax
\usepackage{amsthm}
\usepackage{multicol}
\usepackage{pslatex}
%\usepackage{apalike}
\usepackage{cite}
\usepackage{amsmath,amssymb,amsfonts}
\usepackage{algorithmic}
\usepackage{graphicx}
\usepackage{textcomp}
\usepackage{xcolor}
\usepackage{mathtools}
\usepackage{graphicx}
\usepackage{textcomp}
\usepackage{xcolor}
\usepackage{tikz}
\usetikzlibrary{shapes.multipart,shapes,shadows,arrows,decorations.markings,trees,positioning,decorations.markings,calc,fit,chains,intersections,decorations.pathreplacing}
\usepackage[underline=true]{pgf-umlsd}
\usepackage{flexisym}
\usepackage{siunitx}
\usepackage{float}
\usepackage{supertabular,booktabs}
\usepackage{enumitem,kantlipsum}
\usepackage{tcolorbox}
\usepackage{longtable}
\usepackage{tikz-qtree}
\usetikzlibrary{positioning, shapes.geometric}
\usepackage{arydshln}
\usepackage{upgreek}
\usepackage{algorithm}
\usepackage{algorithmic}
\usepackage{float}
\usepackage{url}


\DeclareMathSymbol{\al}  {\mathord}{letters}{"0B}
\DeclareMathSymbol{\be}   {\mathord}{letters}{"0C}
\DeclareMathSymbol{\ga}  {\mathord}{letters}{"0D}
\DeclareMathSymbol{\de}  {\mathord}{letters}{"0E}
\DeclareMathSymbol{\ep}{\mathord}{letters}{"0F}
\DeclareMathSymbol{\ze}   {\mathord}{letters}{"10}
\DeclareMathSymbol{\et}    {\mathord}{letters}{"11}
\DeclareMathSymbol{\thet}  {\mathord}{letters}{"12}
\DeclareMathSymbol{\io}   {\mathord}{letters}{"13}
\DeclareMathSymbol{\ka}  {\mathord}{letters}{"14}
\DeclareMathSymbol{\la} {\mathord}{letters}{"15}
\DeclareMathSymbol{\m}     {\mathord}{letters}{"16}
\DeclareMathSymbol{\n}     {\mathord}{letters}{"17}
\DeclareMathSymbol{\x}     {\mathord}{letters}{"18}
\DeclareMathSymbol{\p}     {\mathord}{letters}{"19}
\DeclareMathSymbol{\rh}    {\mathord}{letters}{"1A}
\DeclareMathSymbol{\sig}  {\mathord}{letters}{"1B}
\DeclareMathSymbol{\ta}    {\mathord}{letters}{"1C}
\DeclareMathSymbol{\up}{\mathord}{letters}{"1D}
\DeclareMathSymbol{\ph}    {\mathord}{letters}{"1E}
\DeclareMathSymbol{\ch}    {\mathord}{letters}{"1F}
\DeclareMathSymbol{\ps}    {\mathord}{letters}{"20}
\DeclareMathSymbol{\om}  {\mathord}{letters}{"21}
\DeclareMathSymbol{\va}{\mathord}{letters}{"22}
\DeclareMathSymbol{\va}{\mathord}{letters}{"23}
\DeclareMathSymbol{\va}  {\mathord}{letters}{"24}
\DeclareMathSymbol{\va} {\mathord}{letters}{"27}

\newcommand {\enc}[2]{\{ #1 \}_{#2} }
%\newcommand {\mess1}[4] {#1 \rightarrow #2 : {\enc {#3} {#4}}}
\newcommand {\believes}[2] {#1 \mid\!\equiv #2}
\newcommand {\oncesaid}[2] {#1 \mid\!\sim #2}
\newcommand {\isgoodkey}[3] { #1 \stackrel{#3}{\longleftrightarrow}  #2 }
\newcommand {\fresh}[1] {\sharp( #1 )}
\newcommand{\jurisdiction}[2] {#1  \models\!>   #2}
\newcommand{\sees}{\triangleleft}
\newcommand{\sendsto}[2]{#1\rightarrow#2}
\newcommand{\possess}{\!\!\ni\!\!}
\newcommand{\utter}{|\!\!\sim\!\!}
\newcommand{\pubkey}[2]{\stackrel{{\textstyle#1}}{\mapsto}#2}
\newcommand{\sharesec}[3]{#2\stackrel{{\textstyle#1}}{\rightleftharpoons}#3}

\begin{document}

\begin{multicols}{2}
    {
        \begin{algorithm}[H]
            \caption{$\mathrm{AA:PullKey}$}\label{alg:pullkey}
            \begin{algorithmic}
                \REQUIRE $\mathrm{\langle{IDT_{ij}, K}\rangle}$
                \STATE $\mathrm{r \in_R \mathbb{Z}_p}$
                \STATE $\mathrm{\langle{D_1, D_2}\rangle \leftarrow genParitalKey(IDT_{ij}, K, \alpha)}$
                \STATE $\mathrm{\quad D_1 = K^{q_x(0)/t_i} \quad \forall i \in L(IDT_{ij}\rightarrow T)}$
                \STATE $\mathrm{\quad D_2 = K^\alpha}$
                \STATE $\mathrm{return\ \langle{D_1, D_2}\rangle}$
            \end{algorithmic}
        \end{algorithm}
    }
    {
        \begin{algorithm}[H]
            \caption{$\mathrm{UIDAI:PullKeyAll}$}\label{alg:pullkeyall}
            \begin{algorithmic}
                \REQUIRE $\mathrm{\langle{IDT_{ij}, K}\rangle}$
                \STATE $\mathrm{D_1 = D_2 =} \phi$
                \STATE $\mathrm{AA \leftarrow GetAA(IDT_{ij}\rightarrow T)}$
                \WHILE {$\mathrm{AA \neq empty}$}
                \STATE $\mathrm{AA_i \leftarrow DEQUEUE(AA)}$
                \STATE $\mathrm{Call\ AA_i\ API:\ \langle{D_1\prime, D_2\prime}\rangle \leftarrow PullKey(IDT_{ij}, K)}$
                \STATE $\mathrm{D_1 = D \cup D_1\prime}$
                \STATE $\mathrm{D_2 = D, D_2\prime}$
                \ENDWHILE
                \STATE $\mathrm{return\ \langle{D_1, D_2}\rangle}$
            \end{algorithmic}
        \end{algorithm}
    }
    {
        \begin{algorithm}[H]
            \caption{$\mathrm{AA:PullK}$}\label{alg:pullk}
            \begin{algorithmic}
                \REQUIRE $\mathrm{\langle{IDT_{ij}, K}\rangle}$
                \STATE $\mathrm{r \in_R \mathbb{Z}_p}$
                \STATE $\mathrm{Store\ mapping:\ IDT_{ij} \leftrightarrow r}$
                \STATE $\mathrm{return\ K^r}$
            \end{algorithmic}
        \end{algorithm}
    }
    {
        \begin{algorithm}[H]
            \caption{$\mathrm{AA:PushK}$}\label{alg:pushk}
            \begin{algorithmic}
                \REQUIRE $\mathrm{\langle{IDT_{ij}, K}\rangle}$
                \STATE $\mathrm{r \in_R \mathbb{Z}_p}$
                \STATE $\mathrm{Update\ mapping:\ IDT_{ij} \leftrightarrow K}$
                \STATE $\mathrm{return}$
            \end{algorithmic}
        \end{algorithm}
    }
    {
        \begin{algorithm}[H]
            \caption{$\mathrm{UIDAI:GenTokPullAllK}$}\label{alg:gentokpullallk}
            \begin{algorithmic}
                \REQUIRE $\mathrm{\langle{IDT_{ij}, K}\rangle}$
                \STATE $\mathrm{AA \leftarrow GetAA(IDT_{ij}\rightarrow T)}$
                \WHILE {$\mathrm{AA \neq empty}$}
                \STATE $\mathrm{AA_i \leftarrow DEQUEUE(AA)}$
                \STATE $\mathrm{Call\ AA_i\ API:\ K \leftarrow PullK(IDT_{ij}, K)}$
                \ENDWHILE
                \STATE $\mathrm{AA \leftarrow GetAA(IDT_{ij}\rightarrow T)}$
                \WHILE {$\mathrm{AA \neq empty}$}
                \STATE $\mathrm{AA_i \leftarrow DEQUEUE(AA)}$
                \STATE $\mathrm{Call\ AA_i\ API:\ PushK(IDT_{ij}, K)}$
                \ENDWHILE
                \STATE $\mathrm{return\ K}$
            \end{algorithmic}
        \end{algorithm}
    }
    {
        \begin{algorithm}
            \caption{$\mathrm{ESP:GenTok}$}\label{alg:gentok1}
            \begin{algorithmic}
                \REQUIRE $\mathrm{\langle{IDT_{ij}, K}\rangle}$
                \STATE $\mathrm{r \in_R \mathbb{Z}_p}$
                \STATE $\mathrm{K \leftarrow K^r}$
                \STATE $\mathrm{K \leftarrow UIDAI:GenTokPullAllK(IDT_{ij}, K)}$
                \STATE $\mathrm{Store\ mapping:\ IDT_{ij} \leftrightarrow K}$
                \STATE $\mathrm{\langle{D_1, D_2}\rangle \leftarrow UIDAI:PullKeyAll(IDT_{ij}, K)}$
                \STATE $\mathrm{IDT_{ij} = }$
                \STATE $\mathrm{\quad ID_{ij}: ID_i, \mathcal{T}_j}$
                \STATE $\mathrm{\quad D_1 : D_U \cup D_{AA_1} \cup D_{AA_2} \cup ...}$
                \STATE $\mathrm{\quad D_2 :} \mathrm{K}^\al, \mathrm{K}^\be, \mathrm{K}^\ga, ...$
                \STATE $\mathrm{return}$
            \end{algorithmic}
        \end{algorithm}
    }
    {
        \begin{algorithm}
            \caption{$\mathrm{Subscriber:genTok}$}\label{alg:gentok2}
            \begin{algorithmic}
                \REQUIRE $\mathrm{\langle{IDT_{ij}}\rangle}$
                \STATE $\mathrm{r \in_R \mathbb{Z}_p}$
                \STATE $\mathrm{K \leftarrow g^r}$
                \STATE $\mathrm{K \leftarrow ESP:GenTok(IDT_{ij}, K, \mathcal{T})}$
                \STATE $\mathrm{Store\ mapping:\ IDT_{ij} \leftrightarrow K}$
                \STATE $\mathrm{return}$
            \end{algorithmic}
        \end{algorithm}
    }
    {
    }
\end{multicols}

\end{document}

在此处输入图片描述

答案1

请删除\begin{multicols}...\end{multicols}然后检查。如果您确实需要twocolumn文本,请尝试使用\documentclass[twocolumn]...

题外话:你真的需要这么多包裹吗?

答案2

您忘记了[H]最后两个algorithm环境。

里面不能有浮点数multicols

相关内容