From 0fee22a9ab71239b5655047386146aa306a90da1 Mon Sep 17 00:00:00 2001 From: Timo Heister Date: Wed, 1 Mar 2017 21:49:45 -0500 Subject: [PATCH] add missing files --- 8.5/ansarticle-preprint.cls | 149 ++++++++++++ 8.5/anslistings.sty | 442 ++++++++++++++++++++++++++++++++++++ 2 files changed, 591 insertions(+) create mode 100644 8.5/ansarticle-preprint.cls create mode 100644 8.5/anslistings.sty diff --git a/8.5/ansarticle-preprint.cls b/8.5/ansarticle-preprint.cls new file mode 100644 index 0000000..da94dde --- /dev/null +++ b/8.5/ansarticle-preprint.cls @@ -0,0 +1,149 @@ +% $Id: ansarticle.cls 2730 2011-06-03 09:53:18Z logg $ + +% FIXME: (AL) Need to choose a license for this style, I suggest GFDL + +% Basic setup +\NeedsTeXFormat{LaTeX2e} +\ProvidesClass{ansarticle-preprint} +\LoadClass[twoside,a4paper]{article} + +% Load packages +\RequirePackage{a4wide} +\RequirePackage{anslistings} +\RequirePackage{algorithm,algorithmicx,algpseudocode} +\RequirePackage{amsmath,amssymb} +\RequirePackage[noblocks]{authblk} +\RequirePackage{booktabs} +\RequirePackage{fancyhdr} +\RequirePackage{graphicx} +\RequirePackage[hyperfootnotes=false,colorlinks,linkcolor=blue,urlcolor=blue,citecolor=blue]{hyperref} +\RequirePackage{natbib} + +\RequirePackage{lastpage} +\RequirePackage{listings} +\RequirePackage[colorinlistoftodos,textwidth=4cm,shadow]{todonotes} + + +% Font selection +\RequirePackage[T1]{fontenc} +\RequirePackage{ae,aecompl} +\RequirePackage{pxfonts} % Palatino for running text and math +\renewcommand{\sfdefault}{pag} % Avantgarde for sans serif (section headings) + +% Section headings +\renewcommand{\section}{% + \@startsection{section}{0}{0pt}{2ex}{1ex}{\large\bf\sffamily}} +\renewcommand{\subsection}{% + \@startsection{subsection}{1}{0pt}{\baselineskip}{.5ex}{\bf\sffamily}} +\renewcommand{\subsubsection}{% + \@startsection{subsubsection}{2}{0pt}{\baselineskip}{-1em}{\bf\sffamily}} +\renewcommand{\paragraph}{% + \@startsection{paragraph}{3}{0pt}{0ex}{-0.5em}{\bf\sffamily}} +\renewcommand{\subparagraph}{% + \@startsection{subparagraph}{4}{0pt}{0ex}{-0.5em}{\bf\sffamily}} +\setcounter{secnumdepth}{10} + +% Paragraphs +\setlength{\parindent}{0pt} +\setlength{\parskip}{1ex plus 2ex} + +% Running title and author +\let\@runningtitle\@empty +\let\@runningauthor\@empty +\newcommand{\runningtitle}[1]{\gdef\@runningtitle{#1}} +\newcommand{\runningauthor}[1]{\gdef\@runningauthor{#1}} + +% Formatting volume and article number +\newread\datafile +\openin\datafile=ansinfo +\ifeof\datafile +\message{File datafile.tex with volume, number, and year is missing} +\def\ANSreceived{never} +\def\ANSrevised{never} +\def\ANSaccepted{never} +\def\ANSpublished{never} +\def\ANSvolume{VV} +\def\ANSnumber{NN} +\def\ANSyear{} +\else +\closein\datafile +\input{ansinfo} +\fi + +% Page headers and footers +\fancyhead[RO, LE]{\thepage} +\fancyhead[LO]{\@runningtitle} +\fancyhead[RE]{\@runningauthor} +\fancyfoot[RE,LO]{% + %\footnotesize \copyright{} by the authors, \ANSyear + } +\fancyfoot[RO,LE]{% + %\footnotesize Archive of Numerical Software \ANSvolume(\ANSnumber), \ANSyear + } +\fancyfoot[C]{} +\renewcommand{\headrulewidth}{0pt} +\pagestyle{fancy} + +% Front matter +\renewcommand*{\title}[2][]{\gdef\s@title{#1}\gdef\@title{#2}} +\renewcommand{\Authfont}{\large\sffamily} +\renewcommand{\Affilfont}{\normalsize\sffamily} +\renewcommand{\maketitle}{ + % Footnote stuff + \let\footnotesize\small + \def\footnoterule{\vspace*{-3pt}\rule{.4\columnwidth}{.4pt}\vspace*{2.6pt}} + \renewcommand\thefootnote{\sffamily\@fnsymbol\c@footnote} + \let\footnote\thanks + % Title +% \hfill\fboxrule2pt\fboxsep3mm\fbox{\parbox{5cm}{\centering +% Archive of Numerical Software\\ +% vol. \ANSvolume, no. \ANSnumber, pages 1--\pageref*{LastPage}\\ +% \copyright{} \ANSyear}} + \vskip 60\p@ + \begin{center} + {\LARGE \textsf{\textbf{\@title}} \par} + \vskip 8mm + {\large \lineskip .75em \textsf{\@author} } + \vskip 4mm + \end{center}\par + % Affiliation stuff + \@thanks + % Paper received + \vskip 3mm +% \textbf{\sffamily Received: }\ANSreceived; +% \textbf{\sffamily final revision:} \ANSrevised; +% \textbf{\sffamily published:} \ANSpublished. +% % Some more fixes + \vskip 3mm + \setcounter{footnote}{0}% + \global\let\thanks\relax + \global\let\maketitle\relax + \global\let\@thanks\@empty + \global\let\@author\@empty + \global\let\@date\@empty + \global\let\@title\@empty + \global\let\title\relax + \global\let\author\relax + \global\let\date\relax + \global\let\and\relax + % No headers/footers on front page + \thispagestyle{empty} +} + +% Abstract heading +\renewenvironment{abstract}{\textsf{\textbf{Abstract: }}}{} + +% Useful macro +\newcommand{\fixme}[1]{\todo[inline, color=red!40]{#1}} + +% Some useful notation macros +\newcommand{\R}{\mathbb{R}} +\newcommand{\dx}{\,\mathrm{d}x} +\newcommand{\dX}{\,\mathrm{d}X} +\newcommand{\ds}{\,\mathrm{d}s} +\newcommand{\dS}{\,\mathrm{d}S} +\newcommand{\dt}{\,\mathrm{d}t} +\newcommand{\inner}[2]{\langle #1, #2 \rangle} +\newcommand{\nedelec}{N\'ed\'elec} +\newcommand{\babuska}{Babu\v{s}ka} +\newcommand{\emp}[1]{\texttt{#1}} diff --git a/8.5/anslistings.sty b/8.5/anslistings.sty new file mode 100644 index 0000000..030301c --- /dev/null +++ b/8.5/anslistings.sty @@ -0,0 +1,442 @@ +%% Listings environments for Archive of Numerical Software. +%% +%% The following listings environments are provided: +%% +%% c++ for C++ code +%% python for Python code +%% cython for Cython code +%% xml for XML code +%% bash for BASH code +%% swigcode for SWIG code +%% uflcode for UFL code +%% matlab for MATLAB code +%% anycode for generic code +%% progoutput for program output +%% gencode for generated code +%% latexcode for LaTeX code +%% fortran for FORTRAN code +%% +%% This style file is based on original work by Olivier Verdier +%% (pythonhighlight.sty), +%% with contributions from Johan Hake . +%% +%% Modified for ANS by Anders Logg , 2011. +%% +%% Modified by Hans Petter Langtangen , 2011, to +%% have pairs c++ (with C++ title) and c++:nt (no title), +%% python and python:nt, etc. (It is not always desirable to +%% have a title with the language.) Added Cython and Fortran style. +%% +%% First added: 2011-05-16 +%% Last modified: 2011-06-03 + +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{anslistings}[2009/03/28 code highlighting; provided by Olivier Verdier ] + +% Load required packages +\RequirePackage{listings} +\RequirePackage{xcolor} + +% Basic setup +\renewcommand{\lstlistlistingname}{Code Listings} +\renewcommand{\lstlistingname}{Code Listing} +\newcommand{\codetitlestyle}[1]{\hspace{9cm}\small\textit{#1}\hspace{0.1cm}} +%\newcommand{\codetitlestyle}[1]{\small\textit{#1}\hspace{0.1cm}} +\newcommand{\belowtitleskip}{2pt} +\newcommand{\captionposition}{t} +\newcommand{\framemargin}{0.5ex} +\newcommand{\literatecolour}{\textcolor{literatecolour}} + +% Colors +\definecolor{gray}{gray}{0.5} +\colorlet{commentcolour}{green!50!black} +\colorlet{stringcolour}{red!60!black} +\colorlet{keywordcolour}{magenta!90!black} +\colorlet{exceptioncolour}{yellow!50!red} +\colorlet{commandcolour}{blue!60!black} +\colorlet{numpycolour}{blue!60!green} +\colorlet{literatecolour}{magenta!90!black} +\colorlet{promptcolour}{green!50!black} +\colorlet{specmethodcolour}{violet} +\colorlet{indendifiercolour}{green!70!white} + +% Define the common style to be shared by all languages +\lstdefinestyle{c@mmon}{% +showtabs=true, % show tabs in strings using underscore +tab=, +tabsize=2, % tab means 2 spaces +basicstyle=\ttfamily\footnotesize, % fonts used for the code +breaklines=true, % break lines +breakatwhitespace=true, % let linebreaks happen at whitespace +showspaces=false, % true: show spaces with a particular underscore +aboveskip=1ex, +frame=trbl, % top+right+bottom+left (TB draws double lines at top + bottom) +%framerule=0.4pt % thickness of frame +rulecolor=\color{black}, % frame color +backgroundcolor=\color{yellow!10}, +xleftmargin=5pt, +xrightmargin=5pt, +%numbers=left, % put line numbers on the left +%stepnumber=2, % stepnumber=1 numbers each line, =n every n lines +} +\lstset{style=c@mmon} + +%--- Typesetting LaTeX --- +\lstnewenvironment{latexcode}{\lstset{language=[LaTeX]TeX,style=c@mmon}}{} +\newcommand{\inputlatex}[1]{\lstset{language=[LaTeX]TeX,style=c@mmon}% + \lstinputlisting{#1}} +\lstnewenvironment{latexcode:nt}{\lstset{language=[LaTeX]TeX,style=c@mmon}}{} + +%--- C++ --- + +\lstdefinestyle{cppstyle}{ +language=c++, +style=c@mmon, +stringstyle=\color{stringcolour}, +showstringspaces=false, +alsoletter={1234567890}, +keywordstyle=\color{keywordcolour}\bfseries, +emph={auto,const,struct,% +break,continue,else,for,switch,void,% +case,default,enum,goto,register,sizeof,typedef,% +char,do,extern,if,return,static,union,while,% +asm,dynamic_cast,namespace,reinterpret_cast,try,% +bool,explicit,new,static_cast,typeid,volatile,% +catch,operator,template,typename,% +class,friend,private,this,using,% +const_cast,inline,public,throw,virtual,% +delete,mutable,protected,wchar_t,% +or,and,xor,not,assert}, +emphstyle=\color{blue}\bfseries, +emph={[2]true, false, NULL}, +emphstyle=[2]\color{keywordcolour}, +emph={[3]double,float,int,short,unsigned,long,signed}, +emphstyle=[3]\color{blue}, +emph={[4]1, 2, 3, 4, 5, 6, 7, 8, 9, 0}, +emph={[4]cos,sin,tan,acos,asin,atan,atan2,cosh,sinh,tanh,% +exp,frexp,ldexp,log,log10,modf,pow,sqrt,ceil,fabs,floor,fmod}, +emphstyle=[4]\color{numpycolour}, +literate=*% +{:}{{\literatecolour:}}{1}% +{=}{{\literatecolour=}}{1}% +{-}{{\literatecolour-}}{1}% +{+}{{\literatecolour+}}{1}% +{*}{{\literatecolour*}}{1}% +{!}{{\literatecolour!}}{1}% +{[}{{\literatecolour[}}{1}% +{]}{{\literatecolour]}}{1}% +{<}{{\literatecolour<}}{1}% +{>}{{\literatecolour>}}{1}% +{>>>}{{\textcolor{promptcolour}{>>>}}}{1}% +,% +commentstyle=\color{commentcolour}\slshape, +morecomment=[l][commentstyle]{//}, +morecomment=[s][commentstyle]{/*}{*/}, +morestring=[b][stringstyle]", +morestring=[d][stringstyle]' +} + +\newcommand{\inputcpp}[1]{\lstinputlisting[style=cppstyle, title={\codetitlestyle{C++ code}}, belowcaptionskip=\belowtitleskip]{#1}} +\lstnewenvironment{c++}[1][]{\lstset{style=cppstyle, title={\codetitlestyle{C++ code}}, belowcaptionskip=\belowtitleskip}}{} +\lstnewenvironment{c++:nt}[1][]{\lstset{style=cppstyle}}{} +\newcommand{\cppinline}{\lstinline[style=cppstyle,basicstyle=\ttfamily]} + +%--- Python and Cython --- + + \lstdefinestyle{pythonstyle}{ + language=python, + showtabs=true, + tab=, + tabsize=2, + basicstyle=\ttfamily\footnotesize, + stringstyle=\color{stringcolour}, + showstringspaces=false, + alsoletter={1234567890}, + otherkeywords={\ , \}, \{, \%, \&, \|}, + keywordstyle=\color{keywordcolour}\bfseries, + emph={and,break,class,continue,def,yield,del,elif ,else,% + except,exec,finally,for,from,global,if,import,in,% + lambda,not,or,pass,print,raise,return,try,while,assert}, + emphstyle=\color{blue}\bfseries, + emph={[2]True, False, None}, + emphstyle=[2]\color{keywordcolour}, + emph={[3]object,type,isinstance,copy,deepcopy,zip,enumerate,reversed,list,len,dict,tuple,xrange,append,execfile,real,imag,reduce,str,repr}, + emphstyle=[3]\color{commandcolour}, + emph={Exception,NameError,IndexError,SyntaxError,TypeError,ValueError,OverflowError,ZeroDivisionError}, + emphstyle=\color{exceptioncolour}\bfseries, + commentstyle=\color{commentcolour}\slshape, + emph={[4]ode, fsolve, sqrt, exp, sin, cos, arccos, pi, array, norm, solve, dot, arange, , isscalar, max, sum, flatten, shape, reshape, find, any, all, abs, plot, linspace, legend, quad, polyval,polyfit, hstack, concatenate,vstack,column_stack,empty,zeros,ones,rand,vander,grid,pcolor,eig,eigs,eigvals,svd,qr,tan,det,logspace,roll,min,mean,cumsum,cumprod,diff,vectorize,lstsq,cla,eye,xlabel,ylabel,squeeze}, + emphstyle=[4]\color{numpycolour}, + emph={[5]__init__,__add__,__mul__,__div__,__sub__,__call__,__getitem__,__setitem__,__eq__,__ne__,__nonzero__,__rmul__,__radd__,__repr__,__str__,__get__,__truediv__,__pow__,__name__,__future__,__all__}, + emphstyle=[5]\color{specmethodcolour}, + emph={[6]assert,range,yield}, + emphstyle=[6]\color{keywordcolour}\bfseries, + literate=*% + {:}{{\literatecolour:}}{1}% + {=}{{\literatecolour=}}{1}% + {-}{{\literatecolour-}}{1}% + {+}{{\literatecolour+}}{1}% + {*}{{\literatecolour*}}{1}% + {/}{{\literatecolour/}}{1}% + {!}{{\literatecolour!}}{1}% + {[}{{\literatecolour[}}{1}% + {]}{{\literatecolour]}}{1}% + {<}{{\literatecolour<}}{1}% + {>}{{\literatecolour>}}{1}% + {>>>}{{\textcolor{promptcolour}{>>>}}}{1}% + ,% + breaklines=true, + breakatwhitespace= true, + aboveskip=1ex, + frame=trbl, + framesep=.3ex, + rulecolor=\color{black!40}, + backgroundcolor=\color{yellow!10} +} + + + \lstdefinestyle{cythonstyle}{ + language=cython, + showtabs=true, + tab=, + tabsize=2, + basicstyle=\ttfamily\footnotesize, + stringstyle=\color{stringcolour}, + showstringspaces=false, + alsoletter={1234567890}, + otherkeywords={\ , \}, \{, \%, \&, \|}, + keywordstyle=\color{keywordcolour}\bfseries, + emph={and,break,class,continue,def,cdef,cpdef,yield,del,elif ,else,% + except,exec,finally,for,from,global,if,import,in,% + lambda,not,or,pass,print,raise,return,try,while,assert,cdef,cpdef}, + emphstyle=\color{blue}\bfseries, + emph={[2]True, False, None}, + emphstyle=[2]\color{keywordcolour}, + emph={[3]object,type,isinstance,copy,deepcopy,zip,enumerate,reversed,list,len,dict,tuple,xrange,append,execfile,real,imag,reduce,str,repr,float,int,ndarray,complex,double}, + emphstyle=[3]\color{commandcolour}, + emph={Exception,NameError,IndexError,SyntaxError,TypeError,ValueError,OverflowError,ZeroDivisionError}, + emphstyle=\color{exceptioncolour}\bfseries, + commentstyle=\color{commentcolour}\slshape, + emph={[4]ode, fsolve, sqrt, exp, sin, cos, arccos, pi, array, norm, solve, dot, arange, , isscalar, max, sum, flatten, shape, reshape, find, any, all, abs, plot, linspace, legend, quad, polyval,polyfit, hstack, concatenate,vstack,column_stack,empty,zeros,ones,rand,vander,grid,pcolor,eig,eigs,eigvals,svd,qr,tan,det,logspace,roll,min,mean,cumsum,cumprod,diff,vectorize,lstsq,cla,eye,xlabel,ylabel,squeeze}, + emphstyle=[4]\color{numpycolour}, + emph={[5]__init__,__add__,__mul__,__div__,__sub__,__call__,__getitem__,__setitem__,__eq__,__ne__,__nonzero__,__rmul__,__radd__,__repr__,__str__,__get__,__truediv__,__pow__,__name__,__future__,__all__}, + emphstyle=[5]\color{specmethodcolour}, + emph={[6]assert,range,yield}, + emphstyle=[6]\color{keywordcolour}\bfseries, + literate=*% + {:}{{\literatecolour:}}{1}% + {=}{{\literatecolour=}}{1}% + {-}{{\literatecolour-}}{1}% + {+}{{\literatecolour+}}{1}% + {*}{{\literatecolour*}}{1}% + {/}{{\literatecolour/}}{1}% + {!}{{\literatecolour!}}{1}% + {[}{{\literatecolour[}}{1}% + {]}{{\literatecolour]}}{1}% + {<}{{\literatecolour<}}{1}% + {>}{{\literatecolour>}}{1}% + {>>>}{{\textcolor{promptcolour}{>>>}}}{1}% + ,% + breaklines=true, + breakatwhitespace= true, + aboveskip=1ex, + frame=trbl, + framesep=.3ex, + rulecolor=\color{black!40}, + backgroundcolor=\color{yellow!10} +} + +\newcommand{\inputpython}[1]{\lstinputlisting[style=pythonstyle,title={\codetitlestyle{Python code }},belowcaptionskip=\belowtitleskip]{#1}} +\lstnewenvironment{python}[1][]{\lstset{style=pythonstyle,title={\codetitlestyle{Python code }},belowcaptionskip=\belowtitleskip}}{} +%\lstnewenvironment{python}[1][]{\lstset{style=pythonstyle,title={\codetitlestyle{Python code }},belowcaptionskip=\belowtitleskip}}{} +\lstnewenvironment{python:nt}[1][]{\lstset{style=pythonstyle}}{} +\newcommand{\pythoninline}{\lstinline[style=pythonstyle,basicstyle=\ttfamily]} + + +\newcommand{\inputcython}[1]{\lstinputlisting[style=cythonstyle,title={\codetitlestyle{Cython code }},belowcaptionskip=\belowtitleskip]{#1}} +\lstnewenvironment{cython}[1][]{\lstset{style=cythonstyle,title={\codetitlestyle{Cython code }},belowcaptionskip=\belowtitleskip}}{} +\lstnewenvironment{cython:nt}[1][]{\lstset{style=cythonstyle}}{} +\newcommand{\cythoninline}{\lstinline[style=cythonstyle,basicstyle=\ttfamily]} + +%--- FORTRAN --- + +% Note: this is basically FORTRAN 77, not 90, 95, 2003/2008. +\lstdefinestyle{fortranstyle}{ +language=fortran, +style=c@mmon, +stringstyle=\color{stringcolour}, +showstringspaces=false, +alsoletter={1234567890}, +keywordstyle=\color{keywordcolour}\bfseries, +emph={auto,do,while,if,else,end,endif,enddo,% +subroutine,function,format,program}, +emphstyle=\color{blue}\bfseries, +emphstyle=[2]\color{keywordcolour}, +emph={[3]double,real,precision,integer,logical}, +emphstyle=[3]\color{blue}, +emph={[4]1, 2, 3, 4, 5, 6, 7, 8, 9, 0}, +emph={[4]cos,sin,tan,acos,asin,atan,atan2,cosh,sinh,tanh,% +exp,frexp,ldexp,log,log10,modf,pow,sqrt,ceil,fabs,floor,fmod}, +emphstyle=[4]\color{numpycolour}, +literate=*% +{:}{{\literatecolour:}}{1}% +{=}{{\literatecolour=}}{1}% +{-}{{\literatecolour-}}{1}% +{+}{{\literatecolour+}}{1}% +{*}{{\literatecolour*}}{1}% +{!}{{\literatecolour!}}{1}% +{[}{{\literatecolour[}}{1}% +{]}{{\literatecolour]}}{1}% +{<}{{\literatecolour<}}{1}% +{>}{{\literatecolour>}}{1}% +,% +commentstyle=\color{commentcolour}\slshape, +morecomment=[l][commentstyle]{C}, % need ! as well for F90 +morestring=[b][stringstyle]", +morestring=[d][stringstyle]' +} + +\newcommand{\inputfortran}[1]{\lstinputlisting[style=fortranstyle, title={\codetitlestyle{FORTRAN code}}, belowcaptionskip=\belowtitleskip]{#1}} +\lstnewenvironment{fortran}[1][]{\lstset{style=fortranstyle, title={\codetitlestyle{FORTRAN code}}, belowcaptionskip=\belowtitleskip}}{} +\lstnewenvironment{fortran:nt}[1][]{\lstset{style=fortranstyle}}{} +\newcommand{\fortraninline}{\lstinline[style=fortranstyle,basicstyle=\ttfamily]} + + +%--- XML --- + +\lstdefinestyle{xmlstyle}{ +language=xml, +showtabs=true, +tab=, +tabsize=2, +basicstyle=\ttfamily\footnotesize, +stringstyle=\color{stringcolour}, +showstringspaces=false, +alsoletter={1234567890}, +emphstyle=\color{exceptioncolour}\bfseries, +commentstyle=\color{commentcolour}\slshape, +breaklines=true, +breakatwhitespace= true, +aboveskip=1ex, +frame=trbl, +framesep=.3ex, +rulecolor=\color{black!40}, +backgroundcolor=\color{yellow!10} +} + +\newcommand{\inputxml}[1]{\lstinputlisting[style=xmlstyle, title={\codetitlestyle{XML code}}, belowcaptionskip=\belowtitleskip]{#1}} +\lstnewenvironment{xml}[1][]{\lstset{style=xmlstyle, title={\codetitlestyle{XML code}}, belowcaptionskip=\belowtitleskip}}{} +\lstnewenvironment{xml:nt}[1][]{\lstset{style=xmlstyle}}{} + +%--- Typesetting Bash --- + +\lstdefinestyle{bashstyle}{ +language=bash, +showtabs=true, +tab=, +tabsize=2, +basicstyle=\ttfamily\footnotesize, +stringstyle=\color{stringcolour}, +showstringspaces=false, +alsoletter={1234567890}, +otherkeywords={\ , \}, \{, \%, \&, \|}, +emphstyle=\color{exceptioncolour}\bfseries, +commentstyle=\color{commentcolour}\slshape, +breaklines=true, +breakatwhitespace= true, +aboveskip=1ex, +frame=trbl, +framesep=.3ex, +rulecolor=\color{black!40}, +backgroundcolor=\color{yellow!10} +} + +\newcommand{\inputbash}[1]{\lstinputlisting[style=bashstyle, title={\codetitlestyle{Bash code}}, belowcaptionskip=\belowtitleskip]{#1}} +\lstnewenvironment{bash}[1][]{\lstset{style=bashstyle, title={\codetitlestyle{Bash code}}, belowcaptionskip=\belowtitleskip}}{} +\lstnewenvironment{bash:nt}[1][]{\lstset{style=bashstyle}}{} +\lstnewenvironment{csh}[1][]{\lstset{style=bashstyle, title={\codetitlestyle{Csh code}}, belowcaptionskip=\belowtitleskip}}{} +\lstnewenvironment{csh:nt}[1][]{\lstset{style=bashstyle}}{} + +%--- SWIG --- + +\newcommand{\inputswig}[1]{\lstinputlisting[style=cppstyle, title={\codetitlestyle{SWIG code}}, belowcaptionskip=\belowtitleskip]{#1}} +\lstnewenvironment{swigcode}[1][]{\lstset{style=cppstyle, title={\codetitlestyle{SWIG code}}, belowcaptionskip=\belowtitleskip}}{} +\lstnewenvironment{swigcode:nt}[1][]{\lstset{style=cppstyle}}{} + +%--- UFL --- + +\newcommand{\inputufl}[1]{\lstinputlisting[style=pythonstyle, title={\codetitlestyle{UFL code}}, belowcaptionskip=\belowtitleskip]{#1}} +\lstnewenvironment{uflcode}[1][]{\lstset{style=pythonstyle, title={\codetitlestyle{UFL code}}, belowcaptionskip=\belowtitleskip}}{} +\lstnewenvironment{uflcode:nt}[1][]{\lstset{style=pythonstyle}}{} + +%--- MATLAB --- + +% Note: problem with too large width of frame +\lstnewenvironment{matlab}[1][]{ +\lstset{ +language=matlab, +basicstyle=\ttfamily\small, +backgroundcolor=\color{yellow!10} +frame=trbl, +rulecolor=\color{black!40}, +emphstyle=\color{blue}, +commentstyle=\color{commentcolour}\slshape, +keywordstyle=\color{keywordcolour}\bfseries, +}}{} + +%--- Other --- + +\lstdefinestyle{anycodestyle}{ +language=bash, +showtabs=true, +tab=, +tabsize=2, +basicstyle=\ttfamily\footnotesize, +stringstyle=\color{stringcolour}, +showstringspaces=false, +alsoletter={1234567890}, +emphstyle=\color{exceptioncolour}\bfseries, +commentstyle=\color{commentcolour}\slshape, +breaklines=true, +breakatwhitespace= true, +aboveskip=1ex, +frame=trbl, +framesep=.3ex, +rulecolor=\color{black!40}, +backgroundcolor=\color{yellow!10} +} + +\newcommand{\inputanycode}[1]{\lstinputlisting[style=anycodestyle, title={\codetitlestyle{Code}}, belowcaptionskip=\belowtitleskip]{#1}} +\lstnewenvironment{anycode}[1][]{\lstset{style=anycodestyle, title={\codetitlestyle{Code}}, belowcaptionskip=\belowtitleskip}}{} +\lstnewenvironment{anycode:nt}[1][]{\lstset{style=anycodestyle}}{} + +%--- Output from running programs --- + +\lstnewenvironment{progoutput}[1][]{\lstset{style=gencodestyle, title={\codetitlestyle{Output}}, belowcaptionskip=\belowtitleskip}}{} +\lstnewenvironment{progoutput:nt}[1][]{\lstset{style=gencodestyle}}{} + +%--- Generated code --- + +\lstdefinestyle{gencodestyle}{ +language=bash, +showtabs=true, +tab=, +tabsize=2, +basicstyle=\ttfamily\footnotesize, +stringstyle=\color{stringcolour}, +showstringspaces=false, +alsoletter={1234567890}, +emphstyle=\color{exceptioncolour}\bfseries, +commentstyle=\color{commentcolour}\slshape, +breaklines=true, +breakatwhitespace= true, +aboveskip=1ex, +frame=trbl, +framesep=.3ex, +rulecolor=\color{black!40}, +backgroundcolor=\color{yellow!10} +} + +\newcommand{\inputgencode}[1]{\lstinputlisting[style=cppstyle, title={\codetitlestyle{Generated code}}, belowcaptionskip=\belowtitleskip]{#1}} +\lstnewenvironment{gencode}[1][]{\lstset{style=gencodestyle, title={\codetitlestyle{Generated code}}, belowcaptionskip=\belowtitleskip}}{} +\lstnewenvironment{gencode:nt}[1][]{\lstset{style=gencodestyle}}{} -- 2.39.5