source: doc/theses/colby_parsons_MMAth/style/cfa-format.tex @ 561354f

ADT
Last change on this file since 561354f was e41c4c6, checked in by caparsons <caparson@…>, 19 months ago

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

  • Property mode set to 100644
File size: 3.7 KB
Line 
1\usepackage[usenames,dvipsnames]{xcolor}
2\usepackage{listings}
3\usepackage{inconsolata}
4
5\definecolor{basicCol}{HTML}{000000}
6\definecolor{commentCol}{HTML}{000000}
7\definecolor{stringCol}{HTML}{000000}
8\definecolor{keywordCol}{HTML}{000000}
9\definecolor{identifierCol}{HTML}{000000}
10
11\lstdefinestyle{defaultStyle}{
12  escapeinside={@@},
13%   basicstyle=\linespread{0.9}\tt\footnotesize,                % reduce line spacing and use typewriter font
14  basicstyle=\linespread{0.9}\sf,               % reduce line spacing and use typewriter
15%   keywordstyle=\bfseries\color{blue},
16%   keywordstyle=[2]\bfseries\color{Plum},
17%   commentstyle=\itshape\color{OliveGreen},                % green and italic comments
18%   identifierstyle=\color{identifierCol},
19%   stringstyle=\sf\color{Mahogany},                              % use sanserif font
20  stringstyle=\tt,                                % use sanserif font
21  mathescape=true,
22%   columns=fixed,
23  columns=fullflexible,
24%   aboveskip=4pt,                                  % spacing above/below code block
25%   belowskip=3pt,
26  keepspaces=true,
27  tabsize=4,
28  % frame=lines,
29  literate=,
30  showlines=true,                                 % show blank lines at end of code
31  showspaces=false,
32  showstringspaces=false,
33  escapechar=\$,
34  xleftmargin=\parindentlnth,                     % indent code to paragraph indentation
35  moredelim=[is][\color{red}\bfseries]{**R**}{**R**},    % red highlighting
36  % moredelim=* detects keywords, comments, strings, and other delimiters and applies their formatting
37  % moredelim=** allows cumulative application
38}
39
40\lstdefinestyle{cfaStyle}{
41  escapeinside={@@},
42%  basicstyle=\linespread{0.9}\tt\footnotesize,         % reduce line spacing and use typewriter font
43  basicstyle=\linespread{0.9}\sf,               % reduce line spacing and use typewriter font
44%  keywordstyle=\bfseries\color{blue},
45%  keywordstyle=[2]\bfseries\color{Plum},
46%  commentstyle=\sf\itshape\color{OliveGreen},            % green and italic comments
47%  identifierstyle=\color{identifierCol},
48%  stringstyle=\sf\color{Mahogany},                               % use sanserif font
49  stringstyle=\tt,                                % use sanserif font
50  mathescape=true,
51%  columns=fixed,
52  columns=fullflexible,
53%  aboveskip=4pt,                                  % spacing above/below code block
54%  belowskip=3pt,
55  keepspaces=true,
56  tabsize=4,
57  % frame=lines,
58  literate=,
59  showlines=true,                                 % show blank lines at end of code
60  showspaces=false,
61  showstringspaces=false,
62  showlines=true,                                                       % show blank lines at end of code
63  escapechar=\$,
64  xleftmargin=\parindentlnth,                     % indent code to paragraph indentation
65  moredelim=[is][\color{red}\bfseries]{**R**}{**R**},    % red highlighting
66  morekeywords=[2]{accept, signal, signal_block, wait, waitfor, waituntil},
67  abovecaptionskip=5pt,
68}
69
70\lstnewenvironment{ccode}[1][]{
71  \lstset{
72    language = C,
73    style=defaultStyle,
74    captionpos=b,
75    #1
76  }
77}{}
78
79\lstnewenvironment{cfacode}[1][]{
80  \lstset{
81    language = CFA,
82    style=cfaStyle,
83    captionpos=b,
84    #1
85  }
86}{}
87
88\lstnewenvironment{cppcode}[1][]{
89  \lstset{
90    language = c++,
91    style=defaultStyle,
92    captionpos=b,
93    #1
94  }
95}{}
96
97\lstnewenvironment{ucppcode}[1][]{
98  \lstset{
99    language = c++,
100    style=defaultStyle,
101    captionpos=b,
102    #1
103  }
104}{}
105
106\lstnewenvironment{javacode}[1][]{
107  \lstset{
108    language = java,
109    style=defaultStyle,
110    captionpos=b,
111    #1
112  }
113}{}
114
115\lstnewenvironment{gocode}[1][]{
116  \lstset{
117    language = Golang,
118    style=defaultStyle,
119    captionpos=b,
120    #1
121  }
122}{}
123
124\newcommand{\zero}{\lstinline{zero_t}\xspace}
125\newcommand{\one}{\lstinline{one_t}\xspace}
126\newcommand{\ateq}{\lstinline{\@=}\xspace}
127\newcommand{\code}[1]{\lstinline[language=CFA,style=cfaStyle]{#1}}
128\newcommand{\pscode}[1]{\lstinline[language=pseudo,style=pseudoStyle]{#1}}
Note: See TracBrowser for help on using the repository browser.