Debian Codegraph @

texmf-dist/doc/latex/memoir/memsty.sty

raw
1 %% memsty.sty For memman
2 \ProvidesPackage{memsty}[2010/02/09 for memman]
3
4 %%%%\usepackage{desc}% temporary, until code added to memoir itself
5
6 %%\usepackage{layouts}[2001/04/29]
7 %%\usepackage{verbatim}
8 %%\usepackage{glossit}
9 %\usepackage{etex}
10 \usepackage{layouts}[2001/04/29]
11 \usepackage{url}
12 \usepackage{fixltx2e}
13 \usepackage{alltt}
14 \usepackage{graphicx}
15 \usepackage{xcolor}
16 \usepackage{latexsym}
17 \usepackage{memfonts}
18 \usepackage{pifont}
19 \usepackage{amsmath}
20 \usepackage[T1]{fontenc}
21 \usepackage{xurl}
22
23
24 \providecommand{\LMnote}[2]{}
25 \providecommand{\PWnote}[2]{}
26
27 \newcommand\Added[1]{\sidepar{\tiny Added #1}}
28 \newcommand\ToBeRemoved[1]{\sidepar{\tiny To be removed #1}}
29
30 %%%%%%%%%%%%%%%%%%% kill scale change warning in layouts
31 \renewcommand*{\setlayoutscale}[1]{\setlength{\l@youtunitlength}{1pt}
32 \l@youtunitlength= #1\l@youtunitlength
33 \renewcommand*{\l@youtscale}{#1}}
34
35 %%%%%%%%%%%%%%%%%% plainmarkruled pagestyle
36 \makepagestyle{plainmarkruled}
37 \makeheadrule{plainmarkruled}{\textwidth}{\normalrulethickness}
38 \makeevenhead{plainmarkruled}{\scshape\leftmark}{}{}
39 \makeoddhead{plainmarkruled}{}{}{\scshape\rightmark}
40 \makeevenfoot{plainmarkruled}{\thepage}{}{}
41 \makeoddfoot{plainmarkruled}{}{}{\thepage}
42 \makepsmarks{plainmarkruled}{\@ruledmarks}
43
44
45
46 %%%%%%%%%%%%%%%%%% index pagestyle
47 \makepagestyle{index}
48 \makeheadrule{index}{\textwidth}{\normalrulethickness}
49 \makeevenhead{index}{\rightmark}{}{\leftmark}
50 \makeoddhead{index}{\rightmark}{}{\leftmark}
51 \makeevenfoot{index}{\thepage}{}{}
52 \makeoddfoot{index}{}{}{\thepage}
53
54 \makeindex
55 %\showindexmarktrue
56
57 %%%%%%%%%%%%%%%%%%%%%%% glossary
58 \makeglossary
59 \changeglossactual{?}
60 \changeglossnum{\@currentlabel}
61 \changeglossnum{\thepage}
62 \changeglossnumformat{|hyperpage} %|
63 \renewcommand*{\glossaryname}{Command summary}
64 \renewcommand{\glossitem}[4]{%
65 \sbox\@tempboxa{#1 \space #2 #3 \makebox[2em]{#4}}%
66 \par\hangindent 2em
67 \ifdim\wd\@tempboxa<0.8\linewidth
68 #1 \space #2 #3 \dotfill \makebox[2em][r]{#4}\relax
69 \else
70 #1 \dotfill \makebox[2em][r]{#4}\\
71 #2 #3
72 \fi}
73 \renewcommand*{\glossarymark}{\markboth{\glossaryname}{\glossaryname}}
74
75 %%%%%%%%%%%%%%%%%%%%%%%%%%%% endnotes
76 \makepagenote
77 \notepageref% use page numbers
78 \newcommand*{\notemark}{\markboth{\notesname}{\notesname}}
79 \renewcommand*{\notedivision}{\chapter{\notesname}\notemark}
80 \renewcommand*{\notenumintext}[1]{}% no number marks in main text
81 \renewcommand*{\notenuminnotes}[1]{}% no number marks in listing
82 \renewcommand*{\idtextinnotes}[1]{\vspace{-0.5\onelineskip}
83 \par [#1]\space}
84 \renewcommand*{\notemark}{\markboth{{\scshape \notesname}}{{\scshape \notesname}}}
85 \renewcommand*{\pagenotesubhead}[3]{%
86 \section{#1 #2 #3}}
87 %%\renewcommand*{\notemark}{\markboth{\notesname}{\notesname}}
88
89 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
90 %%%% Short and long ToC
91
92 \newcommand*{\setupshorttoc}{%
93 \renewcommand*{\contentsname}{Short contents}
94 \let\oldchangetocdepth\changetocdepth
95 \let\oldprecistoctext\precistoctext
96 \renewcommand{\precistoctext}[1]{}
97 \let\oldcftchapterfillnum\cftchapterfillnum
98 \let\oldcftchapterformatpnum\cftchapterformatpnum
99 \renewcommand*{\changetocdepth}[1]{}
100 \setcounter{tocdepth}{0}% chapters
101 \renewcommand*{\cftchapterfont}{\hfill\sffamily}
102 \renewcommand*{\cftchapterpagefont}{\normalfont}
103 \renewcommand*{\cftchapterleader}{ \textperiodcentered\space}
104 \renewcommand*{\cftchapterafterpnum}{\cftparfillskip}
105 %% \setpnumwidth{0em}
106 %% \setpnumwidth{1.5em}
107 % \renewcommand*{\cftchapterfillnum}[1]{%
108 % {\cftchapterleader}\nobreak
109 % \hbox to 2.5em{\cftchapterpagefont
110 % ##1\hfil}\cftchapterafterpnum\par}
111 % make the box left aligned not right aliged
112 \renewcommand*{\cftchapterformatpnum}[1]{%
113 \cftchapterformatpnumhook{##1}%
114 \hb@xt@\@pnumwidth{\cftchapterpagefont ##1\hfil}}
115 \setrmarg{0.3\textwidth}
116 % \setpnumwidth{6em}
117 \setlength{\unitlength}{\@tocrmarg}
118 \addtolength{\unitlength}{1.5em}
119 \let\oldcftpartformatpnum\cftpartformatpnum
120 \renewcommand*{\cftpartformatpnum}[1]{%
121 \hbox to\unitlength{{\cftpartpagefont ##1}}}
122 \let\oldcftbookformatpnum\cftbookformatpnum
123 \renewcommand*{\cftbookformatpnum}[1]{%
124 \hbox to\unitlength{{\cftbookpagefont ##1}}}}
125
126
127 \newcommand*{\setupparasubsecs}{%
128 \let\oldnumberline\numberline%
129 \renewcommand*{\cftsubsectionfont}{\itshape}%
130 \renewcommand*{\cftsubsectionpagefont}{\itshape}%
131 \renewcommand{\l@subsection}[2]{%
132 \ifnum\c@tocdepth > 1\relax%
133 \def\numberline####1{\textit{####1}~}%
134 \leftskip=\cftsubsectionindent%
135 \rightskip=\@tocrmarg%
136 %% \advance\rightskip 0pt plus \hsize % uncomment this for raggedright
137 %% \advance\rightskip 0pt plus 2em % uncomment this for semi-ragged
138 \parfillskip=\fill%
139 \ifhmode ,\ \else\noindent\fi%
140 \ignorespaces%
141 {\cftsubsectionfont ##1}~{\cftsubsectionpagefont##2}%
142 \let\numberline\oldnumberline\ignorespaces%
143 \fi}}
144
145
146 \AtEndDocument{\addtocontents{toc}{\par}}%%% OK
147
148
149 \newcommand*{\setupmaintoc}{%
150 \renewcommand{\contentsname}{Contents}
151 \let\changetocdepth\oldchangetocdepth
152 \let\precistoctext\oldprecistoctext
153 \let\cftchapterfillnum\oldcftchapterfillnum
154 \let\cftchapterformatpnum\oldcftchapterformatpnum
155 % \addtodef{\cftchapterbreak}{\par}{}
156 \pretocmd\cftchapterbreak\par
157 \renewcommand*{\cftchapterfont}{\normalfont\sffamily}
158 \renewcommand*{\cftchapterleader}{\sffamily\cftdotfill{\cftchapterdotsep}}
159 \renewcommand*{\cftchapterafterpnum}{}
160 %\renewcommand{\cftchapterbreak}{\par\addpenalty{-\@highpenalty}}
161 \setpnumwidth{2.55em}
162 \setrmarg{3.55em}
163 \setcounter{tocdepth}{2}
164 \let\cftpartformatpnum\oldcftpartformatpnum
165 %\addtodef{\cftpartbreak}{\par}{}
166 \pretocmd\cftpartbreak\par
167 \let\cftbookformatpnum\oldcftbookformatpnum
168 % \addtodef{\cftbookbreak}{\par}{}
169 \pretocmd\cftbookbreak\par
170 }
171
172 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
173
174 \usepackage{graphicx}
175 \ifpdf
176 \usepackage[pdftex,
177 plainpages=false,
178 pdfpagelabels,
179 %%% hyperfootnotes=false,
180 bookmarksnumbered,
181 colorlinks,
182 % ocgcolorlinks, % this only works for pdflatex
183 ]{hyperref}
184 \DeclareGraphicsRule{*}{mps}{*}{}
185 \else
186 \usepackage[plainpages=false,
187 pdfpagelabels,
188 %%% hyperfootnotes=false,
189 bookmarksnumbered,
190 breaklinks,
191 % colorlinks,
192 ]{hyperref}
193 \usepackage{breakurl}
194 \DeclareGraphicsRule{*}{eps}{*}{}
195 \fi
196 %%% \usepackage{memhfixc} %% now called by hyperref
197
198
199 % this is a lillt special, using this one can change the link colors
200 % in the manual to blacnmk without changing any file, just use
201 %
202 % pdflatex "\def\MEMOIRblacklinks{}\input{memman.tex}"
203 %
204 \@ifundefined{MEMOIRblacklinks}{%
205 \definecolor{linkcolour}{rgb}{0,0.2,0.6}
206 \definecolor{citecolour}{rgb}{0,0.6,0.2}
207 % \definecolor{filecolor}{rgb}{0,0.2,0.6}
208 \definecolor{urlcolour} {rgb}{0.8,0,0.8}
209 }{%
210 \typeout{Asked for black links, so that is what you are going to get}
211 \definecolor{linkcolour}{rgb}{0,0,0}
212 \definecolor{citecolour}{rgb}{0,0,0}
213 % \definecolor{filecolor}{rgb}{0,0,0}
214 \definecolor{urlcolour} {rgb}{0,0,0}
215 \hypersetup{colorlinks}
216 }
217 \hypersetup{
218 pdftitle={The memoir class},
219 pdfauthor={Peter Wilson, maintained by Lars Madsen},
220 linkcolor=linkcolour,citecolor=citecolour,
221 filecolor=urlcolour,urlcolor=urlcolour,
222 }
223
224 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
225
226 %%%%% Logos
227 \providecommand*{\tx}{TeX}
228 \providecommand*{\txbook}{\tx book}
229 \providecommand*{\ltx}{La\tx}
230 \providecommand*{\ltxe}{\ltx2e}
231 \providecommand*{\pdfltx}{pdf\ltx}
232 \providecommand*{\ixpdfltx}{\index{pdfLaTeX?\pdfltx}}
233 \providecommand*{\pixpdfltx}{\pdfltx\ixpdfltx} % print & index pdfLaTeX
234 \providecommand*{\etx}{\texttt{etex}}
235 \providecommand*{\ixetx}{\index{etex?\etx}}
236 \providecommand*{\pixetx}{\etx\ixetx} % print & index etex
237 \providecommand*{\xetx}{Xe\tx}
238 \providecommand*{\luatx}{Lua\tx}
239
240 \providecommand*{\ixxetx}{\index{XeTeX?\xetx}}
241 \providecommand*{\pixxetx}{\xetx\ixxetx} % print & index XeTeX
242 \providecommand*{\TeXUG}{\tx{} Users Group}
243 \providecommand*{\tug}{\textsc{tug}}
244 \providecommand*{\ixtug}{\index{TUG?\tug}}
245 \providecommand*{\pixtug}{\tug\ixtug} % print & index TUG
246
247 \providecommand*{\cTeXan}{Comprehensive \tx{} Archive Network}
248 \providecommand*{\ctan}{\textsc{ctan}} % print CTAN
249 \providecommand*{\ixctan}{\index{CTAN?\ctan}} % index CTAN
250 \providecommand*{\pixctan}{\ctan\ixctan} % print & index CTAN
251
252 \newcommand*{\ctt}{\textsc{ctt}} % print CTT
253 \newcommand*{\ixctt}{\index{ctt?\ctt}} % index CTT
254 \newcommand*{\pixctt}{\ctt\ixctt} % print & index CTT
255 \newcommand*{\prtoc}{ToC} % print ToC
256 \newcommand*{\prlof}{LoF} % print LoF
257 \newcommand*{\prlot}{LoT} % print LoT
258 \newcommand*{\ixtoc}{\index{ToC}} % index ToC
259 \newcommand*{\ixlof}{\index{LoF}} % index LoF
260 \newcommand*{\ixlot}{\index{LoT}} % index LoT
261 \newcommand*{\toc}{\prtoc\ixtoc} % print & index ToC
262 \newcommand*{\lof}{\prlof\ixlof} % print & index LoF
263 \newcommand*{\lot}{\prlot\ixlot} % print & index LoT
264 \newcommand*{\prfrontmatter}{front matter} % macros for frontmatter
265 \newcommand*{\prFrontmatter}{Front matter}
266 \newcommand*{\ixfrontmatter}{\index{front matter?\prfrontmatter}}
267 \newcommand*{\pixfrontmatter}{\prfrontmatter\ixfrontmatter}
268 \newcommand*{\pixFrontmatter}{\prFrontmatter\ixfrontmatter}
269 \newcommand*{\prmainmatter}{main matter} % macros for mainmatter
270 \newcommand*{\prMainmatter}{Main matter}
271 \newcommand*{\ixmainmatter}{\index{main matter?\prmainmatter}}
272 \newcommand*{\pixmainmatter}{\prmainmatter\ixmainmatter}
273 \newcommand*{\pixMainmatter}{\prMainmatter\ixmainmatter}
274 \newcommand*{\prbackmatter}{back matter} % macros for backmatter
275 \newcommand*{\prBackmatter}{Back matter}
276 \newcommand*{\ixbackmatter}{\index{back matter?\prbackmatter}}
277 \newcommand*{\pixbackmatter}{\prbackmatter\ixbackmatter}
278 \newcommand*{\pixBackmatter}{\prBackmatter\ixbackmatter}
279
280 %%%%%%%% from Typo
281 \providecommand*{\alltx}{(La)\tx}
282 \providecommand*{\metafont}{Metafont}
283 \providecommand*{\pscript}{Post\-Script}
284 \providecommand*{\ixpscript}{\pscript\index{PostScript}}
285 \providecommand*{\pdf}{PDF}
286 \providecommand*{\pixpdf}{\pdf\index{PDF}}
287 %\providecommand*{\prog}[1]{\Prog{#1}}
288 %\providecommand*{\ixprog}[1]{\index{#1 program?\prog{#1} program}%
289 % \index{program!#1?\prog{#1}}}
290 %\providecommand*{\pixprog}[1]{\prog{#1}\ixprog{#1}}
291 %%\providecommand*{\ctt}{\texttt{ctt}}
292 %%\providecommand*{\ixtx}{\index{TeX?\tx}}
293 %%\providecommand*{\pixtx}{\tx\ixtx}
294 %%\providecommand*{\ixltx}{\index{LaTeX?\ltx}}
295 %%\providecommand*{\pixltx}{\ltx\ixltx}
296
297 \newcommand*{\theclass}{memoir}
298
299 %%% Print and Index macros
300 \newcommand*{\noidxnum}[1]{}
301
302 %% index @ in macrocode
303 \newcommand*{\idxatincode}{\index{@?\texttt{@}!in macro code}}
304 \newcommand*{\seeatincode}{see \Sref{sec:alltexcommands}}
305
306 % index marking
307 \newcommand{\idxmark}[1]{#1\markboth{#1}{#1}}
308 %%%% index sup/sub and sub \indexsupsubmain{main}{sub}
309 \newcommand*{\indexsupsubmain}[2]{\index{#1!#2}\index{#2}}
310 %%%% index pair of sup/sub items
311 \newcommand*{\indextwo}[2]{\index{#1!#2}\index{#2!#1}}
312 %%% index pair of sup/sub/sub
313 \newcommand*{\indexthree}[3]{\index{#1!#2!#3}\index{#2!#1!#3}}
314
315 %%% \typesubidx{sub} -> \index{type!sub} Index a type subitem
316 \newcommand*{\typesubidx}[1]{\index{type!#1}}
317 %%% \seeonceidx{main}{sub} %% index main (see sub), and index sub
318 \newcommand*{\seeonceidx}[2]{%
319 \@ifundefined{s1#2s1}%
320 {\global\@namedef{s1#2s1}{?!?}\index{#1!#2|see{#2}}\index{#2}}% %|
321 {\index{#2}}}
322 %%% \facesubseeidx{sub} %% index typeface (see sub), and index sub
323 \newcommand*{\facesubseeidx}[1]{\seeonceidx{typeface}{#1}}
324 \newcommand*{\Pfontfam}[1]{\texttt{#1}} % print name of a fontfamily
325 \newcommand*{\pfontfam}[1]{\Pfontfam{#1}%
326 \index{#1 fontfam?\Pfontfam{#1} (fontfamily)}%
327 \index{fontfamily!#1?\Pfontfam{#1}}} % print/index fontfamily
328
329 \newcommand*{\Ppstyle}[1]{\textsl{#1}}
330 \newcommand*{\pstyle}[1]{\Ppstyle{#1}%
331 \index{#1 pages?\Ppstyle{#1} (pagestyle)}%
332 \index{pagestyle!#1?\Ppstyle{#1}}} % pagestyle
333 \newcommand*{\Pcstyle}[1]{\textsl{#1}}
334 \newcommand*{\cstyle}[1]{\Pcstyle{#1}%
335 \index{#1 chaps?\Pcstyle{#1} (chapterstyle)}%
336 \index{chapterstyle!#1?\Pcstyle{#1}}} % chapterstyle
337 \newcommand*{\Phstyle}[1]{\textsl{#1}}
338 \newcommand*{\hstyle}[1]{\Phstyle{#1}%
339 \index{#1 heads?\Phstyle{#1} (headstyles)}%
340 \index{headstyles!#1?\Phstyle{#1}}} % headstyles
341 \newcommand*{\Pclass}[1]{\textsf{#1}}
342 \newcommand*{\Lclass}[1]{\Pclass{#1}%
343 \index{#1 class?\Pclass{#1} (class)}%
344 \index{class!#1?\Pclass{#1}}} % class name
345 \newcommand*{\Iclasssub}[2]{\index{#1 class?\Pclass{#1} (class)!#2}}
346 \newcommand*{\Mname}{\Pclass{memoir}} % Print memoir
347 \newcommand*{\Ppack}[1]{\textsf{#1}}
348 \newcommand*{\Lpack}[1]{\Ppack{#1}%
349 \index{#1 pack?\Ppack{#1} (package)}%
350 \index{package!#1?\Ppack{#1}}} % package name
351 \newcommand*{\Popt}[1]{\textsf{#1}}
352 \newcommand*{\Lopt}[1]{\Popt{#1}%
353 \index{#1 opt?\Popt{#1} (option)}%
354 \index{option!#1?\Popt{#1}}} % option name
355 \newcommand*{\Pe}[1]{\texttt{#1}} % print env name
356 %%% 2009/12/19 added \ixenv & changed \Ie to use it
357 \newcommand*{\ixenv}[1]{\index{#1 env?\Pe{#1} (environment)}% index env
358 \index{environment!#1?\Pe{#1}}}
359 \newcommand*{\Ie}[1]{\Pe{#1}\ixenv{#1}} % print & index env
360 \newcommand*{\Pcn}[1]{\texttt{#1}} % print counter name
361 \newcommand*{\Icn}[1]{\texttt{#1}\index{#1 cou?\Pcn{#1} (counter)}%
362 \index{counter!#1?\Pcn{#1}}}
363 \newcommand*{\Itt}[1]{\texttt{#1}\index{#1tt?\texttt{#1}}}
364 \newcommand*{\file}[1]{\texttt{#1}} % print a file name
365 \newcommand*{\ixfile}[1]{% % index a file name
366 \index{#1 file?\file{#1} (file)}%
367 \index{file!#1?\file{#1}}}
368 \newcommand*{\pixfile}[1]{\file{#1}\ixfile{#1}} % print & index a file name
369 % print and index a length
370 \newcommand*{\lnc}[1]{\cmdprint{#1}%
371 \index{\expandafter\@gobble\string#1len?\string\cmdprint{\string#1} (length)}%
372 \index{length!\expandafter\@gobble\string#1len?\string\cmdprint{\string#1}}}
373
374 \newcommand*{\posarg}[1]{\textsf{#1}} % print positioning argument
375 % index a positioning argument
376 \newcommand*{\ixposarg}[1]{%
377 \index{#1 (position argument)?\posarg{#1} (position argument)}}
378 % print and index a positioning argument
379 \newcommand*{\pixposarg}[1]{\posarg{#1}\ixposarg{#1}}
380
381 % print and index a counter representation
382 \newcommand*{\pcrep}[1]{\texttt{#1}}
383 \newcommand*{\ixcrep}[1]{\index{#1 tt?\pcrep{#1}}%
384 \index{counter representation!#1 tt?\pcrep{#1}}}
385 \newcommand*{\Icrep}[1]{\texttt{#1}\index{#1 tt?\texttt{#1}}}% % counter representation
386 \renewcommand*{\Icrep}[1]{\pcrep{#1}\ixcrep{#1}}% % print & index counter rep
387 \newcommand*{\pixcrep}[1]{\pcrep{#1}\ixcrep{#1}} % print & index counter rep
388
389 % print (and index) TeX keywords
390 \newcommand*{\pkey}[1]{\texttt{#1}} % TeX keywords
391 \newcommand*{\pixkey}[1]{\pkey{#1}\index{#1 key?\pkey{#1} (keyword)}%
392 \index{keyword!#1?\pkey{#1}}}
393
394 \newcommand*{\patexp}{@-expression} % print @-expression
395 \newcommand*{\ixatexp}{%
396 \index{@-expression?\patexp}} % index @-expression
397 \newcommand*{\pixatexp}{\patexp\ixatexp} % print & index @-expression
398
399 \newcommand*{\Pprog}[1]{\textsf{#1}} % print program name
400 \newcommand*{\Iprog}[1]{\index{#1 prog?\Pprog{#1} (program)}%
401 \index{program!#1?\Pprog{#1}}} % index program name
402 \newcommand*{\Iprogsub}[2]{\index{#1 prog?\Pprog{#1} (program)!#2}}
403 \newcommand*{\Lprog}[1]{\Pprog{#1}\Iprog{#1}} % print & index program name
404 \DeclareRobustCommand{\Pmakeindex}{\Pprog{MakeIndex}}
405 \DeclareRobustCommand{\Imakeindex}{\Iprog{MakeIndex}}
406 \DeclareRobustCommand{\Lmakeindex}{\Lprog{MakeIndex}}
407 \DeclareRobustCommand{\Pbibtex}{\Pprog{BibTeX}}
408 \DeclareRobustCommand{\Ibibtex}{\Iprog{BibTeX}}
409 \DeclareRobustCommand{\Lbibtex}{\Lprog{BibTeX}}
410
411 % print and index an \if... \piif{if...}
412 \newcommand*{\piif}[1]{\cs{#1}\index{#1?\cs{#1}}}
413
414 % index command \!
415 \newcommand*{\iexcl}{\index{"!?\cs{!}}}
416 % print and index \!
417 \newcommand*{\pixabang}{\cmdprint{\!}\index{"!?\string\cs{}\texttt{"!}}}
418 % print and index \\!
419 \newcommand*{\pixslashbang}{\cmdprint{\\!}\index{"\"\"!?\string\cmdprint{\\}\texttt{"!}}}
420
421 \DeclareRobustCommand{\senv}[1]{\texttt{\bs begin\{#1\}}} % print \begin{env}
422 \DeclareRobustCommand{\eenv}[1]{\texttt{\bs end\{#1\}}} % print \end{env}
423
424 \newcommand*{\listofx}{`List of\ldots'}
425
426 \newcommand*{\Note}{\textbf{NOTE:}}
427
428 \newcommand*{\ptrue}{\texttt{true}} % print TRUE
429 \newcommand*{\pfalse}{\texttt{false}} % print FALSE
430 \DeclareRobustCommand{\btitle}[1]{\textit{#1}} % print a book/article/etc title
431
432
433 %%% numbers
434 \let\Mfrac\slashfrac
435 \newcommand*{\ratio}[2]{{\ensuremath #1 \raise0.2ex\hbox{:} #2}}% or perhaps 0.15ex
436 \providecommand*{\abyb}[2]{\ensuremath{#1 \times #2}} % e.g., 3 x 4
437 % \providecommand*{\abybm}[3]{\ensuremath{#1 \times #2}\:#3} % e.g., 3 x 4 cm
438 % todo: use siunitx
439 \providecommand*{\abybm}[3]{\ensuremath{#1}\,#3\ensuremath{{}\times #2}\,#3} % e.g., 3 x 4 cm
440 \providecommand*{\atob}[2]{\ensuremath{#1\!:\!#2}} % e.g., 3:4
441
442
443 \DeclareRobustCommand*{\lb}{\texttt{\char`\{}} % prints {
444 \DeclareRobustCommand*{\rb}{\texttt{\char`\}}} % prints }
445
446 %% A couple of shorthands
447 \newcommand*{\tmri}{\mathrm{i}}
448 \newcommand*{\tmrx}{\mathrm{x}}
449
450 \newcommand*{\foredge}{fore-edge}
451 \newlength{\pwlayi}\setlength{\pwlayi}{0.45\textwidth} %
452 \newlength{\pwlayii}\setlength{\pwlayii}{0.45\pwlayi}
453
454 \DeclareRobustCommand{\Vprint}[1]{\texttt{\string#1}}
455
456 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% stuff for demoing fonts
457 \DeclareFontFamily{T1}{bodoni}{}
458 \DeclareFontShape{T1}{bodoni}{m}{n}{ <-> bodonirg9a }{}
459 %% \usethisfont[encoding]{size}{baselineskip}{family}{series}{shape}
460 \newcommand*{\usethisfont}[6][T1]{%
461 \fontencoding{#1}\fontsize{#2}{#3}\fontfamily{#4}\fontseries{#5}%
462 \fontshape{#6}\selectfont}
463 \newcommand*{\termfont}[3]{%
464 \usethisfont{25}{30}{#1}{#2}{#3}}
465 \newcommand*{\UCalphabet}{A B C D E F G H I J K L M N O P Q R S T U V W X Y Z \&}
466 \newcommand*{\LCalphabet}{a b c d e f g h i j k l m n o p q r s t u v w x y z
467 1 2 3 4 5 6 7 8 9 0 ! ? fi fl}
468 \newcommand*{\fox}{It was a dark and stormy night.
469 While all the good men were coming to the aid of the
470 party, the quick brown dog had jumped over the fast red fox
471 to its great surprise. The cattle had wound slowly
472 o'er the lea and I was in the dark.}
473 \newcommand*{\Kafka}{`But aren't Kafka's Schlo{\ss} and {\AE}sop's
474 {\OE}uvres often na{\"\i}ve vis-\`a-vis the d{\ae}monic ph{\oe}nix's
475 official r\^ole in fluffy souffl\'es?' }
476 \newcommand*{\namesAZ}{ {\AA}ngel\aa\ Beatrice Claire
477 Diana \'Erica Fran\c{c}oise Ginette H\'el\`ene Iris
478 Jackie K\=aren {\L}au\.ra Mar{\'\i}a N\H{a}ta{\l}{\u\i}e {\O}ctave
479 Pauline Qu\^eneau Roxanne Sabine
480 %% T\~a{\'\j}a
481 T\~aja
482 Ur\v{s}ula Vivian Wendy Xanthippe Yv{\o}nne Z\"azilie }
483
484
485
486 %% sans label for labelled list
487 \newcommand*{\sflabel}[1]{\hspace\labelsep \normalfont\sffamily #1}
488 %% italic label for labelled list
489 \newcommand*{\itlabel}[1]{\hspace\labelsep \normalfont\itshape #1}
490
491
492 %%%%%% stuff for new LaTeX code environment
493
494 % \zeroseps sets list before/after skips to minimum values
495 \newcommand*{\@zeroseps}{\setlength{\topsep}{\z@}
496 \setlength{\partopsep}{\z@}
497 \setlength{\parskip}{\z@}}
498 \newlength{\gparindent} \setlength{\gparindent}{\parindent}
499 \setlength{\gparindent}{0.5\parindent}
500 % now we can do the new environment. This has no extra before/after
501 % spacing.
502 % \LMnote{2010/06/09}{Experimenting with a bit of space before and
503 % after, looks a bit better}
504 \newenvironment{lcode}{\@zeroseps
505 \nopagebreak
506 \vskip0.4em plus 0.1em minus 0.2em
507 \renewcommand{\verbatim@startline}{\verbatim@line{\hskip\gparindent}}
508 \small\setlength{\baselineskip}{\onelineskip}\verbatim}%
509 {\endverbatim
510 \vspace{-\baselineskip}
511 \vskip0.6em plus 0.1em minus 0.2em
512 \noindent}
513
514 %%%%% LaTeX syntax
515 %%%% control space above/below center environment
516 \newcommand*{\tightcenter}{%
517 \topsep=0.25\onelineskip\trivlist \centering\item\relax}
518 \def\endtightcenter{\endtrivlist}
519 \LMnote{2010/06/25}{Added a \cs{crcr} here, a bit of a trick, but now
520 the last line in syntax does not longer need to end with \\}
521 \newenvironment{syntax}{\begin{tightcenter}
522 \begin{tabular}{|p{0.9\linewidth}|} \hline}%
523 {\crcr\hline
524 \end{tabular}
525 \end{tightcenter}}
526
527 %%%%% for demoing chapterstyles
528 \newcommand*{\chaptext}[1]{The above is a demonstration of the \textit{#1}
529 chapterstyle. It is one of several styles that come as part of the
530 \Pclass{memoir} class.}
531
532 %%%\renewcommand*{\theHchapter}{\thesheetsequence.\arabic{chapter}}
533
534 \newcount\savechapcnt
535 \newcount\demochapcnt
536 \newcount\saveseccnt
537 \newcount\savesubseccnt
538 \demochapcnt=0
539 %%\newcommand*{\theHc@demochapcnt}{\thefigure.\arabic{\c@demochapcnt}}
540 \newcount\savefigcnt
541 \newcount\saveftncnt
542 \newcommand*{\demochapcolor}{\definecolor{shadecolor}{gray}{0.75}}
543 \LMnote{2011/05/25}{I've moved the demochaps to an appendix, so
544 \cs{@chapapp} need a little redoing}
545 \newenvironment{demochap}[2][\onelineskip]{%
546 % \typeout{Chapter value going in: \thechapter}
547 \savechapcnt=\c@chapter
548 \saveseccnt=\c@section
549 \savesubseccnt=\c@subsection
550 \saveftncnt=\c@footnote
551 \c@chapter=\demochapcnt
552 %% \stepcounter{demochapcnt}
553 \counterwithout*{figure}{chapter}
554 \begin{figure}[htbp]
555 %%% \definecolor{shadecolor}{gray}{0.75}
556 \demochapcolor
557 \begin{shaded}
558 \savefigcnt=\c@figure
559 \begingroup
560 %% \hrule
561 \let\@chapapp\chaptername% such that appendix does not disturb
562 % \renewcommand{\theHchapter}{\thepage.\thechapter.showcase}
563 \renewcommand\thechapter{\arabic{chapter}}
564 \vspace*{#1}
565 \chapterstyle{#2}
566 \let\clearforchapter\relax
567 \let\insertchapterspace\relax
568 \renewcommand*{\addcontentsline}[3]{}
569 \renewcommand*{\thispagestyle}[1]{}
570 \renewcommand*{\markboth}[2]{}
571 \let\refstepcounter\stepcounter
572 \chapter{Demonstration of the #2 chapter style}
573 \chaptext{#2}
574 \vspace{\onelineskip}
575 \hrule
576 \endgroup
577 \end{shaded}
578 \global\demochapcnt=\c@chapter
579 \ifnum\demochapcnt>9\relax
580 \global\demochapcnt=0\relax
581 \fi
582 \c@chapter=\savechapcnt
583 % \advance\c@chapter\m@ne
584 % \renewcommand{\theHchapter}{\thepage.\thechapter-\the\demochapcnt.\thesheetsequence.showcase}
585 % \refstepcounter{chapter}%
586 % \stepcounter{chapter}
587 \begin{center}
588 \caption{The #2 chapterstyle}\label{dc#2}
589 \end{center}
590 \savefigcnt=\c@figure
591 \global\advance\savefigcnt\m@ne
592 %% \gdef\theHchapter{\thefigure.\thechapter}
593 }{%\gdef\theHchapter{\thechapter}
594 \end{figure}
595 \counterwithin{figure}{chapter}
596 \global\c@chapter=\savechapcnt
597 \global\c@section=\saveseccnt
598 \global\c@subsection=\savesubseccnt
599 \global\c@footnote=\saveftncnt}
600
601 \newenvironment{demochap*}[2][\onelineskip]{
602 \let\DCcaption\caption
603 \renewcommand\caption[1]{\DCcaption{##1. This style requires the
604 \Lpack{graphicx} package}}
605 \begin{demochap}[#1]{#2}}{\end{demochap}}
606
607
608 %%% comma separated in-line items
609 \let\litemize\itemize \let\endlitemize\enditemize
610 \renewenvironment{litemize}{\renewcommand{\item}{\unskip, }}{}
611 \newenvironment{lineitems}{\litemize\renewcommand{\item}{\unskip, }}%
612 {\endlitemize\unskip }
613
614 %% typeset stuff in a box
615 \newdimen\showbinset
616 \newcommand{\showit}[1]{%
617 \setlength{\showbinset}{\linewidth}%
618 \addtolength{\showbinset}{-2\fboxsep}%
619 \addtolength{\showbinset}{-2\fboxrule}%
620 \par\vspace{0.5\onelineskip}\noindent
621 \fbox{\parbox{\showbinset}{{#1}}\vspace{0.5\onelineskip}}}
622
623 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% VERSALS
624
625 % Save file as: DROP.STY Source: [email protected]
626 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
627 % DROP.DOC <February 17, 1988>
628 % Macro for dropping and enlarging the first letter(s) of a paragraph.
629 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
630 %
631 % Macro written by David G. Cantor, and published Fri, 12 Feb 88, in
632 % TeXhax, 1988 #16.
633 % Internet: [email protected]
634 % UUCP: ...!{ihnp4, randvax, sdcrdcf, ucbvax}!ucla-cs!dgc
635 %
636 % Modified for use with LaTeX by Dominik Wujastyk, February 17, 1988
637 % Internet: [email protected]
638 % Bitnet: [email protected]
639 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
640 %
641 % This LaTeX macro is for dropping and enlarging the first letter(s) of a
642 % paragraph. The argument may be one or more letters.
643 %
644 % Here is an example of its usage:
645 %
646 % \documentstyle[drop]{article}
647 % \begin{document}
648 % \drop{IN} THE beginning God created the heaven and the earth. Now the
649 % earth was unformed and void, and darkness was upon the face of the
650 % deep; and the spirit of God hovered over the face of the waters.
651 % \end{document}
652 %
653 % Which will produce something along these lines:
654 %
655 % I I\ I THE beginning God created the heaven and the earth.
656 % I I \ I Now the earth was unformed and void, and darkness was
657 % I I \I upon the face of the deep; and the spirit of God hov-
658 % ered over the face of the waters.
659 %
660 % In the first instance the macro will pause during LaTeX processing and
661 % ask you for the font you wish to use for you drop capital. When you
662 % have something that looks good, then comment out box one in DROP.STY,
663 % and comment in box two, replacing "cmr10 scaled \magstep5" with the font
664 % of your choice.
665 %
666 % In my opinion (DW) there are no fonts available in the standard
667 % TeX/LaTeX set that are ideal for this use, unless you go down to 9pt or
668 % 8pt for your text face, and this is too small. If you have Metafont you
669 % should consider generating a cmr17 font at a magstep of two (about 25pt)
670 % or three (about 30pt), or even more, depending on the point size of your
671 % main text. Why not go the whole hog and design some really fancy
672 % capitals from scratch!
673 %
674 %%%%%%%%%%%%%%%%%%%%% BOX ONE %%%%%%%%%%%%%%%%%%%%%%%%%
675 %\typein[\dropinitialfont]{Font for Dropped initial:} %
676 %\font\largefont \dropinitialfont %
677 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
678 %
679 %%%%%%%%%%%%%%%%%%%%% BOX TWO %%%%%%%%%%%%%%%%%%%%%%%%%
680 %\font\largefont= cmr10 scaled \magstep5 %
681 %\font\largefont= cmbx10 scaled \magstep5 %
682 %\font\largefont= cmbx17 scaled \magstep3 %
683 \font\largefont= cmr17 scaled \magstep5 %
684 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
685
686 % \def\drop#1#2{{\noindent
687 % \setbox0\hbox{\largefont #1}\setbox1\hbox{#2}\setbox2\hbox{(}%
688 % \count0=\ht0\advance\count0 by\dp0\count1\baselineskip
689 % \advance\count0 by-\ht1\advance\count0by\ht2
690 % \dimen1=.5ex\advance\count0by\dimen1\divide\count0 by\count1
691 % \advance\count0 by1\dimen0\wd0
692 % \advance\dimen0 by.25em\dimen1=\ht0\advance\dimen1 by-\ht1
693 % \global\hangindent\dimen0\global\hangafter-\count0
694 % \hskip-\dimen0\setbox0\hbox to\dimen0{\raise-\dimen1\box0\hss}%
695 % \dp0=0in\ht0=0in\box0}#2}
696
697 % end of DROP.STY
698 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
699
700 % \newcommand{\versal}[1]{{\noindent
701 % \setbox0\hbox{\largefont #1}%
702 % \count0=\ht0 % height of versal
703 % \count1=\baselineskip % baselineskip
704 % \divide\count0 by \count1 % versal height/baselineskip
705 % \dimen1 = \count0\baselineskip % distance to drop versal
706 % \advance\count0 by 1\relax % no of indented lines
707 % \dimen0=\wd0 % width of versal
708 % \global\hangindent\dimen0 % set indentation distance
709 % \global\hangafter-\count0 % set no of indented lines
710 % \hskip-\dimen0\setbox0\hbox to\dimen0{\raise-\dimen1\box0\hss}%
711 % \dp0=0in\ht0=0in\box0}}
712
713 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% END VERSALS
714
715
716 \newlength{\gparskip} \setlength{\gparskip}{\parskip}
717
718 % \typeout{Defining listeg, egsource, egresult, etc}
719 % is used
720 \newenvironment{listeg}{%
721 \list{}{%
722 \listparindent\z@
723 \itemindent\listparindent
724 \parsep\z@
725 \leftmargin\gparindent
726 \rightmargin\leftmargin}
727 \item\relax}{\endlist}
728
729 %%% pair with egresult
730 % \begin{egsource}{label}
731 \newcommand*{\egsourcecolor}{\definecolor{shadecolor}{gray}{0.9}}
732 \newenvironment{egsource}[1]{%
733 \parskip\z@ \topsep\z@%
734 \egsourcecolor
735 \shaded
736 \listeg\centerline{Source for \eref*{#1}}%\label{#1}
737 \vspace{\onelineskip}
738 \small\setlength{\baselineskip}{\onelineskip}\nobreak\verbatim}%
739 {\endverbatim\endlisteg\endshaded}%\vskip\onelineskip\noindent}
740
741 %%\newcommand*{\captegsource}{Source for example}
742 %%\newfloat[chapter]{tegsource}{los}{\captegresult}
743 %%\newcommand*{\listegsourcesname}{List of source code examples}
744 %%\newlistof{listofegsources}{los}{\listegsourcesname}
745 %%\newlistentry[chapter]{tegsource}{los}{0}
746
747 %%\renewenvironment{egsource}[1]{%
748 %%\tegsource
749 %% \parskip\z@ \topsep\z@%
750 %% \egsourcecolor
751 %% \shaded
752 %% \listeg\centerline{Source for example~\ref{#1}}%\
753 %% \vspace{\onelineskip}
754 %% \small\setlength{\baselineskip}{\onelineskip}\nobreak\verbatim}%
755 %% {\endverbatim\endlisteg\endshaded%}
756 %%\endtegsource}
757
758
759 \newcommand*{\Hline}{\mbox{}\hrulefill\mbox{}} % line across the page
760
761
762
763
764 \newcommand*{\shadecodecolor}{\definecolor{shadecolor}{gray}{0.93}}
765 \newenvironment{shadecode}{\@zeroseps
766 \shadecodecolor
767 \renewcommand{\verbatim@startline}{\verbatim@line{\hskip\gparindent}}
768 \shaded
769 \small\setlength{\baselineskip}{\onelineskip}\verbatim}%
770 {\endverbatim
771 \vspace{-\baselineskip}%
772 \endshaded
773 \noindent}
774
775 \newenvironment{typeseteg}{%
776 \list{}{%
777 \listparindent\gparindent
778 \itemindent\listparindent
779 \parsep\gparskip
780 \leftmargin\gparindent
781 \rightmargin\leftmargin}
782 \item\relax}{\endlist}
783
784 \newcommand*{\captegresult}{Typeset Example}
785 \newfloat[chapter]{tegresult}{loe}{\captegresult}
786 \newcommand*{\listegresultsname}{List of typeset examples}
787 \newlistof{listofegresults}{loe}{\listegresultsname}
788 \newlistentry[chapter]{tegresult}{loe}{0}
789
790 \newcommand*{\egresultcolor}{\definecolor{shadecolor}{gray}{0.9}}
791 %%% pair with egsource
792 % \begin{egresult}[caption]{label}
793 \newenvironment{egresult}[2][]{%
794 \begin{tegresult}
795 \egresultcolor
796 \begin{shaded}
797 \caption{#1}\label{#2}
798 \vspace{-0.75\onelineskip}
799 \Hline
800 \begin{typeseteg}}%
801 {\end{typeseteg}%
802 \vspace{-0.5\onelineskip}
803 \Hline
804 \end{shaded}
805 \end{tegresult}}
806
807 \newenvironment{egresultplain}[2][]{%
808 \begin{tegresult}
809 \egresultcolor
810 \begin{shaded}
811 \caption{#1}\label{#2}
812 \begin{typeseteg}}%
813 {\end{typeseteg}%
814 \end{shaded}
815 \end{tegresult}}
816
817 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
818
819 %% More stuff for showing examples
820
821 \newcommand*{\egstart}[1][0pt]{\par\begingroup
822 \begin{adjustwidth}{-#1}{-#1}%
823 \centering
824 \begin{minipage}{0.45\linewidth}}
825 \newcommand*{\egmid}{%
826 \end{minipage}\hfill\begin{minipage}{0.45\linewidth}}
827 \newcommand*{\egend}{%
828 \end{minipage}\end{adjustwidth}\endgroup\par}
829
830 \newoutputstream{egout}
831 \openoutputfile{\jobname.ego}{egout}
832
833 \newcommand*{\shadefigurecolor}{\definecolor{shadecolor}{gray}{0.75}}
834 \newenvironment{shadefigure}{%
835 \begin{figure}
836 \centering
837 \shadefigurecolor
838 \begin{shaded}}%
839 {\end{shaded}\end{figure}}
840
841 \newcommand*{\shadetablecolor}{\definecolor{shadecolor}{gray}{0.75}}
842 \newenvironment{shadetable}{%
843 \begin{table}
844 \centering
845 \shadetablecolor
846 \begin{shaded}}%
847 {\end{shaded}\end{table}}
848
849 %%%%% Option, etc description list
850 \newenvironment{plainlist}%
851 {\list{}{\labelwidth\z@ \itemindent-\leftmargin
852 \let\makelabel\plainlistlabel}}%
853 {\endlist}
854 \newcommand*{\plainlistlabel}[1]{\hspace\labelsep
855 \normalfont #1}
856
857
858 \DeclareRobustCommand{\ls}[1]{\texttt{\char`\\#1} (length)}
859
860 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
861 %%%%%%%%%%%% FROM TITLEPAGES.TEX
862
863 %%%%%% for FontSite fonts
864 \newcommand*{\FSfont}[1]{%
865 \fontfamily{#1}\selectfont}
866 %%%%% for `standard' LaTeX fonts
867 \newcommand*{\LXfont}[1]{%
868 \fontfamily{#1}\selectfont}
869
870 \newcommand*{\boxminipage}{%
871 \@ifnextchar [%]
872 \@ibxminipage
873 {\@iiibxminipage c\relax[s]}}
874 \def\@ibxminipage[#1]{%
875 \@ifnextchar [%]
876 {\@iibxminipage{#1}}%
877 {\@iiibxminipage{#1}\relax[s]}}
878 \def\@iibxminipage#1[#2]{%
879 \@ifnextchar [%]
880 {\@iiibxminipage{#1}{#2}}%
881 {\@iiibxminipage{#1}{#2}[#1]}}
882 \let\@bxminto\@empty
883 \def\@iiibxminipage#1#2[#3]#4{%
884 \ifx\relax#2\else
885 \setlength\@tempdimb{#2}%
886 \def\@bxminto{to\@tempdimb}%
887 \fi
888 \leavevmode
889 \@pboxswfalse
890 \if #1b\vbox
891 \else
892 \if #1t\vtop
893 \else
894 \ifmmode \vcenter
895 \else \@pboxswtrue $\vcenter
896 \fi
897 \fi
898 \fi
899 % \@bxminto
900 \bgroup% outermost vbox
901 \hsize #4
902 \hrule\@height\fboxrule
903 \hbox\bgroup% inner hbox
904 \vrule\@width\fboxrule \hskip\fboxsep
905 \vbox \@bxminto
906 \bgroup% innermost vbox
907 \vskip\fboxsep
908 \advance\hsize -2\fboxrule \advance\hsize -2\fboxsep
909 \textwidth\hsize \columnwidth\hsize
910 \@parboxrestore
911 \def\@mpfn{mpfootnote}\def\thempfn{\thempfootnote}\c@mpfootnote\z@
912 \let\@footnotetext\@mpfootnotetext
913 \let\@listdepth\@mplistdepth \@mplistdepth\z@
914 \@minipagerestore\@minipagetrue
915 \everypar{\global\@minipagefalse\everypar{}}}
916
917 \def\endboxminipage{%
918 \par\vskip-\lastskip
919 \ifvoid\@mpfootins\else
920 \vskip\skip\@mpfootins\footnoterule\unvbox\@mpfootins\fi
921 \vskip\fboxsep
922 \egroup% end innermost vbox
923 \hskip\fboxsep \vrule\@width\fboxrule
924 \egroup% end hbox
925 \hrule\@height\fboxrule
926 \egroup% end outermost vbox
927 \if@pboxsw $\fi}
928
929 \newlength{\tpheight}\setlength{\tpheight}{0.9\textheight}
930 \newlength{\txtheight}\setlength{\txtheight}{0.9\tpheight}
931 \newlength{\tpwidth}\setlength{\tpwidth}{0.9\textwidth}
932 \newlength{\txtwidth}\setlength{\txtwidth}{0.9\tpwidth}
933 \newlength{\tdrop} % (already defined)
934
935 \newenvironment{showtitle}{%
936 \begin{boxminipage}[c][\tpheight]{\tpwidth}
937 \centering\begin{vplace}\begin{minipage}[c][\txtheight]{\txtwidth}}%
938 {\end{minipage}\end{vplace}\end{boxminipage}}
939
940 \definecolor{Dark}{gray}{.2}
941 \definecolor{Medium}{gray}{.6}
942 \definecolor{Light}{gray}{.8}
943
944 \newcommand*{\plogo}{\fbox{$\mathcal{PL}$}}
945
946 %%%%%%%%%%%%%%%%%%
947
948
949 %%%%%%%%% section head designs
950 \newcommand*{\defaultsecheads}{
951 \setsecheadstyle{\normalfont\Large\bfseries\raggedright}
952 \setsecindent{0pt}
953 \setbeforesecskip{-3.5ex plus -1ex minus -.2ex}
954 \setaftersecskip{2.3ex plus .2ex}
955 \setsubsecheadstyle{\normalfont\large\bfseries\raggedright}
956 \setsubsecindent{0pt}
957 \setbeforesubsecskip{-3.25ex plus -1ex minus -.2ex}
958 \setaftersubsecskip{1.5ex plus .2ex}
959 \setsubsubsecheadstyle{\normalfont\bfseries\raggedright}
960 \setsubsubsecindent{0pt}
961 \setbeforesubsubsecskip{-3.25ex plus -1ex minus -.2ex}
962 \setaftersubsubsecskip{1.5ex plus .2ex}
963 \setparaheadstyle{\normalfont\bfseries}
964 \setparaindent{0pt}
965 \setbeforeparaskip{3.25ex plus 1ex minus .2ex}
966 \setafterparaskip{-1em}
967 \setsubparaheadstyle{\normalfont\bfseries}
968 \setsubparaindent{0pt}
969 \setbeforesubparaskip{3.25ex plus 1ex minus .2ex}
970 \setaftersubparaskip{-1em}
971 }
972
973 %%%%%%%%%%%%%% Manual layout and design elements
974
975 \newcommand*{\memmansecheads}{
976 \setsecheadstyle{\normalfont\scshape\raggedright}
977 \setsecindent{0pt}
978 \setbeforesecskip{-1.333\onelineskip plus -0.5\onelineskip minus -0.5\onelineskip}
979 \setaftersecskip{.667\onelineskip plus 0.1\onelineskip}
980 %%% surround = 2 lines (1.333/.667)
981 %%% surround = 1 line (.667/.333)
982 \setsubsecheadstyle{\normalfont\sffamily\raggedright}
983 \setsubsecindent{0pt}
984 \setbeforesubsecskip{-.667\onelineskip plus -0.5\onelineskip minus -0.5\onelineskip}
985 \setaftersubsecskip{0.333\onelineskip plus 0.1\onelineskip}
986 %%% surround = 1 line (.667/.333)
987 \setsubsubsecheadstyle{\normalfont\itshape\raggedright}
988 \setsubsubsecindent{0pt}
989 \setbeforesubsubsecskip{-0.667\onelineskip plus -0.25\onelineskip minus -0.25\onelineskip}
990 \setaftersubsubsecskip{0.333\onelineskip plus 0.1\onelineskip}
991 %%% no surround
992 \setparaheadstyle{\normalfont\sffamily}
993 \setparaindent{0pt}
994 \setbeforeparaskip{1.0\onelineskip plus 0.5\onelineskip minus 0.25\onelineskip}
995 \setafterparaskip{-1em}
996 \setsubparaheadstyle{\normalfont\sffamily}
997 \setsubparaindent{0pt}
998 \setbeforesubparaskip{1.0\onelineskip plus 0.5\onelineskip minus 0.25\onelineskip}
999 \setaftersubparaskip{-1em}
1000 }
1001
1002
1003 %%%%%% hypermarks in index
1004 % from email from Lars Madsen
1005 \providecommand{\doidxbookmark}[1]{{\def\@tempa{Symbols}\def\@tempb{#1}%
1006 \centering\bfseries \ifx\@tempa\@tempb @ \else #1\fi\vskip\onelineskip\par}}
1007 % extended to add booksmarks for each letter group.
1008 \renewcommand{\doidxbookmark}[1]{{%
1009 \def\@tempa{Symbols}\def\@tempb{#1}%
1010 \centering\bfseries
1011 \MakeLinkTarget[index]{}%
1012 \ifx\@tempa\@tempb%
1013 Non letters
1014 \pdfbookmark[0]{Non letters}{NonLetters-idx}%
1015 % \label{NonLettersNonLettersNonLetters-idx}%
1016 \else
1017 #1%
1018 \pdfbookmark[0]{#1}{#1-idx}%
1019 % \label{#1#1#1-idx}%
1020 \fi%
1021 \vskip\onelineskip\par}}
1022
1023 \ExplSyntaxOn
1024 \RenewDocumentCommand\doidxbookmark{m}
1025 {{
1026 \centering\bfseries
1027 \MakeLinkTarget[index]{}
1028 \str_if_eq:nnTF{#1}{Symbols}
1029 {
1030 Non~letters
1031 \pdfbookmark[0]{Non~letters}{NonLetters-idx}%
1032 }
1033 {
1034 #1%
1035 \pdfbookmark[0]{#1}{#1-idx}%
1036 }
1037 \vskip\onelineskip\par
1038 }}
1039 \ExplSyntaxOff
1040
1041
1042 \providecommand{\hyperpage}[1]{#1}
1043
1044
1045 %%% need more space for ToC page numbers
1046 \setpnumwidth{2.55em}
1047 \setrmarg{3.55em}
1048
1049 %%% need more space for ToC section numbers
1050 \cftsetindents{section}{1.5em}{3.0em}
1051 \cftsetindents{subsection}{4.5em}{3.9em}
1052 \cftsetindents{subsubsection}{8.4em}{4.8em}
1053 \cftsetindents{paragraph}{10.7em}{5.7em}
1054 \cftsetindents{subparagraph}{12.7em}{6.7em}
1055
1056 %%% and for LoF and LoT numbers
1057 \cftsetindents{figure}{0em}{3.0em}
1058 \cftsetindents{table}{0em}{3.0em}
1059
1060 %%% set up the page layout
1061 \settrimmedsize{11in}{210mm}{*}
1062 \setlength{\trimtop}{0pt}
1063 \setlength{\trimedge}{\stockwidth}
1064 \addtolength{\trimedge}{-\paperwidth}
1065 \settypeblocksize{7.75in}{33pc}{*}
1066 \setulmargins{4cm}{*}{*}
1067 \setlrmargins{1.25in}{*}{*}
1068 %\setlrmargins{*}{*}{1}
1069 \setmarginnotes{17pt}{51pt}{\onelineskip}
1070 \setheadfoot{\onelineskip}{2\onelineskip}
1071 \setheaderspaces{*}{2\onelineskip}{*}
1072 \LMnote{2010/02/05}{added \cs{setsidefeet} to get
1073 it to use the new width for the margin par}
1074 \setsidefeet{\marginparsep}{9em}%
1075 {\onelineskip}{0pt}%
1076 {\normalfont\footnotesize}{\textheight}%
1077 \checkandfixthelayout
1078
1079
1080
1081 %%% empty pagestyle for Part pages
1082 \aliaspagestyle{part}{empty}
1083
1084 \bibliographystyle{alpha}
1085
1086 %%% subfigures and tables
1087 \newsubfloat{figure}
1088 \newsubfloat{table}
1089 \setcounter{lofdepth}{2}
1090
1091 %%% Set oldstylenums (which here are taken from CMR, not Palatino)
1092 \DeclareRobustCommand{\Moldstyle}[1]{{\Large\oldstylenums{#1}}}
1093
1094 %%%%% Pavlic `fix' for index
1095
1096 %\let\original@wrindexm@m\@wrindexm@m
1097 %\def\@wrindexm@m{\catcode`\ =10 \original@wrindexm@m}
1098
1099 % for letter group bookmarks for glossary items
1100 \newcommand\doglobookmark[1]{%
1101 \def\@tempa{Symbols}\def\@tempb{#1}%
1102 \ifx\@tempa\@tempb %
1103 \phantomsection\pdfbookmark[0]{Non letters}{NonLetters-glo}%
1104 \else%
1105 \phantomsection\pdfbookmark[0]{#1}{#1-glo}%
1106 \fi%
1107 }
1108
1109
1110 %%%% SNIPLETS %%%%
1111 \newcounter{sniplet}
1112 \counterwithin{sniplet}{chapter}
1113 \newcommand*\snipletname{Sniplet}
1114 \newcommand*\snipletref[1]{\hyperref[#1]{\snipletname~\ref*{#1}} on~\pref{#1}}
1115 \newenvironment{sniplet}[1][]{
1116 \refstepcounter{sniplet}
1117 \edef\mem@e{\@ifnotmtarg{#1}{\space(#1)}}
1118 \section*{\snipletname~\thesniplet\mem@e}
1119 \phantomsection
1120 \addcontentsline{toc}{section}{\snipletname\ \thesniplet\mem@e}
1121 \renewenvironment{lcode}{%\@zeroseps
1122 \renewcommand{\verbatim@startline}{\verbatim@line{\hskip\gparindent}}
1123 \small\setlength{\baselineskip}{\onelineskip}\verbatim}%
1124 {\endverbatim
1125 \vspace{-0.75\baselineskip}%
1126 \noindent}
1127 }{}
1128
1129 \let\normalchangetocdepth\changetocdepth
1130 \newcommand\sniplettoc{%
1131 \setcounter{@memmarkcntra}{\value{tocdepth}}%
1132 \begingroup%
1133 \let\changetocdepth\@gobble%
1134 \normalchangetocdepth{-10}%
1135 \cftinsertcode{start-sniplets}{\normalchangetocdepth{3}}%
1136 \cftinsertcode{end-sniplets}{\normalchangetocdepth{-10}}%
1137 \let\tocheadstart\relax%\@gobble
1138 % \printtoctitle\@gobble
1139 \renewcommand\printtoctitle[1]{\section*{Sniplet overview}}%
1140 \let\aftertoctitle\relax%
1141 \let\printtocnonum\relax%
1142 \let\precistoctext\@gobble%
1143 \setlength\cftsectionindent{0pt}%
1144 \tableofcontents*
1145 \endgroup
1146 \setcounter{tocdepth}{\value{@memmarkcntra}}
1147 }
1148
1149
1150
1151 %%% CTAN links
1152 \providecommand\CTANurl{}
1153 \AtBeginDocument{
1154 \@ifpackageloaded{hyperref}{
1155 \renewcommand*\CTANurl[1]{\href{http://mirror.ctan.org#1}{\nolinkurl{#1}}}
1156 }{
1157 \renewcommand*\CTANurl[1]{\url{#1}}
1158 }
1159 }
1160
1161 \newcommand\viaCTANurl[1]{CTAN: \CTANurl{#1}}
1162
1163
1164
1165 \newcommand\reimplemented[2]{%
1166 \textit{Reimplemented, #1\footnote{#2}}
1167 \fancybreak{}
1168 }
1169
1170 %\newenvironment{caveat}{\par\medskip\noindent\textbf{\textit{Caveat.}}\enskip\itshape}{\par\medskip}
1171 \newenvironment{caveat}[1][]{\begin{leftbar}\noindent\textbf{\textit{Caveat.}}\@ifmtarg{#1}{}{\Added{#1}}\enskip}{\end{leftbar}}
1172 %\newenvironment{Changed}{\par\medskip\noindent\textbf{\textit{Changed.}}\enskip}{\par\medskip}
1173 \newenvironment{Changed}[1][]{\begin{leftbar}\noindent\textbf{\textit{Changed.}\@ifmtarg{#1}{}{\Added{#1}}}\enskip}{\end{leftbar}}
1174 \newenvironment{note}{\par\medskip\noindent\textbf{\textit{Note.}}\enskip\itshape}{\par\medskip}
1175 \newenvironment{note*}[1]{\par\medskip\noindent\textbf{\textit{#1.}}\enskip\itshape}{\par\medskip}
1176 \newenvironment{hint}{\par\medskip\noindent\textbf{\textit{Hint.}}\enskip\itshape}{\par\medskip}
1177 \newenvironment{tip}{\par\medskip\noindent\textbf{\textit{Tip.}}\enskip\itshape}{\par\medskip}
1178 \renewcommand{\cmdprint}[1]{\textup{\texttt{\string#1}}}
1179
1180 \newenvironment{redleftbar}{%
1181 \def\FrameCommand{\color{red}\vrule width 3pt\color{black}\hspace{10pt}}%
1182 \MakeFramed {\advance\hsize-\width \FrameRestore}}%
1183 {\endMakeFramed}
1184
1185
1186 \newenvironment{Deprecated}[1][]{\begin{redleftbar}\noindent\textbf{\textit{\color{red}Deprecated.}\@ifmtarg{#1}{}{\Added{#1}}}\enskip}{\end{redleftbar}}
1187
1188
1189
1190
1191 \newenvironment{recommended}{%
1192 \@zeroseps%
1193 \parskip\z@ \topsep\z@%
1194 \definecolor{shadecolor}{gray}{0.9}%
1195 \fboxsep0pt%
1196 \shaded%
1197 \list{}{%
1198 \labelwidth\z@
1199 \itemindent\z@
1200 \addtolength\itemindent{\labelsep}
1201 \parsep\z@
1202 \listparindent1.5em
1203 \leftmargin\z@
1204 \rightmargin\leftmargin}
1205 \item[\textbf{Recommended alternative}]\mbox{}\par\smallskip
1206 \nobreak%\ignorespaces
1207 \noindent\ignorespaces}%
1208 { \endlist
1209 \endshaded}
1210
1211
1212 %\renewcommand\theHfootnote{\thefootnote.\thesheetsequence}
1213
1214
1215 \providecommand*{\fref}[1]{\hyperref[#1]{\figurerefname~\ref*{#1}}}
1216 \providecommand*{\tref}[1]{\hyperref[#1]{\tablerefname~\ref*{#1}}}
1217 \providecommand*{\pref}[1]{\hyperref[#1]{\pagerefname~\pageref*{#1}}}
1218 \providecommand*{\Aref}[1]{\hyperref[#1]{\appendixrefname~\ref*{#1}}}
1219 \providecommand*{\Bref}[1]{\hyperref[#1]{\bookrefname~\ref*{#1}}}
1220 \providecommand*{\Pref}[1]{\hyperref[#1]{\partrefname~\ref*{#1}}}
1221 \providecommand*{\Cref}[1]{\hyperref[#1]{\chapterrefname~\ref*{#1}}}
1222 \providecommand*{\Sref}[1]{\hyperref[#1]{\sectionrefname\ref*{#1}}}
1223 % \providecommand*{\eref}[1]{\hyperref[#1]{Example~\ref*{#1}}}
1224 \NewDocumentCommand\eref{sm}
1225 {%
1226 \IfBooleanTF{#1}
1227 {%
1228 Example~\ref*{#2}
1229 }%
1230 {%
1231 \hyperref[#2]{Example~\ref*{#2}}%
1232 }%
1233 }
1234 \newcommand*{\snipref}[1]{\hyperref[#1]{Sniplet~\ref*{#1}}}
1235
1236
1237 %\def\flushleft{\trivlist \raggedright\item\relax}
1238 %\def\endflushleft{\endtrivlist}
1239
1240 % maintainer signature
1241 \NewDocumentEnvironment{maintainersig}{}
1242 {\par\raggedleft}
1243 {\par/daleif\par\medskip}
1244
1245 \NewDocumentCommand\README{}
1246 {%
1247 %\url{https://mirrors.ctan.org/macros/latex/contrib/memoir/README}
1248 \href{https://mirrors.ctan.org/macros/latex/contrib/memoir/README}{README}%
1249 }
1250
1251
1252
1253 \typeout{End memsty.sty}
1254 \endinput
1255