有谁想过用列表或其他选项来重新创建这种代码格式吗?

有谁想过用列表或其他选项来重新创建这种代码格式吗?

我尝试用 重新创建此代码格式\usepackage{listingsutf8}。我使用 Inkscape 制作了此代码。 在此处输入图片描述

我在 LaTex 中的代码是:

\documentclass{article}
\usepackage{listingsutf8} 
\usepackage{xcolor}
\usepackage{inconsolata}

\lstset
{
     literate=%
         {á}{{\'a}}1
         {í}{{\'i}}1
         {é}{{\'e}}1
         {ý}{{\'y}}1
         {ú}{{\'u}}1
         {ó}{{\'o}}1
         {Á}{{\'A}}1
         {Í}{{\'I}}1
         {É}{{\'E}}1
         {Ý}{{\'Y}}1
         {Ú}{{\'U}}1
         {Ó}{{\'O}}1  
}

\definecolor{mygreen}{rgb}{0,0.6,0}
\definecolor{mygray}{rgb}{0.5,0.5,0.5}
\definecolor{mymauve}{rgb}{0.58,0,0.82}

\lstset{
identifierstyle=\ttfamily,%family of letter
basicstyle=\footnotesize,        % the size of the fonts that are used for the code
  breakatwhitespace=false,         % sets if automatic breaks should only happen at whitespace
  breaklines=false,                 % sets automatic line breaking
  captionpos=b,                    % sets the caption-position to bottom
  commentstyle=\color{mygreen},    % comment style
  extendedchars=true,              % lets you use non-ASCII characters; for 8-bits encodings only, does not work with UTF-8
  keepspaces=true,                 % keeps spaces in text, useful for keeping indentation of code (possibly needs columns=flexible)
  keywordstyle=\color[rgb]{0.97, 0.51, 0.47}, 
  language=[95]Fortran,                 % the language of the code
  numbers=left,                    % where to put the line-numbers; possible values are (none, left, right)
  numbersep=10pt,                   % how far the line-numbers are from the code
  numberstyle=\tiny\color[rgb]{0.64,0.0,0.0}, % the style that is used for the line-numbers
  rulecolor=\color{black},         % if not set, the frame-color may be changed on line-breaks within not-black text (e.g. comments (green here))
  showspaces=false,                % show spaces everywhere adding particular underscores; it overrides 'showstringspaces'
  showstringspaces=false,          % underline spaces within strings only
  showtabs=false,                  % show tabs within strings adding particular underscores
  stepnumber=1,                    % the step between two line-numbers. If it's 1, each line will be numbered
  stringstyle=\color[rgb]{0.0, 0.1, 0.80},     % string literal style
  tabsize=4,                       % sets default tabsize to 2 spaces
  %frame=single,
  backgroundcolor=\color[rgb]{0.96,0.94,0.93}, %{1.0,0.97,0.91},
}

\begin{document}

\begin{lstlisting}[linewidth=7.7cm, frame=single ]  
Program Pepito
 Implicit none
 Real(8),parameter:: pi=dacos(-1.d0)
 Real(8) Res !Estación
 Res=1.d0/pi
 Print*,Res
End Program
\end{lstlisting}

\end{document}

相关内容