Complete work on live links, cleanup some indexing and redo pagination.
[dwarf-doc.git] / dwarf5 / latexdoc / dwarf5.tex
1 \documentclass[12pt,letterpaper,oneside]{memoir} 
2 % for debugging, add 'draft' (without quotes) to the [] document class list.
3 % If draft is in the document class list, pix are just suggested
4 % by an outline, the pic does not appear as a picture.
5 %
6 \newcommand{\docdate}{May 10, 2013 \hspace{1cm}(***\textbf{DRAFT}***)}
7 %
8 \usepackage[T1]{fontenc}
9 \usepackage{palatino}
10 \usepackage{cmtt}
11 \renewcommand{\ttdefault}{cmtt} % Use Computer Modern Typewriter instead of Courier
12 %\usepackage{ascii}
13 %\renewcommand{\ttdefault}{ascii}
14 %\renewcommand{\ttfamily}{\asciifamily}
15 %\usepackage{microtype}
16 %\DisableLigatures[f]{encoding=T1}
17 %\renewcommand{\familydefault}{phv}  % font family helvetica
18 %
19
20 \usepackage{url}                   % For color in letters. Links instead?
21 \usepackage[usenames]{color} % For color in letters. Links instead?
22 \usepackage{ellipsis}      % Provides ... as \dots
23 %\usepackage{color}
24 \usepackage{listings}
25 \usepackage{alltt}
26 \lstset{ %
27 language={},               % choose the language of the code
28 basicstyle=\footnotesize\ttfamily,  % the size of the fonts that are used for the code
29 numbers=none,              % where to put the line-numbers
30 numberstyle=\footnotesize, % the size of the fonts that are used for the line-numbers
31 numberfirstline=true,
32 firstnumber=1,             % first line number in each listing
33 stepnumber=5,              % the step between two line-numbers. If it is 1 each line will be numbered
34 numbersep=10pt,            % how far the line-numbers are from the code
35 backgroundcolor=\color{white}, % choose the background color. You must add \usepackage{color}
36 showspaces=false,          % show spaces adding particular underscores
37 showstringspaces=false,    % underline spaces within strings
38 showtabs=false,            % show tabs within strings adding particular underscores
39 frame=single,              % adds a frame around the code
40 tabsize=2,                 % sets default tabsize to 2 spaces
41 captionpos=b,              % sets the caption-position to bottom
42 breaklines=true,           % sets automatic line breaking
43 breakatwhitespace=false,   % sets if automatic breaks should only happen at whitespace
44 escapeinside={\%*}{*)}     % if you want to add a comment within your code
45 }
46
47 \usepackage{amsmath}       % Provides \nobreakdash
48 \usepackage{graphicx}      % For pictures
49 \usepackage{longtable}     % For multipage tables
50 \usepackage{varioref}      % defines \vref
51 % \textregistered is the trademark symbol
52 \usepackage[headheight=16pt,paper=letterpaper]{geometry}
53 \setlength{\headheight}{15pt}  % avoids warning from latex
54 \usepackage{needspace}     % For assuring space remaining on a page
55 \usepackage{ifthen}        % For conditional processing
56 \usepackage{changepage}    % For odd/even page checks
57 %\usepackage{epic}          % For eepic package 
58 %\usepackage{eepic}         % For the diagram of section relationships
59 %\usepackage{eepicemu}      % For the diagram of section relationships
60 \usepackage{tikz}                       % graphics (Appendix B)
61 \usetikzlibrary{shapes.geometric}
62 \usetikzlibrary{arrows}
63 \usepackage{makeidx}       % For making an index
64 % hyperref must be the last package listed.
65 % The hyperref settings helps hypertext get right links in the 
66 % pdf of the index.
67 \usepackage[plainpages=false,pdfpagelabels,pagebackref,allcolors=blue]{hyperref} % Lets us generate colored active links inside a pdf.
68 \makeindex  % This and the makeidx package allow \index to create index entries.
69
70 \newcommand{\dwf}{DWARF Debugging Information Format}
71
72 \newenvironment{myindentpara}[1]%
73   {\begin{list}{}%
74     {\setlength{\leftmargin}{#1}}%
75     \item[]%
76   }
77   {\end{list}}
78
79 % broken somehow.
80 %\newcommand{\myindent1}[1]{\begin{myindentpara}{1cm}#1\end{myindentpara}}
81
82 \hypersetup{colorlinks=true,
83   %bookmarks=true,
84   pdfauthor={\dwf\ Committee},
85   pdftitle={\dwf\ Version 4.1}
86 }
87
88 % An environment to create a listing-like (boxed) presentation for DWARF examples
89 % Use like \begin{lstlisting}...\end{lstlisting}. Does not do line numbers (boo)
90 % but does full LaTex processing within its scope (unlike \verb).
91 \newsavebox{\savedwf}
92 \newenvironment{dwflisting}{\begin{lrbox}{\savedwf}
93   \begin{minipage}{\textwidth}\footnotesize}
94   {\end{minipage}\end{lrbox}\fbox{\usebox{\savedwf}}}
95 % A helper to annotate the parts of a multipage figure
96 \newcommand{\figurepart}[2]{\raggedleft{\textit{\tiny{part #1 of #2}}}}
97
98 % Generate a page ref.
99 % use like   \refersec{chap:registerbasedaddressing}
100 %\newcommand{\refersec}[1]{\ref{#1} on page \pageref{#1}}
101 \newcommand{\refersec}[1]{\vref{#1}}  % beware possible rerun loop
102 \newcommand{\referfol}[1]{\ref{#1} following}
103
104 % Generate a live link in the document
105 % use like \livelink{chap:DWOPdup}{DW\_OP\_dup}
106 \newcommand{\livelink}[2]{\hyperlink{#1}{#2}\index{#2}}
107 % use when the index is different from the text and target.
108 \newcommand{\livelinki}[3]{\hyperlink{#1}{#2}\index{#3}}
109 % livetarg is the declaration this is the target of livelinks.
110 % FIXME: we might want livetarg and livetargi  #2 to be \textbf{#2}
111 \newcommand{\livetarg}[2]{\hypertarget{#1}{#2}\index{#2}}
112 % When we want the index entry to look different from the name.
113 \newcommand{\livetargi}[3]{\hypertarget{#1}{#2}\index{#3}}
114
115 \newcommand{\thirtytwobitdwarfformat}[1][]{\livelink{datarep:xxbitdwffmt}{32-bit DWARF format}}
116 \newcommand{\sixtyfourbitdwarfformat}[1][]{\livelink{datarep:xxbitdwffmt}{64-bit DWARF format}}
117
118 \newcommand{\dash}{\nobreakdash-\hspace{0pt}}  % So we handle dashes ok.
119
120 % The following two let us mark a word as 'do not link' or
121 % 'do not index' to indicate the word is used generically
122 % and has been considered so do not index or link it.
123 % There is no significant difference in the two commands, though
124 % \nolink would be more oriented to words such as flag or address
125 % that might be linked (and indexed) in some circumstances.
126 \newcommand{\nolink}[1]{#1}
127 \newcommand{\noindex}[1]{#1}
128
129 % For index entries. The tt-variant of each pair is designed to
130 % allow a word to appear in tt font in the main test and the index
131 % but to collate in the index in its non-tt order. (LaTex normally
132 % sorts all tt words before all non-tt words.)
133 \newcommand{\addtoindex}[1]{#1\index{#1}}
134 \newcommand{\addttindex}[1]{\texttt{#1}\index{#1@\texttt{#1}}}
135 \newcommand{\addtoindexi}[2]{#1\index{#2}}
136 \newcommand{\addttindexi}[2]{\texttt{#1}\index{#2@\texttt{#2}}}
137 \newcommand{\addtoindexx}[1]{\index{#1}}
138 \newcommand{\addttindexx}[1]{\index{#1@\texttt{#1}}}
139
140 % Quote commands that avoid need for inline UTF-8 in these sources
141 \newcommand{\doublequote}[1]{\textquotedblleft #1\textquotedblright}
142 \newcommand{\singlequote}[1]{\textquoteleft #1\textquoteright}
143
144 % Better naming for the lowest level section header
145 \newcommand{\subsubsubsection}[1]{\paragraph{#1.}}
146
147 % Issue \clearpage if less than n lines remain on page
148 \newcommand{\needlines}[1]{\needspace{#1\baselineskip}}
149
150 % Helper for item lists with bold subject markers
151 \newcommand{\itembf}[1]{\item \textbf{#1}}
152 \newcommand{\itembfnl}[1]{\itembf{#1} \\}
153
154 % And description lists with normal (not bold) text
155 \renewcommand{\descriptionlabel}[1]{\hspace{\labelsep}\textnormal{#1}}
156 \newcommand{\descriptionlabelnl}[1]{\item[#1] \mbox{}\\}
157
158 % Reduce vertical space at beginning of a list
159 \setlength{\topsep}{0in}
160
161 \newcommand{\emptypage}{
162     \clearpage
163     \vspace*{4in}
164     \begin{center} \textit{(empty page)} \end{center}
165     }
166
167 % A simple rule used in simple tables; default length is 2 inches
168 \newcommand{\simplerule}[1][2in]{\rule[4pt]{#1}{0.5pt}}
169
170 % A simple one column table of names; default width is 2 inches
171 \newcommand{\simplenametablerule}{\simplerule[2in]}
172 \newenvironment{simplenametable}[3][2in]
173     {   \begin{table}[here] \caption{#2} \label{#3}
174         \begin{center}
175         \renewcommand{\simplenametablerule}{\simplerule[#1]}
176         \simplenametablerule \\
177         \begin{tabular*}{#1}{l}
178         }
179     {   \end{tabular*}
180         \vspace{4pt} \\
181         \simplenametablerule \\
182         \end{center}
183         \end{table}
184         }
185
186 % Anti-ligature commands added because \/ and {} don't work for unknown reasons
187 % nor does the microtext package DisableLigatures command...???
188 %
189 \newcommand{\xiiif}                             {0x\hspace{1pt}3\hspace{2pt}f}
190 \newcommand{\xiiifff}                   {0x\hspace{1pt}3\hspace{2pt}f\hspace{2pt}f\hspace{2pt}f}
191 \newcommand{\xff}                               {0x\hspace{1pt}f\hspace{2pt}f}
192 \newcommand{\xffff}                             {0x\hspace{1pt}f\hspace{2pt}f\hspace{2pt}f\hspace{2pt}f}
193 %
194 % These are intended for use in running text...
195 %
196 \newcommand{\xffffffff}                 {\texttt{0xffffffff}}                   % use with following punctutation
197 \newcommand{\wffffffff}                 {\texttt{0xffffffff}\ }                 % use as separate "word"
198 \newcommand{\xfffffffzero}              {\texttt{0xfffffff0}}                   % use with following punctutation
199 \newcommand{\wfffffffzero}              {\texttt{0xfffffff0}\ }
200 \newcommand{\xffffffffffffffff} {\texttt{0xffffffffffffffff}}   % use with following punctutation
201 \newcommand{\wffffffffffffffff} {\texttt{0xffffffffffffffff}\ }
202
203 % Define commands for all of the DWARF names (DW\_*, .debug_*, a few others)
204 \include{dwarfnamecmds}
205
206 %--- Begin the document pages
207 %
208 \begin{document}
209 \frontmatter
210 \thispagestyle{empty}
211
212 \nonzeroparskip
213 \setlength{\parindent}{0pt} 
214 \setlength{\headheight}{6cm}
215 \setlength{\uppermargin}{6cm}
216
217 \begin{centering}
218 \LARGE
219 \textbf{\dwf}
220
221 \textbf{Version 4.1}
222
223 \centering
224 \vspace{1cm}
225 \includegraphics[keepaspectratio=true,scale=1.0]{dwarf-logo}
226
227 %\centering
228 \vspace{2cm}
229 \href{http://www.dwarfstd.org}{\dwf\ Committee}
230
231 \vspace{1cm} 
232 \url{http://www.dwarfstd.org}
233
234 \large
235 \vspace{2cm}
236 \textbf{\docdate}
237
238 \end{centering}
239
240 %\clearpage
241 %\openany
242
243 \textmd
244 \normalsize
245 \setlength{\headheight}{15pt}  
246
247 \pagestyle{plain}
248 %\makeevenhead{plain}{}{}{}
249 %\makeoddhead{plain}{}{}{}
250 %\makeevenfoot{plain}{}{}{}
251 %\makeoddfoot{plain}{}{}{}
252
253 \nonzeroparskip
254 \setlength{\parindent}{0pt} 
255 \settrims{0.5in}{0.5in}
256 \settypeblocksize{8.2in}{6.0in}
257 %\setlrmarginsandblock{0.6in}{0.6in}{*}
258 %\setheadfoot{15pt}{15pt}
259 %\setheaderspaces {*}{2\onelineskip}{*}
260 \nouppercaseheads
261 \makeevenhead{plain}{}{\rightmark}{}
262 \makeoddhead{plain}{}{\rightmark}{}
263 \makeevenfoot{plain}{\docdate}{}{Page \thepage}
264 \makeoddfoot{plain}{\docdate}{}{Page \thepage}
265
266 %\openany
267
268 \nonzeroparskip
269 \setlength{\parindent}{0pt} 
270
271 \flushleft
272 \include{copyright}
273 \include{foreword}
274 \include{foreword4.1}
275 \emptypage
276
277 \newpage
278 \tableofcontents
279
280 \cleardoublepage
281 \listoffigures
282
283 \cleardoublepage
284 \listoftables
285
286 \flushleft
287 \raggedbottom
288 \chapterstyle{default}
289
290 \setlength{\parindent}{0pt} 
291
292 \makepagestyle{fragFirstChPage}
293     \makeevenhead{fragFirstChPage}{}{}{}
294     \makeoddhead{fragFirstChPage}{}{}{}
295     \makeoddfoot{fragFirstChPage}{\docdate}{}{Page \thepage}
296     \makeevenfoot{fragFirstChPage}{\docdate}{}{Page \thepage}
297 \nouppercaseheads
298 \aliaspagestyle{chapter}{fragFirstChPage}
299
300 % ----- Start the main part of the document -----
301 \mainmatter
302 % Define the levels of sectionality that are numbered.
303 \setcounter{secnumdepth}{5}
304 \include{introduction}
305 \include{generaldescription}            \emptypage
306 \include{programscope}                  \emptypage
307 \include{dataobject}                    \emptypage
308 \include{typeentries}                   \emptypage
309 \include{otherdebugginginformation}     \emptypage
310 \include{datarepresentation}            %\emptypage
311
312 %  The \appendix toggles us into appendix chapters
313 \appendix
314
315 \include{attributesbytag}                               %\emptypage
316 \include{debugsectionrelationships}     \emptypage
317 \include{encodingdecoding}              \emptypage
318 \include{examples}                      %\emptypage
319 \include{compression}                   %\emptypage
320 \include{sectionversionnumbers}
321 \include{gnulicense}
322
323 \printindex
324
325 \end{document}