为什么{Multicols}不支持算法{伪代码}和表格?

为什么{Multicols}不支持算法{伪代码}和表格?

我正在尝试在期刊提供的模板中添加伪代码和表格。这是一个多列模板。当我编写伪代码或表格时,它们不会显示在 pdf 中。请查看屏幕截图

在此处输入图片描述

和代码。谢谢。

\documentclass[twoside]{article}
\usepackage{amsmath}
\usepackage{fancyhdr}
\usepackage{cjk}
\usepackage{color}
\usepackage{algpseudocode,algorithm}
\usepackage{lipsum}% just to fill in more text
\usepackage{multicol}% <<<
%\usepackage{amsfonts,amssymb,amsbsy,textcomp,marvosym}
%%\usepackage{picins} % not found
%\usepackage{amsmath,caption,threeparttable,amsthm,subfigure,float,lastpage,lscape}
%\usepackage{eurosym,mathrsfs,fancyhdr,CJK,multicol,graphics,indentfirst,color,bm,upgreek,booktabs,graphicx,multirow,warpcol}
%\usepackage{epstopdf}
%\usepackage{algorithm}
%\usepackage{algpseudocode}
\usepackage{cite}
%\usepackage{amsmath}
%\usepackage{amsmath,amssymb,amsfonts}
%\usepackage{graphicx}
%\usepackage{textcomp}
%\usepackage{xcolor}

%\usepackage{tikz}
%\usepackage{smartdiagram}
%\usepackage{newfloat}
\usepackage{caption}
%\usepackage{venndiagram}
%\usepackage{pgfplots}
%\usepackage{amssymb}
%\usepackage{algorithm}
%\usepackage{booktabs}

%\usetikzlibrary{arrows,positioning,shapes.geometric}
%\usepackage{cite}
%\usetikzlibrary{shapes.geometric,calc}
\renewcommand{\citedash}{--}    
\newcommand{\WRP}{\par\qquad\(\hookrightarrow\)\enspace}

\def\BibTeX{{\rm B\kern-.05em{\sc i\kern-.025em b}\kern-.08em
    T\kern-.1667em\lower.7ex\hbox{E}\kern-.125emX}}



\looseness=-1
%------------Page layout and margin and Headrule-------------
\headsep=5mm \headheight=4mm \topmargin=0cm \oddsidemargin=-0.5cm
\evensidemargin=-0.5cm \marginparwidth=0pt \marginparsep= 0pt
\marginparpush=0pt \textheight=23.1cm \textwidth=17.5cm \footskip=8mm
\columnsep=7mm \setlength{\doublerulesep}{0.1pt}
\footnotesep=3.5mm\arraycolsep=2pt
\font\tenrm=cmr10
%===========================================================
\def\footnoterule{\kern 1mm \hrule width 10cm \kern 2mm}
\def\rmd{{\rm d}} \def\rmi{{\rm i}} \def\rme{{\rm e}}
\def\sj#1{$^{[#1]}$}\def\lt{\left}\def\rt{\right}
\renewcommand{\captionfont}{\footnotesize}
\renewcommand\tablename{\bf \footnotesize Table}
\renewcommand\figurename{\footnotesize Fig.\!\!}
\captionsetup{labelsep=period}%
\captionsetup[longtable]{labelsep=period}%
\allowdisplaybreaks
\sloppy
\renewcommand{\headrulewidth}{0pt}
\catcode`@=11
\def\title#1{\vspace{3mm}\begin{flushleft}\vglue-.1cm\Large\bf\boldmath\protect\baselineskip=18pt plus.2pt minus.1pt #1
\end{flushleft}\vspace{1mm} }
\def\author#1{\begin{flushleft}\normalsize #1\end{flushleft}\vspace*{-4pt} \vspace{3mm}}
\def\address#1#2{\begin{flushleft}\vglue-.35cm${}^{#1}$\small\it #2\vglue-.35cm\end{flushleft}\vspace{-2mm}\par}
\def\jz#1#2{{$^{\footnotesize\textcircled{\tiny #1}}$\let\thefootnote\relax\footnotetext{\!\!$^{\footnotesize\textcircled{\tiny #1}}$#2}}}
\catcode`@=11
\def\section{\@startsection{section}{1}{\z@}%
 %{-3.5ex \@plus -1ex \@minus -.2ex}%
 {-3ex \@plus -.3ex \@minus -.2ex}%
 {2.2ex \@plus.2ex}%
{\normalfont\normalsize\protect\baselineskip=14.5pt plus.2pt minus.2pt\bfseries}}
\def\subsection{\@startsection{subsection}{2}{\z@}%
 %{-3.25ex\@plus -1ex \@minus -.2ex}%
 {-3ex\@plus -.2ex \@minus -.2ex}%
 {2ex \@plus.2ex}%
{\normalfont\normalsize\protect\baselineskip=12.5pt plus.2pt minus.2pt\bfseries}}
\def\subsubsection{\@startsection{subsubsection}{3}{\z@}%
 %{-3.25ex\@plus -1ex \@minus -.2ex}%
 {-2.2ex\@plus -.21ex \@minus -.2ex}%
 {1.4ex \@plus.2ex}
{\normalfont\normalsize\protect\baselineskip=12pt plus.2pt minus.2pt\sl}}
\def\proofname{{\indent \it Proof.}}
%===========================================================���ϲ���

