Changeset 2d8a770 for doc/theses/andrew_beach_MMath/cfalab.sty
- Timestamp:
- Apr 29, 2021, 11:00:18 AM (3 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 3eb55f98
- Parents:
- 3ec79f7 (diff), a6c45c6 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/theses/andrew_beach_MMath/cfalab.sty
r3ec79f7 r2d8a770 10 10 11 11 % Other packages required. 12 % 13 % Access to new basic LaTeX tools and other low level commands. 12 14 \RequirePackage{etoolbox} 15 % Code formatting tools and environments. 13 16 \RequirePackage{listings} 17 % Automatically adds spaces. 14 18 \RequirePackage{xspace} 19 % Improved reference tools. 20 \RequirePackage[nospace]{varioref} 15 21 16 22 % Symbols: All symbols are zero argument robust commands with special rules … … 20 26 21 27 % \newsymbolcmd{<command>}{<replacement text>} 22 % 28 % Defines <command> to be a symbol that has the given <replacement text>. 23 29 \newrobustcmd*\newsymbolcmd[2]{\newrobustcmd{#1}{\cfalab@symbol{#2}}} 24 30 \def\cfalab@symbol#1{\@ifnextchar*{#1\cfalab@eatstar}{#1\xspace}} … … 28 34 \newsymbolcmd\CFA{\textsf{C}\raisebox{\depth}{\rotatebox{180}{\textsf{A}}}} 29 35 % C++ with kerning. (No standard number support.) 30 \newsymbolcmd\C PP{\textrm{C}\kern-.1em\hbox{+\kern-.25em+}}36 \newsymbolcmd\Cpp{\textrm{C}\kern-.1em\hbox{+\kern-.25em+}} 31 37 32 % This is executed very early in the \begin{document} code. 38 % This is executed very early in the \begin{document} code, before the 39 % document's contents but after packages are loaded. 33 40 \AtEndPreamble{ 34 41 \@ifpackageloaded{hyperref}{ … … 36 43 \pdfstringdefDisableCommands{ 37 44 \def\CFA{CFA} 38 \def\CPP{C++} 45 \def\Cpp{C++} 46 \def\lstinline{} 39 47 } 40 48 }{} 41 49 } 50 51 % \colour{<colour>}{<text>} 52 % Just \color but using the LaTeX style instead of TeX style command. 53 \newcommand*\colour[2]{{\color{#1}#2}} 54 55 % \code*{<code>} 56 % Use the listings package to format a snipit of <code>. 57 \newrobustcmd*\codeCFA[1]{\lstinline[language=CFA]{#1}} 58 \newrobustcmd*\codeC[1]{\lstinline[language=C]{#1}} 59 \newrobustcmd*\codeCpp[1]{\lstinline[language=C++]{#1}} 60 \newrobustcmd*\codePy[1]{\lstinline[language=Python]{#1}} 61 62 % Use the listings package to format a block of CFA code. 63 % Extra listings options can be passed in as an optional argument. 64 \lstnewenvironment{cfa}[1][]{\lstset{language=CFA}\lstset{#1}}{} 65 66 % \settextunderscore{(new|old)} 67 % Redefines the underscore either as a new repersentation or the old one. 68 % Not that some other packages (ex. hyperref) can override this. Set it up 69 % after loading them. 70 \let\cfalab@textunderscore@old=\textunderscore 71 \newcommand\cfalab@textunderscore@new{% 72 \leavevmode\makebox[1.2ex][c]{\rule{1ex}{0.075ex}}} 73 \newcommand\settextunderscore[1]{% 74 \renewcommand\textunderscore{\csuse{cfalab@textunderscore@#1}}} 42 75 43 76 % The CFA listings language. Based off of ANCI C and including GCC extensions. … … 61 94 \lstset{defaultdialect={[UW]CFA}} 62 95 63 % The cfalab style defines some common settings useful in different languages. 64 \lstdefinestyle{cfalab}{% 65 columns=fullflexible, 66 basicstyle=\linespread{0.9}\tt, 67 stringstyle=\tt, 96 % Create an internal paragraph indent amount. This is used internally to 97 % mimic the standard indent even when it has been overriden in the document. 98 \newlength\cfalab@parindent 99 \deflength\cfalab@parindent{\parindent} 100 101 % The cfacommon style has many useful defaults for CFA and other types of 102 % code. Use the listings option "style=cfacommon" to load them. 103 \lstdefinestyle{cfacommon}{ 104 columns=fullflexible, 105 basicstyle=\linespread{0.9}\sf, 106 stringstyle=\tt, 107 tabsize=5, 108 % Indent code to paragraph indentation. 109 xleftmargin=\cfalab@parindent, 110 % Allow ASCII characters in the range 128-255. 111 extendedchars=true, 112 % This allows you to use "math mode" to insert LaTeX into the code. 113 % Use \( and \) if you need to insert math mode inside that code. 114 escapechar=\$, 115 % Disable LaTeX math escape in CFA code $...$ 116 mathescape=false, 117 keepspaces=true, 118 % Do not show spaces with cup. 119 showstringspaces=false, 120 % Show blank lines at end of code. 121 showlines=true, 122 % Spacing above/below code block. 123 aboveskip=4pt,belowskip=0pt, 124 numberstyle=\footnotesize\sf, 125 % Replace/adjust listing characters that look bad in sanserif. 126 literate={-}{\makebox[1ex][c]{\raisebox{0.4ex}{\rule{0.75ex}{0.1ex}}}}1 127 {^}{\raisebox{0.6ex}{$\scriptscriptstyle\land\,$}}1 128 {~}{\raisebox{0.3ex}{$\scriptstyle\sim\,$}}1 {`}{\ttfamily\upshape\hspace*{-0.1ex}`}1 129 {<-}{$\leftarrow$}2 {=>}{$\Rightarrow$}2 130 {->}{\makebox[1ex][c]{\raisebox{0.4ex}{\rule{0.8ex}{0.075ex}}}\kern-0.2ex\textgreater}2, 68 131 } 69 132 70 % \code*[<escape character>]{<code>} 71 % Use the listings package to format a snipit of <code>. 72 % The <escape character> must be a character that does not appear in 73 % <code> and defaults to a backtick. 74 \newcommand*\codeC[2][\`]{\lstinline[language=C]#1#2#1} 75 \newcommand*\codeCFA[2][\`]{\lstinline[language=CFA]#1#2#1} 133 % common.tex Compatablity =================================================== 134 % Below this line is for compatability with the old common.tex file. 76 135 77 % \settextunderscore{(new|old)} 78 % Redefines the underscore either as a new repersentation or the old one. 79 % Not that some other packages (ex. hyperref) can override this. Set it 80 % up after loading them. 81 \let\cfalab@textunderscore@old=\textunderscore 82 \newcommand\cfalab@textunderscore@new{% 83 \leavevmode\makebox[1.2ex][c]{\rule{1ex}{0.075ex}}} 84 \newcommand\settextunderscore[1]{% 85 \renewcommand\textunderscore{\csuse{cfalab@textunderscore@#1}}} 136 % Backwards compatable way to activate the cfacommon style. 137 \newcommand{\CFAStyle}{\lstset{style=cfacommon}} 138 139 % A couple of abbreviations are provided. Just ones someone liked. 140 % 141 % Abbreviation formatting commands (renew to customize): 142 \newcommand{\abbrevFont}{\textit} 143 % 144 % Abbreviations that, if not followed by a comma or colon, add a comma. 145 \newrobustcmd*\cfalab@abbrev@comma{% 146 \@ifnextchar{,}{}{\@ifnextchar{:}{}{,\xspace}}} 147 \providerobustcmd*\eg{\abbrevFont{e}.\abbrevFont{g}.\cfalab@abbrev@comma} 148 \providerobustcmd*\ie{\abbrevFont{i}.\abbrevFont{e}.\cfalab@abbrev@comma} 149 % 150 % Abbreviations that, if not followed by a period, add a period. 151 \newrobustcmd*\cfalab@abbrev@period{\@ifnextchar{.}{}{.\xspace}} 152 \providerobustcmd*\etc{\abbrevFont{etc}\cfalab@abbrev@period} 153 \providerobustcmd*\etal{\abbrevFont{et}~\abbrevFont{al}\cfalab@abbrev@period} 154 \providerobustcmd*\viz{\abbrevFont{viz}\cfalab@abbrev@period} 86 155 87 156 \endinput
Note: See TracChangeset
for help on using the changeset viewer.