| 1 |
The pdfDstruct section of the \pdftoolbox{} toolbox is for managing the structure of your documents. |
| 2 |
|
| 3 |
\subsection{Layout} |
| 4 |
|
| 5 |
In {\tt pdfDstruct/layout.tex}, \pdftoolbox{} provides a macro \macro\setlayout\anchormacro\setlayout{} for setting up the layout of the document. |
| 6 |
The use is |
| 7 |
|
| 8 |
\macrousage\setlayout {[page width=<wd>,] [page height=<ht>,] [horizontal margin=<mwd>,] |
| 9 |
[vertical margin=<vwd>]}/emacrousage |
| 10 |
|
| 11 |
\subsection{Hyperlinks} |
| 12 |
|
| 13 |
In {\tt pdfDstruct/hyperlinks.tex}, \pdftoolbox{} provides macros for creating and managing hyperlinks. |
| 14 |
|
| 15 |
\macroexp{\anchor [<type>]{<name>}} |
| 16 |
Creates an anchor (a reference, if you will) to the current point in the document. |
| 17 |
\emacroexp |
| 18 |
|
| 19 |
\macroexp{\gotoanchor [<type>]{<name>}{<material>}} |
| 20 |
Creates a clickable field containing {\it material} which, when clicked, will go to the anchor labeled with the type {\it type} and name {\it name}. |
| 21 |
\emacroexp |
| 22 |
|
| 23 |
\macroexp{\url {<url>}{<material>}} |
| 24 |
Creates a clickable field containing {\it material} which, when clicked, will redirect to the url {\it url}. |
| 25 |
\emacroexp |
| 26 |
|
| 27 |
\macroexp{\createbordertype {<type>}{<color>}{<wd>}} |
| 28 |
Sets the border type of anchor type {\it type} to be of color {\it color} and width {\it wd}. |
| 29 |
Urls have border type {\tt url}. |
| 30 |
If a type doesn't have a specified border type, the {\tt default} one is used. |
| 31 |
\emacroexp |
| 32 |
|
| 33 |
\subsection{Fonts} |
| 34 |
|
| 35 |
In {\tt pdfDstruct/fonts.tex}, \pdftoolbox{} provides macros for accessing and controlling fonts. |
| 36 |
|
| 37 |
\macroexp{\addfont {<name>}{<sizes>}} |
| 38 |
This will add a font by the name {\it name} so that it is accessible by \pdftoolbox. |
| 39 |
{\it sizes} is a key-value dictionary which specifies the font codes for different sizes of the font. |
| 40 |
For example, in {\tt pdfDstruct/fonts.tex} is the usage: |
| 41 |
|
| 42 |
\blisting |
| 43 |
\addfont{rm}{% |
| 44 |
default=cmr10, |
| 45 |
5pt=cmr5, |
| 46 |
6pt=cmr6, |
| 47 |
7pt=cmr7, |
| 48 |
8pt=cmr8, |
| 49 |
9pt=cmr9, |
| 50 |
10pt=cmr10, |
| 51 |
12pt=cmr12, |
| 52 |
17pt=cmr17 |
| 53 |
} |
| 54 |
\elisting |
| 55 |
|
| 56 |
So now \pdftoolbox{} has access to the computer modern roman font ({\tt cmr}) at the sizes specified. |
| 57 |
The purpose of the default size is for when a size is not available. |
| 58 |
For example, requesting the {\tt rm} font at size $13$ will give you {\tt cmr10 at 13pt}. |
| 59 |
The default size is required. |
| 60 |
|
| 61 |
\pdftoolbox{} provides the following fonts: |
| 62 |
|
| 63 |
\emacroexp |
| 64 |
|
| 65 |
\quitvmode\vbox{\tabskip=.5cm\halign{&\hfil#:\tabskip=0pt&\ \tt#\hfil\tabskip=.5cm\cr |
| 66 |
rm&cmr&it&cmti&bf&cmbx&sc&cmcsc&mi&cmmi&sy&cmsy&ex&cmex&sl&cmsl\cr |
| 67 |
ss&cmss&tt&cmtt&msam&msam&msbm&msbm&eufm&eufm&rsfs&rsfs\cr |
| 68 |
}} |
| 69 |
|
| 70 |
\macroexp{\applyfontcode <font code>} |
| 71 |
Applies the font specified by {\it font code}. |
| 72 |
For example, \inlinecode|\applyfontcode cmr10| will set the font to {\tt cmr10}. |
| 73 |
\emacroexp |
| 74 |
|
| 75 |
\macroexp{\setfontfamily {<font>}{<family>}} |
| 76 |
Sets math font family {\it family} to the font {\it font} (which is specified by \gotomacro\addfont). |
| 77 |
For example, \inlinecode|\setfontfamily{rm}{0}| sets the alpha-numeric font family to {\tt rm}. |
| 78 |
\emacroexp |
| 79 |
|
| 80 |
\macroexp{\setfont {<font>}} |
| 81 |
Sets the current font to {\it font}. |
| 82 |
The current font is stored in the macro \macro\currfont\anchormacro\currfont. |
| 83 |
\emacroexp |
| 84 |
|
| 85 |
\macroexp{\setscale {<scale>}} |
| 86 |
Sets the current font scale to {\it scale}. |
| 87 |
The current font scale is stored in the macro \macro\currscale\anchormacro\currscale. |
| 88 |
\emacroexp |
| 89 |
|
| 90 |
\macroexp{\setfontandscale {<font>}{<scale>}} |
| 91 |
Sets the current font to {\it font} and scale to {\it scale}. |
| 92 |
\emacroexp |
| 93 |
|
| 94 |
\pdftoolbox{} also provides the following font switches (which are simple wrappers around \macro\setfont{} which also set \macro\fam): |
| 95 |
|
| 96 |
\hbox to\hsize{\hfil\inlinecode|\bf, \it, \bb, \sf, \sl, \frak, \scr|\hfil} |
| 97 |
|
| 98 |
\macroexp{\mathfonttable {<family>}[<offset>]{<table>}} |
| 99 |
The \macro\mathfonttable{} macro's purpose is to define multiple mathematical characters for the same family. |
| 100 |
{\it table} consists of a sequence of macros followed by numbers (e.g. \inlinecode|\square0|) which correspond to the name of the macro and the math type (in this case $0$: ordinary/\macro\mathord). |
| 101 |
\macro\mathfonttable{} will iterate over {\it table} and \macro\mathchardef{} the macro to be equal to the character at the current position in family {\it family} of the type specified. |
| 102 |
If {\it offset} is specified, it will start iterating over the family starting from the offset. |
| 103 |
|
| 104 |
More explicitly, if {\it family} is {\tt X} and the $\tt i$th index in the table is \inlinecode|\X N|, then the macro does essentially |
| 105 |
|
| 106 |
\hbox to\hsize{\hfil\inlinecode|\mathchardef\X = XNi|\hfil} |
| 107 |
|
| 108 |
To skip over an index, simply write \macro\__{}. |
| 109 |
\emacroexp |
| 110 |
|
| 111 |
Using \macro\mathfonttable, \pdftoolbox{} defines the following: |
| 112 |
|
| 113 |
{\tabskip=2pt\halign{&\hfil\def\X{#}\_xp\macro\X: $\X$\hfil\cr |
| 114 |
\boxdot&\boxplus&\boxtimes&\square\cr |
| 115 |
\blacksquare&\diamond&\blackdiamond&\rotateclockwise\cr |
| 116 |
\rotatecounterclockwise&\rightleftharpoons&\leftrightharpoons&\boxminus\cr |
| 117 |
\Vdash&\Vvdash&\vDash&\twoheadrightarrow\cr |
| 118 |
\twoheadleftarrow&\leftleftarrows&\rightrightarrows&\upuparrows\cr |
| 119 |
\downdownarrows&\uprightharpoon&\downrightharpoon&\upleftharppon\cr |
| 120 |
\downleftharpoon&\rightarrowtail&\leftarrowtail&\leftrightarrows\cr |
| 121 |
\rightleftarrows&\Lsh&\Rsh&\rightsquigarrow\cr |
| 122 |
\leftrightsquigarrow&\looparrowleft&\looparrowright&\circeq\cr |
| 123 |
\succsim&\gtrsim&\gtrapprox&\multimap\cr |
| 124 |
\therefore&\because&\Doteq&\triangleq\cr |
| 125 |
\precsim&\lesssim&\lessapprox\cr |
| 126 |
}} |
| 127 |
|
| 128 |
\subsection{Hooks} |
| 129 |
|
| 130 |
\pdftoolbox{} provides a tool, inspired by \LaTeX, called {\it hooks} (source in {\tt pdfDstruct/hooks.tex}). |
| 131 |
Hooks are simply snippets of code that can be inserted into macros and then altered later. |
| 132 |
An example is given at the end of this section. |
| 133 |
|
| 134 |
\macroexp{\createhook {<name>}} |
| 135 |
Creates a hook by the name of {\it name}. |
| 136 |
\emacroexp |
| 137 |
|
| 138 |
\macroexp{\appendtohook {<name>}{<code>}} |
| 139 |
Appends {\it code} to the hook specified by {\it name}. |
| 140 |
\emacroexp |
| 141 |
|
| 142 |
\macroexp{\prependtohook {<name>}{<code>}} |
| 143 |
Prepends {\it code} to the hook specified by {\it name}. |
| 144 |
\emacroexp |
| 145 |
|
| 146 |
\macroexp{\callhook {<name>}} |
| 147 |
Calls the hook specified by {\it name}. |
| 148 |
\emacroexp |
| 149 |
|
| 150 |
\pdftoolbox{} provides a builtin hook called {\tt end} which is executed by \macro\bye. |
| 151 |
Throughout the document, you can add macros to an array called {\tt document data}, then all these definitions are written to the file \inlinecode|\jobname.data| by the {\tt end} hook. |
| 152 |
|
| 153 |
Specifically, you can use the \macro\docdata\anchormacro\docdata{} macro to add a macro to the document's data, e.g. if you have a macro \macro\name{} which has the author's name (say, S. Lurp), you can do |
| 154 |
\inlinecode|\docdata\name|, and this will write the line \inlinecode|\gdef\name{S. Lurp}| to the data file. |
| 155 |
Then at the beginning of the document next compilation, you can load all definitions in the data file. |
| 156 |
|
| 157 |
\subsection{Indices} |
| 158 |
|
| 159 |
In {\tt pdfDstruct/index.tex}, \pdftoolbox{} provides macros for creating an index. |
| 160 |
The index is organized into {\it categories} and {\it items} within each category, and an associated {\it value}. |
| 161 |
A category may be something like ``manifolds'' and an item within this category may be ``topological'' which has a value corresponding to the page number where topological manifolds are defined. |
| 162 |
|
| 163 |
\macroexp{\indexize {<options>}} |
| 164 |
Adds an item to the index, specified by options, which has fields: |
| 165 |
\benum |
| 166 |
\item {\tt category} (required): the category of the item; |
| 167 |
\item {\tt item}: the item of the item; |
| 168 |
\item {\tt value} (required): the value of the item; |
| 169 |
\item {\tt expand value} (valueless): added if {\tt value} should be expanded (e.g. if {\tt value} is a macro corresponding to the page number, it needs to be expanded); |
| 170 |
\item {\tt add hyperlink} (valueless): whether or not the item's values should be hyperlinked. |
| 171 |
\eenum |
| 172 |
\emacroexp |
| 173 |
|
| 174 |
\macroexp{\seealso {<options>}} |
| 175 |
Adds a ``see also'' item to the index: one which redirects to another index item. |
| 176 |
{\it options} is a map which has fields: |
| 177 |
\benum |
| 178 |
\item {\tt category} (required): the category of the item; |
| 179 |
\item {\tt item}: the item of the item; |
| 180 |
\item {\tt dest} (required): the destination of the ``see also'' (e.g. if the item is ``wedge product'', you may want to also see ``exterior product'', and so the destination may be ``exterior product''); |
| 181 |
\item {\tt hyperlink}: an anchor to link to; |
| 182 |
\item {\tt index link} (valueless): a flag of whether or not the anchor is within the index. |
| 183 |
\eenum |
| 184 |
To link to an item within the index, suppose of category {\tt C} and item {\tt I}, set {\tt hyperlink} to {\tt C:I} (or just {\tt C:} if {\tt I} is empty), and set {\tt index link}. |
| 185 |
\emacroexp |
| 186 |
|
| 187 |
\macroexp{\index} |
| 188 |
Prints the index. |
| 189 |
\emacroexp |
| 190 |
|
| 191 |
\macroexp{\addtoindex {<category>}[<item>]} |
| 192 |
Adds an item to the index of category {\it category} and item {\it item}. |
| 193 |
Its value is \macro\@defaultindexval{} (by default \inlinecode|\the\pageno|), and {\tt expand value} and {\tt add hyperlink} are set. |
| 194 |
\emacroexp |
| 195 |
|
| 196 |
\subsection{Lists} |
| 197 |
|
| 198 |
In {\tt pdfDstruct/lists.tex}, \pdftoolbox{} provides macros for creating lists of text. |
| 199 |
|
| 200 |
There are two types of lists: unenumerated and enumerated. |
| 201 |
Unenumerated lists start with \macro\blist\anchormacro\blist{} and end with \macro\elist\anchormacro\elist. |
| 202 |
Each item begins with \macro\item\anchormacro\item. |
| 203 |
The symbol used for each bullet point is determined by the nested depth of the list. |
| 204 |
For a depth of $N$, the symbol used is stored in the macro \macro\liststyleN\anchormacro\liststyle. |
| 205 |
|
| 206 |
Similarly enumerated lists start with \macro\benum\anchormacro\benum{} and end with \macro\elist\anchormacro\eenum. |
| 207 |
Each item begins with \macro\item, and the style for the enumeration is determined by the depth of the list. |
| 208 |
For a depth of $N$, the $n$th element is styled with \inlinecode|\enumstyleN{n}|. |
| 209 |
It is put in a box of width \inlinecode|\enumstyleN@wd|. |
| 210 |
|
| 211 |
To add text in between items (not as part of the list), you can use \macro\mtext\anchormacro\mtext. |
| 212 |
|
| 213 |
\subsection{Table of Contents} \anchor{table-of-contents} |
| 214 |
|
| 215 |
In {\tt pdfDstruct/tableofcontents.tex}, \pdftoolbox{} provides macros for creating and displaying tables of content. |
| 216 |
|
| 217 |
\macroexp{\addtoccontent {<marker>}{<title>}{<value>}{<depth>}{<anchor>}} |
| 218 |
Adds content to the table of contents. |
| 219 |
The marker is {\it marker} (e.g. $1.1$; this is printed to the left of the title), title is {\it title} (e.g. chapter name), value is {\it value} (e.g. page number), depth is {\it depth}, |
| 220 |
and is linked to the anchor {\it anchor}. |
| 221 |
The depth {\it depth} determines the style used in the table (see \gotomacro\settocdepthformat). |
| 222 |
\emacroexp |
| 223 |
|
| 224 |
\macroexp{\tableofcontents} |
| 225 |
Prints the table of contents. |
| 226 |
\emacroexp |
| 227 |
|
| 228 |
\macroexp{\settocdepthformat {<depth>}{<options>}} |
| 229 |
Sets the format of the table of contents at the depth {\it depth}. |
| 230 |
{\it options} is a map with the following fields: |
| 231 |
\blist |
| 232 |
\item {\tt marker}: the style for the marker (default is \inlinecode|\setfont{rm}|; the marker is passed as a parameter to {\tt marker}); |
| 233 |
\item {\tt marker buffer}: the buffer between the title and marker (default is {\tt.25cm}); |
| 234 |
\item {\tt title}: the style for the title (default is \inlinecode|\setfont{rm}|; the title is passed as a parameter to {\tt title}); |
| 235 |
\item {\tt value}: the style for the value (default is \inlinecode|\setfont{rm}|; the value is passed as a parameter to {\tt value}); |
| 236 |
\item {\tt leader}: the leader to add between the title and value (default is nothing); |
| 237 |
\item {\tt indent}: the amount to indent the line (default is 0pt); |
| 238 |
\item {\tt buffer}: the amount of buffer to add around the line (default is 0pt). |
| 239 |
\elist |
| 240 |
\emacroexp |
| 241 |
|
| 242 |
\pdftoolbox{} provides four types of sectioning: parts, sections, subsections, and subsubsections. |
| 243 |
Each has a counter in its name (e.g. {\tt section}), and a macro with the current section name (e.g. \macro\currsection). |
| 244 |
|
| 245 |
\macroexp{\part {<title>}} |
| 246 |
Adds a part to the document. |
| 247 |
\emacroexp |
| 248 |
|
| 249 |
\macroexp{\section (*){<title>}} |
| 250 |
Adds a section to the document. |
| 251 |
If the asterisk is added, the section is a ``pseudosection'': the section counter is not incremented and not displayed, and the section is not added to the table of contents. |
| 252 |
Otherwise the section counter is incremented and displayed, and the section is added to the table of contents. |
| 253 |
\emacroexp |
| 254 |
|
| 255 |
\macroexp{\subsection (*){<title>}} |
| 256 |
Adds a subsection to the document. |
| 257 |
If the asterisk is added, the subsection is a ``pseudosubsection'': the subsection counter is not incremented and not displayed, and the subsection is not added to the table of contents. |
| 258 |
Otherwise the subsection counter is incremented and displayed, and the subsection is added to the table of contents. |
| 259 |
\emacroexp |
| 260 |
|
| 261 |
\macroexp{\subsubsection (*){<title>}} |
| 262 |
Adds a subsubsection to the document. |
| 263 |
If the asterisk is added, the subsubsection is a ``pseudosubsubsection'': the subsubsection counter is not incremented and not displayed, and the subsubsection is not added to the table of contents. |
| 264 |
Otherwise the subsubsection counter is incremented and displayed, but the subsubsection is still not added to the table of contents. |
| 265 |
\emacroexp |
| 266 |
|