\pagestyle{fancy}
\fancyhf{}% ����ҳüҳ��
\fancyhead[LO]{\small\sl Shortened Title Within 45 Characters}%
\fancyhead[RO]{\small\thepage}
\fancyhead[LE]{\small\thepage}
\fancyhead[RE]{\small\sl J. Comput. Sci. \& Technol.}
\setcounter{page}{1}


\begin{document}
    \begin{CJK*}{GBK}{song}
        \thispagestyle{empty}
        \vspace*{-13mm}
        \noindent {\small Journal of computer science and   technology: Instruction for authors.
JOURNAL OF COMPUTER SCIENCE AND TECHNOLOGY}
%===========================================================
        \vspace*{2mm}

        \title{Journal of Computer Science and Technology: Instruction for Authors}

        \let\thefootnote\relax\footnotetext{{}\\[-4mm]\indent\ Regular Paper}

        \noindent {\small\bf Abstract} \quad  {\small \textcolor{black}{In this paper, we present an improved Paillier Cryptosystem for a secured data transmission based on the Residue Number System (RNS). , a high level resistance to key sensitivity attacks, and an acceptable level of resilience. In terms of security, it has been discovered that the proposed system outperforms the present algorithm.}}


        \vspace*{3mm}

        \noindent{\small\bf Keywords} \quad {\small Android software, Code cloning, Malware code Detection, Mobile security, Malware detection, Software reuse, Android apps re-usability.}

        \vspace*{4mm}

    \end{CJK*}
    
\baselineskip=18pt plus.2pt minus.2pt
\parskip=0pt plus.2pt minus0.2pt


%\begin{twocolumn}
\begin{multicols}{2}% <<<
    \section{Introduction}

    The Android Operating System is used on more than 2.8 billion smartphones. Only last year, over 1.05 billion Android phones were shipped. 

\begin{algorithm}   
    \caption{Clone Detection}   
\end{algorithm}

Among mobile phone users, over 75\% use Android smartphones due to their low prices and open-source operating systems, which make up the most popular operating system.

\end{multicols}
%\end{twocolumn}


\label{last-page}
\end{document}

答案1

环境内部不允许有浮子multicols

该包float 提供了强制、非浮动H放置,提供所需的输出:

A

\documentclass[twoside]{article}
\usepackage{amsmath}
\usepackage{fancyhdr}
\usepackage{cjk}
\usepackage{color}
\usepackage{algpseudocode}
\usepackage{algorithm}

\usepackage{float} % added <<<<<<<<<<<<<
\usepackage{graphicx}

\usepackage{lipsum}% just to fill in more text
\usepackage{multicol}% <<<

\usepackage{cite}   
\usepackage{caption}    

\renewcommand{\citedash}{--}    
\newcommand{\WRP}{\par\qquad\(\hookrightarrow\)\enspace}

\def\BibTeX{{\rm B\kern-.05em{\sc i\kern-.025em b}\kern-.08em
        T\kern-.1667em\lower.7ex\hbox{E}\kern-.125emX}}
    
\looseness=-1
%------------Page layout and margin and Headrule-------------
\headsep=5mm \headheight=4mm \topmargin=0cm \oddsidemargin=-0.5cm
\evensidemargin=-0.5cm \marginparwidth=0pt \marginparsep= 0pt
\marginparpush=0pt \textheight=23.1cm \textwidth=17.5cm \footskip=8mm
\columnsep=7mm \setlength{\doublerulesep}{0.1pt}
\footnotesep=3.5mm\arraycolsep=2pt
\font\tenrm=cmr10
%===========================================================
\def\footnoterule{\kern 1mm \hrule width 10cm \kern 2mm}
\def\rmd{{\rm d}} \def\rmi{{\rm i}} \def\rme{{\rm e}}
\def\sj#1{$^{[#1]}$}\def\lt{\left}\def\rt{\right}
\renewcommand{\captionfont}{\footnotesize}
\renewcommand\tablename{\bf \footnotesize Table}
\renewcommand\figurename{\footnotesize Fig.\!\!}
\captionsetup{labelsep=period}%
\captionsetup[longtable]{labelsep=period}%
\allowdisplaybreaks
\sloppy
\renewcommand{\headrulewidth}{0pt}
\catcode`@=11
\def\title#1{\vspace{3mm}\begin{flushleft}\vglue-.1cm\Large\bf\boldmath\protect\baselineskip=18pt plus.2pt minus.1pt #1
    \end{flushleft}\vspace{1mm} }
\def\author#1{\begin{flushleft}\normalsize #1\end{flushleft}\vspace*{-4pt} \vspace{3mm}}
\def\address#1#2{\begin{flushleft}\vglue-.35cm${}^{#1}$\small\it #2\vglue-.35cm\end{flushleft}\vspace{-2mm}\par}
\def\jz#1#2{{$^{\footnotesize\textcircled{\tiny #1}}$\let\thefootnote\relax\footnotetext{\!\!$^{\footnotesize\textcircled{\tiny #1}}$#2}}}
\catcode`@=11
\def\section{\@startsection{section}{1}{\z@}%
    %{-3.5ex \@plus -1ex \@minus -.2ex}%
    {-3ex \@plus -.3ex \@minus -.2ex}%
    {2.2ex \@plus.2ex}%
    {\normalfont\normalsize\protect\baselineskip=14.5pt plus.2pt minus.2pt\bfseries}}
