这是通过列表实现的吗?

这是通过列表实现的吗?

我是刚接触 LaTex,想生成如下代码,但是不知道怎么实现?好像没有pseudo-code实现方法,上面标的是list,但是我知道的列表形式是1. 2. 3.,怎么实现这样的代码?怎么添加外框和上面的文字? 在此处输入图片描述

我使用了双列格式。命令 \setlength\columnsep{0.25cm} 将列间距设置为 0.25。当我使用列表时,现在的结果是:

在此处输入图片描述 数字覆盖了左栏的文字。在上图中,代码更靠近中间。

我使用了论文模板,模板地址为: https://www.microarch.org/micro53/submit/micro53-latex-template.zip 非常感谢

以下是模板的一部分,这个模板生成的是双列格式,但是我在代码里没找到这个设置,下面的代码生成的列表会覆盖左边的列。

 \documentclass{sig-alternate}
\usepackage{mathptmx} % This is Times font

\usepackage{fancyhdr}
\usepackage[normalem]{ulem}
\usepackage[hyphens]{url}
\usepackage[sort,nocompress]{cite}
\usepackage[final]{microtype}
\usepackage[keeplastbox]{flushend}
% Always include hyperref last
\usepackage[bookmarks=true,breaklinks=true,letterpaper=true,colorlinks,linkcolor=black,citecolor=blue,urlcolor=black]{hyperref}

% Ensure letter paper
\pdfpagewidth=8.5in
\pdfpageheight=11in

%%%%%%%%%%%---SETME-----%%%%%%%%%%%%%
\newcommand{\microsubmissionnumber}{XXX}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\fancypagestyle{firstpage}{
  \fancyhf{}
  \renewcommand{\headrulewidth}{0pt}
  \fancyhead[C]{\vspace{15pt}\normalsize{MICRO 2020 Submission
      \textbf{\#\microsubmissionnumber} -- Confidential Draft -- Do NOT Distribute!!}} 
  \fancyfoot[C]{\thepage}
}

\usepackage{listings}

\lstset{
    basicstyle = \ttfamily,
    numbers = left,
    numberstyle = \footnotesize,
    frame=lrtb
}
%set margin
%\usepackage{geometry}
%\newgeometry{left=0.75in,right=0.75in,top=1in,bottom=1in}
\setlength\columnsep{0.25cm}

\pagenumbering{arabic}

%%%%%%%%%%%---SETME-----%%%%%%%%%%%%%
\title{Guidelines for Submission to MICRO 2020} 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}
\maketitle
\thispagestyle{firstpage}
\pagestyle{plain}




%%%%%% -- PAPER CONTENT STARTS-- %%%%%%%%

\begin{abstract}

    This document is intended to serve as a sample for submissions to the 53rd International Symposium on Microarchitecture~{\textregistered} (MICRO 2020). We provide some guidelines that authors should follow when submitting papers to the conference.  This format is derived from the ACM sig-alternate.cls file, and is used with an objective of keeping the submission version similar to the camera-ready version.

\end{abstract}

\section{Introduction}

This document provides instructions for submitting papers to the 53rd International Symposium on Microarchitecture~{\textregistered} (MICRO 2020).  In an effort to respect the efforts of reviewers and in the interest of fairness to all prospective authors, we request that all submissions to MICRO 2020 follow the formatting and submission rules detailed below. Submissions that violate these instructions may not be reviewed, at the discretion of the program chairs, in order to maintain a review process that is fair to all potential authors. This document is itself formatted using the MICRO 2020 submission format. The content of this document mirrors that of the submission instructions that appear on the conference website. All questions regarding paper formatting and submission should be directed to the program chairs.





\section{Paper Preparation Instructions}

\subsection{Paper Formatting}


\begin{lstlisting}[caption = Code for probing one 12-way cache set]
lfence
rdtsc
mov %eax, %edi
mov (%r8), %r8
mov (%r8), %r8
mov (%r8), %r8
mov (%r8), %r8
mov (%r8), %r8
mov (%r8), %r8
mov (%r8), %r8
mov (%r8), %r8
mov (%r8), %r8
mov (%r8), %r8
mov (%r8), %r8
mov (%r8), %r8
lfence
rdtsc
sub %edi, %eax
\end{lstlisting}



\end{document}

答案1

使用listings。以下是开始:

在此处输入图片描述

\documentclass{article}

\usepackage{listings}

\lstset{
  basicstyle = \ttfamily,
  numbers = left,
  numberstyle = \footnotesize,
  frame=lrtb
}

\begin{document}

\begin{lstlisting}[caption = Code for probing one 12-way cache set]
    lfence
    rdtsc
    mov %eax, %edi
    mov (%r8), %r8
    mov (%r8), %r8
    mov (%r8), %r8
    mov (%r8), %r8
    mov (%r8), %r8
    mov (%r8), %r8
    mov (%r8), %r8
    mov (%r8), %r8
    mov (%r8), %r8
    mov (%r8), %r8
    mov (%r8), %r8
    mov (%r8), %r8
    lfence
    rdtsc
    sub %edi, %eax
\end{lstlisting}

\end{document}

相关内容