This repository has been archived by the owner on Apr 17, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmacroListing.sty
83 lines (83 loc) · 3.88 KB
/
macroListing.sty
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% NE PAS TOUCHER
\usepackage[svgnames]{xcolor}
\makeatletter
\@ifundefined{\string\color@RED}{\colorlet{RED}{red}}{}
\makeatother
\usepackage{caption}
\usepackage{listings}
\usepackage[framemethod=TikZ]{mdframed}
\newcommand{\lstinput}[2][]{\begin{mdframed}[backgroundcolor=LightSlateGray!10,outerlinewidth=0.02pt,outerlinecolor=black,%
innerleftmargin=3pt,innerrightmargin=5pt,innertopmargin=-3pt,roundcorner=2pt,innerbottommargin=-3pt]
\lstinputlisting[#1]{#2}
\end{mdframed}
\vspace*{-3pt}
\lstcapt{\texttt{#2}%
}%
}
\def\ifempty#1{\def\temparg{#1}\ifx\temparg\empty}
\newcommand{\lstcapt}[2][]{%
\vspace*{-3pt}
\ifempty{#1}%
\captionof{lstlisting}{#2}%
\else%
\captionof{lstlisting}[#1]{#2}%
\fi%
% \vspace*{0.75\baselineskip}%
}
\makeatletter
\renewrobustcmd*\mdf@tikzbox@tfl[1]{%three or four borders
\path(0,0)rectangle(\mdfboundingboxwidth,\mdfboundingboxheight);% replace \clip by \path
\begin{scope}[mdfcorners]%
\clip[preaction=mdfouterline]%
[postaction=mdfbackground]%
[postaction=mdfinnerline]#1;%
\end{scope}%
\path[mdfmiddleline,mdfcorners]#1;
}%
\lstset{ %
language=C++, % the language of the code
basicstyle=\footnotesize, % the size of the fonts that are used for the code
numbers=left, % where to put the line-numbers
numberstyle=\tiny\color{black}, % the style that is used for the line-numbers
stepnumber=4, % the step between two line-numbers. If it's 1, each line
% will be numbered
numbersep=5pt, % how far the line-numbers are from the code
showspaces=false, % show spaces adding particular underscores
showstringspaces=false, % underline spaces within strings
showtabs=false, % show tabs within strings adding particular underscores
% frame=single, % adds a frame around the code
rulecolor=\color{black}, % if not set, the frame-color may be changed on line-breaks within not-black text)
tabsize=2, % sets default tabsize to 2 spaces
captionpos=b, % sets the caption-position to bottom
breaklines=true, % sets automatic line breaking
breakatwhitespace=true, % sets if automatic breaks should only happen at whitespace
%title=\lstname, % show the filename of files included with \lstinputlisting;
% also try caption instead of title
keywordstyle=\color{MediumBlue}, % keyword style
commentstyle=\color{DarkGreen}, % comment style
escapebegin=\color{DarkGreen},
stringstyle=\color{MediumVioletRed}, % string literal style
escapeinside={\%*}{*)}, % if you want to add LaTeX within your code
% backgroundcolor=\color{LightSlateGray!10},
columns=fullflexible,
includerangemarker=false,
mathescape,
escapechar=\⠶,
rangeprefix=\/\*\#\ ,
rangesuffix=\ \#\*\/,
literate={^-1}{\ensuremath{{}^{-1}}}1 {'}{\rq}1 ,
emph={solver,ndof,l2,linfty, mpiMAX, mpiCommWorld, mpirank, P0, P1, P2, Pk, mpisize, verbosity, mpirank, true, false, x, y, z, processor},
emphstyle=\tt,
morekeywords={real, int1d, int2d, int3d, varf, on, func, matrix, fespace, mesh, mesh3, interpolate, resize, set, macro, dx, dy, dz, square, mpiRequest, Isend, Irecv, mpiWaitAny, mpiAllReduce, mpiComm, sqrt} % if you want to add more keywords to the set
}
\lstset{prebreak=\raisebox{0ex}[0ex][0ex]
{\ensuremath{\hookleftarrow}}}
\lstset{postbreak=\raisebox{0ex}[0ex][0ex]
{\ensuremath{\hookrightarrow\space}}}
% FIN NE PAS TOUCHER
\newcommand{\ds}{\displaystyle}
\usepackage{xspace}
\newcommand{\geneo}{GenEO\xspace}
\newcommand{\asupprimer}[1]{}