\def\subsection{\@startsection{subsection}{2}{\z@}%
    %{-3.25ex\@plus -1ex \@minus -.2ex}%
    {-3ex\@plus -.2ex \@minus -.2ex}%
    {2ex \@plus.2ex}%
    {\normalfont\normalsize\protect\baselineskip=12.5pt plus.2pt minus.2pt\bfseries}}
\def\subsubsection{\@startsection{subsubsection}{3}{\z@}%
    %{-3.25ex\@plus -1ex \@minus -.2ex}%
    {-2.2ex\@plus -.21ex \@minus -.2ex}%
    {1.4ex \@plus.2ex}
    {\normalfont\normalsize\protect\baselineskip=12pt plus.2pt minus.2pt\sl}}
\def\proofname{{\indent \it Proof.}}
%===========================================================���ϲ���

\pagestyle{fancy}
\fancyhf{}% ����ҳüҳ��
\fancyhead[LO]{\small\sl Shortened Title Within 45 Characters}%
\fancyhead[RO]{\small\thepage}
\fancyhead[LE]{\small\thepage}
\fancyhead[RE]{\small\sl J. Comput. Sci. \& Technol.}
\setcounter{page}{1}


\begin{document}
\begin{CJK*}{GBK}{song}
    \thispagestyle{empty}
    \vspace*{-13mm}
    \noindent {\small Journal of computer science and   technology: Instruction for authors.
        JOURNAL OF COMPUTER SCIENCE AND TECHNOLOGY}
    %===========================================================
    \vspace*{2mm}
    
    \title{Journal of Computer Science and Technology: Instruction for Authors}
    
    \let\thefootnote\relax\footnotetext{{}\\[-4mm]\indent\ Regular Paper}
    
    \noindent {\small\bf Abstract} \quad  {\small \textcolor{black}{In this paper, we present an improved Paillier Cryptosystem for a secured data transmission based on the Residue Number System (RNS). , a high level resistance to key sensitivity attacks, and an acceptable level of resilience. In terms of security, it has been discovered that the proposed system outperforms the present algorithm.}}
    
    
    \vspace*{3mm}
    
    \noindent{\small\bf Keywords} \quad {\small Android software, Code cloning, Malware code Detection, Mobile security, Malware detection, Software reuse, Android apps re-usability.}
    
    \vspace*{4mm}
    
\end{CJK*}

\baselineskip=18pt plus.2pt minus.2pt
\parskip=0pt plus.2pt minus0.2pt



\begin{multicols}{2}
\section{Introduction}

The Android Operating System is used on more than 2.8 billion smartphones. Only last year, over 1.05 billion Android phones were shipped. 

\begin{algorithm}[H]   
\caption{Clone Detection}  
    \begin{algorithmic}[1]
        \Procedure{Clone Detection}{$a,b$}
        \State $r\gets a\bmod b$
        \While{$r\not=0$}
        \State $a\gets b$
        \State $b\gets r$
        \State $r\gets a\bmod b$
        \EndWhile\label{euclidendwhile}
        \State \textbf{return} $b$
        \EndProcedure
\end{algorithmic}
\end{algorithm}

The improved Paillier Cryptosystem for a secured data transmission

\begin{table}[H]
\centering
\caption{A table}
    \begin{tabular}{cc}
        A& B\\
        C& D
    \end{tabular}   
\end{table} 

Some text.

\begin{figure}[H]
    \centering
    \includegraphics[width=0.5\columnwidth]{example-image}
    \caption{A figure}
\end{figure}
    
    Among mobile phone users, over 75\% use Android smartphones due to their low prices and open-source operating systems, which make up the most popular operating system.     

\end{multicols} 

\label{last-page}
\end{document}

相关内容