-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlocalmacros.sty
More file actions
186 lines (154 loc) · 6.2 KB
/
Copy pathlocalmacros.sty
File metadata and controls
186 lines (154 loc) · 6.2 KB
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
% These should ALWAYS be the top commands
\newif\ifdraft
\newif\ifcomments
\newif\ifurls
\newif\ifmisc
\newif\ifcodestyles
%%%% Configuration options %%%%
% DRAFT controls if we should warn about comments/todos and other draft features
\drafttrue
% COMMENTS allows you to disable all comments (not TODOs), useful for passing off to a friend to review
\commentstrue
% MISC stuff is modifying mostly safe things, but may need to disable
\misctrue
% CODESTYLES are safe, and just enable nice formatting and listings
\codestylestrue
% URLS are safe, and just let URLS break way better
\urlstrue
%%%% end config options %%%%
% render comments only if enabled, warn if we aren't in draft mode
\newcommand\draftcomment[1]{\ifdraft{} \ifcomments{} #1 \fi \else{} \ifcomments{} {\large COMMENTINRELEASE: #1} \fi{} \fi{}}
% All authors should get a macro here
\newcommand{\david}[1]{{\footnotesize\color{teal}\draftcomment{[David: #1]}}}
% These are for when doing manual tricks to get within page limit.
% If you are actually adding permanent spacing, don't use.
% These are generally bad. Use only when absolutely necessary.
\newcommand\spacehacksfig[1]{\vspace{#1}}
\newcommand\spacehackstext[1]{\vspace{#1}}
% Put paper specific abbrevs here
\newcommand\ssec[1]{\subsubsection{\bf #1}}
\newcommand\tech[1]{$\mathsf{#1}$}
\newcommand\todo[1]{\textcolor{red}{\ifdraft{} TODO:#1 \else {\large TODOINRELEASE: #1} \fi{}}}
% ----------------- Below here are less modifiable bits ---------------------
% Macros for comments, draft mode bits, etc
\ifdraft
\usepackage{datetime}
\usepackage{fancyhdr}
\fancyfoot[C]{\thepage}
%\fancyfoot5A[R]{\textcolor{red}{\bfseries\currenttime\ \today}}
\renewcommand\headrulewidth{0pt}
\renewcommand\footrulewidth{0pt}
\fi
\hyphenation{white-list}
\let\oldnl\nl% Store \nl in \oldnl
\newcommand{\nonl}{\renewcommand{\nl}{\let\nl\oldnl}}% Remove line number for one line
% MISC stuff is modifying mostly safe things, but may need to disable
\ifmisc
% load \bit and \byte units in < 3.0 versions of siunitx:
\sisetup{binary-units=true}
% use text font for unit labels:
\sisetup{detect-all}
%% Older alternative style
%% \hypersetup{
%% colorlinks=true,
%% linkcolor=blue,
%% filecolor=magenta,
%% urlcolor=cyan,
%% }
\hypersetup{
colorlinks=true,
linkcolor=black,
filecolor=black,
urlcolor=blue,
pdfpagemode=FullScreen,
}
\urlstyle{same}
% taken from hs's mary.tex, and tracing back to knuth.
\def\dash---{\kern.16667em---\penalty\exhyphenpenalty\hskip.16667em\relax}
% Alter some LaTeX defaults for better treatment of figures:
% See p.105 of "TeX Unbound" for suggested values.
% See pp. 199-200 of Lamport's "LaTeX" book for details.
% General parameters, for ALL pages:
\renewcommand{\topfraction}{0.9} % max fraction of floats at top
\renewcommand{\bottomfraction}{0.8} % max fraction of floats at bottom
% Parameters for TEXT pages (not float pages):
\setcounter{topnumber}{2}
\setcounter{bottomnumber}{4}
\setcounter{totalnumber}{6} % 2 may work better
\setcounter{dbltopnumber}{2} % for 2-column pages
\renewcommand{\dbltopfraction}{0.9} % fit big float above 2-col. text
\renewcommand{\textfraction}{0.07} % allow minimal text w. figs
% Parameters for FLOAT pages (not text pages):
\renewcommand{\floatpagefraction}{0.8} % require fuller float pages
% N.B.: floatpagefraction MUST be less than topfraction !!
\renewcommand{\dblfloatpagefraction}{0.8} % require fuller float pages
% this modifies the spacing around verbatim
\makeatletter
\preto{\@verbatim}{\topsep=1pt \partopsep=1pt }
\makeatother
\fi
% CODESTYLES are safe, and just enable nice formatting and listings
\ifcodestyles
% have inline listings use typewriter font and be delimited by |...|
\lstMakeShortInline[basicstyle=\ttfamily,breaklines=true]|
% C++ macro from john mitchell
\def\CC{C\raise.22ex\hbox{{\footnotesize +}}\raise.22ex\hbox{\footnotesize +}\xspace}
\lstset{frame=tb,
language=C,
%aboveskip=3mm,
%belowskip=3mm,
numbers=left,
stepnumber=1,
xleftmargin=1cm,xrightmargin=-1cm,numbersep=2pt,
showstringspaces=false,
columns=flexible,
escapechar=|,mathescape,
basicstyle={\normalsize\ttfamily},
numberstyle=\tiny\color{gray},
keywordstyle=\color{blue},
commentstyle=\color{green},
stringstyle=\color{mauve},
breaklines=true,
morekeywords={impIf},
breakatwhitespace=true,
tabsize=3,
frame=none,
moredelim=**[is][\color{ForestGreen}]{@}{@}
}
% Support cool highlighting boxes in lstlisting (from
% http://tex.stackexchange.com/questions/15237/highlight-text-in-code-listing-while-also-keeping-syntax-highlighting)
\makeatletter
\newenvironment{btHighlight}[1][]
{\begingroup\tikzset{bt@Highlight@par/.style={#1}}\begin{lrbox}{\@tempboxa}}
{\end{lrbox}\bt@HL@box[bt@Highlight@par]{\@tempboxa}\endgroup}
\newcommand\btHL[1][]{%
\begin{btHighlight}[#1]\bgroup\aftergroup\bt@HL@endenv%
}
\def\bt@HL@endenv{%
\end{btHighlight}%
\egroup
}
\newcommand{\bt@HL@box}[2][]{%
\tikz[#1]{%
\pgfpathrectangle{\pgfpoint{1pt}{0pt}}{\pgfpoint{\wd #2}{\ht #2}}%
\pgfusepath{use as bounding box}%
\node[anchor=base west, fill=orange!30,outer sep=0pt,inner xsep=1pt, inner ysep=0pt, rounded corners=3pt, minimum height=\ht\strutbox+1pt,#1]{\raisebox{1pt}{\strut}\strut\usebox{#2}};
}%
}
\lstdefinestyle{Chighlight}{
language={C},basicstyle=\ttfamily,
moredelim=**[is][\btHL]{`}{`},
moredelim=**[is][{\btHL[fill=green!30,draw=red,dashed,thin]}]{@}{@},
}
\makeatother
\fi
% URLS are safe, and just let URLS break way better
\ifurls
% Make URLs linebreak better (hat-tip alexras)
% A sequence of BigBreaks will be treated as one break, so it will only be able to break after ://
\renewcommand{\UrlBigBreaks}{\do\:\do\/}
% (Less aggressive) Treat both / and - as breakable characters (don't know why this does something different than hyphens in the package declaration, but it does)
\renewcommand{\UrlBreaks}{\do\/\do\-}
% (More aggressive) Any letter and / are treated as breakable characters
\renewcommand{\UrlBreaks}{\do\/\do\a\do\b\do\c\do\d\do\e\do\f\do\g\do\h\do\i\do\j\do\k\do\l\do\m\do\n\do\o\do\p\do\q\do\r\do\s\do\t\do\u\do\v\do\w\do\x\do\y\do\z\do\A\do\B\do\C\do\D\do\E\do\F\do\G\do\H\do\I\do\J\do\K\do\L\do\M\do\N\do\O\do\P\do\Q\do\R\do\S\do\T\do\U\do\V\do\W\do\X\do\Y\do\Z}
\fi