source: doc/theses/andrew_beach_MMath/cfalab.sty @ 5d2db68

ADTarm-ehast-experimentalenumforall-pointer-decayjacob/cs343-translationnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change on this file since 5d2db68 was c72ea7a, checked in by Andrew Beach <ajbeach@…>, 5 years ago

ABMM thesis: Lots of context reworking. Took out Peter's formating and put back parts that I understood and used.

  • Property mode set to 100644
File size: 3.2 KB
Line 
1% Package for CFA Research Lab.
2%
3% Made by combining and updating various macro files people had made.
4%
5% Internal commands are prefixed with "\cfalab@".
6
7% I don't know what the oldest LaTeX2e version with everything needed is.
8\NeedsTeXFormat{LaTeX2e}
9\ProvidesPackage{cfalab}[2020/03/24 v0.1 CFA Laboratory LaTeX Tools]
10
11% Other packages required.
12\RequirePackage{etoolbox}
13\RequirePackage{listings}
14\RequirePackage{xspace}
15
16% Symbols: All symbols are zero argument robust commands with special rules
17% about the space following the c.s. token. Normally the space might be
18% re-added according to the rules of the xspace package. They may be followed
19% by a star (which the command will consume) to disable this behaviour.
20
21% \newsymbolcmd{<command>}{<replacement text>}
22%     Defines <command> to be a symbol that has the given <replacement text>.
23\newrobustcmd*\newsymbolcmd[2]{\newrobustcmd{#1}{\cfalab@symbol{#2}}}
24\def\cfalab@symbol#1{\@ifnextchar*{#1\cfalab@eatstar}{#1\xspace}}
25\def\cfalab@eatstar*{}
26
27% Cforall with the forall symbol.
28\newsymbolcmd\CFA{\textsf{C}\raisebox{\depth}{\rotatebox{180}{\textsf{A}}}}
29
30% The CFA listings language. Based off of ANCI C and including GCC extensions.
31% The UW dialect is the default (and only so far) dialect of the language.
32\lstdefinelanguage[UW]{CFA}[ANSI]{C}{
33    morekeywords={_Alignas, _Alignof, __alignof, __alignof__, asm, __asm,
34        __asm__, __attribute, __attribute__, auto, _Bool, catch, catchResume,
35        choose, _Complex, __complex, __complex__, __const, __const__,
36        coroutine, disable, dtype, enable, exception, __extension__,
37        fallthrough, fallthru, finally, __float80, float80, __float128,
38        float128, forall, ftype, generator, _Generic, _Imaginary, __imag,
39        __imag__, inline, __inline, __inline__, __int128, int128, __label__,
40        monitor, mutex, _Noreturn, one_t, or, otype, restrict, resume,
41        __restrict, __restrict__, __signed, __signed__, _Static_assert,
42        suspend, thread, _Thread_local, throw, throwResume, timeout, trait,
43        try, ttype, typeof, __typeof, __typeof__, virtual, __volatile,
44        __volatile__, waitfor, when, with, zero_t
45    },
46    moredirectives={defined,include_next},
47}
48\lstset{defaultdialect={[UW]CFA}}
49
50% The cfalab style defines some common settings useful in different languages.
51\lstdefinestyle{cfalab}{%
52    columns=fullflexible,
53    basicstyle=\linespread{0.9}\tt,
54    stringstyle=\tt,
55}
56
57% \code*[<escape character>]{<code>}
58%     Use the listings package to format a snipit of <code>.
59%     The <escape character> must be a character that does not appear in
60%     <code> and defaults to a backtick.
61\newcommand*\codeC[2][\`]{\lstinline[language=C]#1#2#1}
62\newcommand*\codeCFA[2][\`]{\lstinline[language=CFA]#1#2#1}
63
64% \settextunderscore{(new|old)}
65%     Redefines the underscore either as a new repersentation or the old one.
66%     Not that some other packages (ex. hyperref) can override this. Set it
67%     up after loading them.
68\let\cfalab@textunderscore@old=\textunderscore
69\newcommand\cfalab@textunderscore@new{%
70    \leavevmode\makebox[1.2ex][c]{\rule{1ex}{0.075ex}}}
71\newcommand\settextunderscore[1]{%
72    \renewcommand\textunderscore{\csuse{cfalab@textunderscore@#1}}}
73
74\endinput
Note: See TracBrowser for help on using the repository browser.