latex怎么插入fortran编程代码

如题所述

  1 \documentclass{ctexart}
 2 \usepackage{listings}
 3 \usepackage{xcolor}
 4 \usepackage[width=16cm]{geometry}
 5 \pagestyle{empty}
 6
 7 \begin{document}
 8 \setlength{\fboxsep}{0.3pt}
 9 \lstset{language={[90]Fortran},
10         extendedchars=false,
11         lineskip=-2pt,
12         basicstyle=\tt\tiny\color{black},
13         commentstyle=\rm\color{green!30!black},
14         keywordstyle=\bf,
15         stringstyle=\color{red},
16         showstringspaces=false,
17         identifierstyle=\color{blue},
18         numberstyle=\color{magenta},
19         texcl=true,  % ä¸ºtrue时,注释内容被当做LaTeX代码来处理,因而需要做相应修改:
20                      % _ => \_, ^ => \^{}, < => $<$, > => $>$, % => \% ç­‰
21         emph={
22                Init_Matrices, Deallocate_Matrices, Init_Spin_Operators, Init_crossPos_EGaps, Get_Energy_gaps, Get_pLZ,
23                myzheev, B0mmp, FindBmmp_v2, EneRightOrder , InitSpinPos_b, cgama, ArgGamma, outputEG, InitSpinRelations,
24                DeallocateSpinList, InitInteractions, updateSpinList, sortSpinList, myseed, rand16807, reset16807,
25                gaussSample, mydate, seconds_from_1970, walltime, timestring, hostname
26              },
27         emphstyle=\sf\bfseries\color{red!50!black}\fcolorbox{orange!40!white}{.},
28         numbers=left,
29         frame=single
30         %frame=shadowbox, rulesepcolor=\color{blue}
31         }
32 {\centering\sf  random\_H.f90\\}
33 \lstinputlisting{f90/random_H.f90}
34 \newpage
35 {\centering\sf  mytime.f90\\}
36 \lstinputlisting{f90/mytime.f90}
37 \end{document}
温馨提示:答案为网友推荐,仅供参考
相似回答