Save current state before a LaTeX/.git software update...
[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 2, 2016}
7 %
8 \usepackage{ifthen}
9     \newcommand{\ifthen}[2]{\ifthenelse{#1}{#2}{}}
10     \newboolean{isdraft}\setboolean{isdraft}{true}
11     \newboolean{uselinenos}\setboolean{uselinenos}{true}
12 \newcommand{\draftmark}{\ifthenelse{\boolean{isdraft}}{*** DRAFT ***}{}}
13 %
14 \usepackage[T1]{fontenc}
15 \usepackage{palatino}
16 \usepackage{cmtt}
17     \renewcommand{\ttdefault}{cmtt}     % Use Computer Modern Typewriter instead of Courier
18 \usepackage{url}           % for color in letters. Links instead?
19 \usepackage[usenames]{color}%for color in letters. Links instead?
20 \usepackage{ellipsis}      % provides ... as \dots
21 \usepackage[utf8]{inputenc}% to type directly diacritic characters
22 %\usepackage{color}
23 \usepackage{listings}
24 \usepackage{alltt}
25 \lstset{ %
26 language={},               % choose the language of the code
27 basicstyle=\footnotesize\ttfamily, % the size of the fonts that are used for the code
28 numbers=none,              % where to put the line-numbers
29 numberstyle=\footnotesize, % the size of the fonts that are used for the line-numbers
30 numberfirstline=true,
31 firstnumber=1,             % first line number in each listing
32 stepnumber=5,              % the step between two line-numbers. If it is 1 each line will be numbered
33 numbersep=10pt,            % how far the line-numbers are from the code
34 backgroundcolor=\color{white}, % choose the background color. You must add \usepackage{color}
35 showspaces=false,          % show spaces adding particular underscores
36 showstringspaces=false,    % underline spaces within strings
37 showtabs=false,            % show tabs within strings adding particular underscores
38 frame=single,              % adds a frame around the code
39 tabsize=2,                 % sets default tabsize to 2 spaces
40 captionpos=b,              % sets the caption-position to bottom
41 breaklines=true,           % sets automatic line breaking
42 breakatwhitespace=false,   % sets if automatic breaks should only happen at whitespace
43 escapeinside={\%*}{*)}     % if you want to add a comment within your code
44 }
45 \usepackage{float}
46     \restylefloat{figure}
47 \usepackage{amsmath}       % Provides \nobreakdash
48 \usepackage{amssymb}       % maths
49 \usepackage{graphicx}      % For pictures
50 \usepackage{epstopdf}      % Autoconvert .eps to .pdf
51     \epstopdfsetup{suffix=-generated} % Mark generaed PDF as such
52 \usepackage{lineno}        % line numbers
53 \usepackage{longtable}     % For multipage tables
54 \usepackage{hhline}        % Single column horizontal lines
55 \usepackage{varioref}      % defines \vref
56 %   \textregistered is the trademark symbol
57 \usepackage[headheight=16pt,paper=letterpaper]{geometry}
58     \setlength{\headheight}{15pt}  % avoids warning from latex
59 \usepackage{needspace}     % For assuring space remaining on a page
60 \usepackage{ifthen}        % For conditional processing
61 \include{dwarfchangebarpatch} % Patch needed for package changebar
62 \usepackage{changepage}    % For odd/even page checks
63 \usepackage[usenames,dvipsnames]{xcolor}
64 \usepackage{lscape}        % For landscape mode (Appendix B)
65 \usepackage{tikz}          % graphics (Name Index (Fig 6.1), Appendix B)
66     \usetikzlibrary{arrows}
67     \usetikzlibrary{arrows.meta}
68     \usetikzlibrary{backgrounds}
69     \usetikzlibrary{calc}
70     \usetikzlibrary{chains}
71     \usetikzlibrary{decorations.pathreplacing}
72     \usetikzlibrary{shapes.geometric}
73     \usetikzlibrary{shapes.multipart}
74     \usetikzlibrary{shapes.symbols}
75 \usepackage{changebar}     % For change bars in margin
76 \usepackage{xspace}
77 \usepackage{makeidx}       % For making an index
78 % hyperref must be the last package listed.
79 % The hyperref settings helps hypertext get links right in the 
80 % pdf of the index. 
81 % Also, allcolors lets us generate colored active links inside a pdf.
82 % And breaklinks resolves truncation issues with very long link names.
83 \usepackage[breaklinks,plainpages=false,pdfpagelabels,pagebackref,
84             allcolors=blue!80!black,bookmarksnumbered=true]{hyperref}
85 \makeindex  % This and the makeidx package allow \index to create index entries.
86
87 \newcommand{\dwf}{DWARF Debugging Information Format}
88
89 \newenvironment{myindentpara}[1]%
90   {\begin{list}{}%
91     {\setlength{\leftmargin}{#1}}%
92     \item[]%
93   }
94   {\end{list}}
95
96 \hypersetup{colorlinks=true,
97   %bookmarks=true,
98   pdfauthor={\dwf\ Committee},
99   pdftitle={\dwf\ Version 5}
100 }
101
102 % An environment to create a listing-like (boxed) presentation for DWARF examples
103 % Use like \begin{lstlisting}...\end{lstlisting}. Does not do line numbers (boo)
104 % but does full LaTex processing within its scope (unlike \verb).
105 \newsavebox{\savedwf}
106 \newenvironment{dwflisting}{\begin{lrbox}{\savedwf}
107   \begin{minipage}{\textwidth}\footnotesize}
108   {\end{minipage}\end{lrbox}\fbox{\usebox{\savedwf}}}
109 % A helper to annotate the parts of a multipage figure
110 \newcommand{\figurepart}[2]{\raggedleft{\textit{\tiny{part #1 of #2}}}}
111
112 % Define a simple hyper-reference to a given URL
113 \newcommand{\hrefself}[1]{\href{#1}{#1}}
114
115 % Generate a page ref.
116 % use like   \refersec{chap:registervalues}
117 %\newcommand{\refersec}[1]{\ref{#1} on page \pageref{#1}}
118 \newcommand{\refersec}[1]{\vref{#1}}  % beware possible rerun loop
119 \newcommand{\referfol}[1]{\ref{#1} following}
120
121 % Generate a live link in the document that gets indexed as well
122 % Use like \livelink{chap:DWOPdup}{DW\_OP\_dup}
123 \newcommand{\livelink}[2]{\hyperlink{#1}{#2}\index{#2}}
124 % use when the index is different from the text and target.
125 \newcommand{\livelinki}[3]{\hyperlink{#1}{#2}\index{#3}}
126 % livetarg is the declaration that is the target of livelinks.
127 \newcommand{\livetarg}[2]{\hypertarget{#1}{#2}\index{#2}}
128 % When we want the index entry to look different from the name.
129 \newcommand{\livetargi}[3]{\hypertarget{#1}{#2}\index{#3}}
130
131 \newcommand{\thirtytwobitdwarfformat}[1][]{\livelink{datarep:xxbitdwffmt}{32-bit DWARF format}}
132 \newcommand{\sixtyfourbitdwarfformat}[1][]{\livelink{datarep:xxbitdwffmt}{64-bit DWARF format}}
133
134 \newcommand{\dash}{\nobreakdash-\hspace{0pt}}  % So we handle dashes ok.
135
136 % The following two let us mark a word as 'do not link' or
137 % 'do not index' to indicate the word is used generically
138 % and has been considered so do not index or link it.
139 % There is no significant difference in the two commands, though
140 % \nolink would be more oriented to words such as flag or address
141 % that might be linked (and indexed) in some circumstances.
142 \newcommand{\nolink}[1]{#1}
143 \newcommand{\noindex}[1]{#1}
144
145 % For index entries. The tt-variant of each pair is designed to
146 % allow a word to appear in tt font in the main test and the index
147 % but to collate in the index in its non-tt order. (LaTex normally
148 % sorts all tt words before all non-tt words.)
149 \newcommand{\addtoindex}[1]{#1\index{#1}}
150 \newcommand{\addttindex}[1]{\texttt{#1}\index{#1@\texttt{#1}}}
151 \newcommand{\addtoindexi}[2]{#1\index{#2}}
152 \newcommand{\addttindexi}[2]{\texttt{#1}\index{#2@\texttt{#2}}}
153 \newcommand{\addtoindexx}[1]{\index{#1}}
154 \newcommand{\addttindexx}[1]{\index{#1@\texttt{#1}}}
155
156 % Quote commands that avoid need for inline UTF-8 in these sources
157 \newcommand{\doublequote}[1]{\textquotedblleft #1\textquotedblright}
158 \newcommand{\singlequote}[1]{\textquoteleft #1\textquoteright}
159
160 % Better naming for the lowest level section header
161 \newcommand{\subsubsubsection}[1]{\paragraph{#1}~\newline}
162 \newcommand{\subsubsubsubsection}[1]{\textbf{#1}.~~}
163
164 % Start new page if less than n lines remain on current page
165 \newcommand{\needlines}[1]{\needspace{#1\baselineskip}}
166
167 % Helper for item lists with bold subject markers
168 \newcommand{\itembf}[1]{\needlines{4} \item \textbf{#1}}
169 \newcommand{\itembfnl}[1]{\itembf{#1} \\}
170
171 % And description lists with normal (not bold) text
172 \renewcommand{\descriptionlabel}[1]{\hspace{\labelsep}\textnormal{#1}}
173 \newcommand{\descriptionlabelnl}[1]{\item[#1] \mbox{}\\}
174
175 % Define an alternate footnote command that creates ragged right text
176 % (using \raggedright in the parameter does not work)
177 \newcommand\footnoteRR[1]{\footnote{\raggedright#1}}
178
179 % Emit an empty page
180 %
181 \newcommand{\emptypage}{
182     \clearpage
183     \vspace*{4in}
184     \begin{nolinenumbers}
185     \begin{center} 
186         \textit{(empty page)} 
187     \end{center}
188     \end{nolinenumbers}
189     }
190
191 % Define a new column type P that is just like p except
192 % that it uses ragged right (rather than right justification}
193 % within a column  of a tabular environment. (See Goossens,
194 % Mittelback&Samarin, "The LaTex Companion", pp108&114.)
195 \newcommand{\PBS}[1]{\let\temp=\\#1\let\\=\temp}
196 \newcolumntype{P}[1]{>{\PBS\raggedright\hspace{0pt}}p{#1}}
197
198 % A simple rule used in simple tables; default length is 2 inches
199 \newcommand{\simplerule}[1][2in]{\rule[4pt]{#1}{0.5pt}}
200
201 % A simple one column table of names; default width is 2 inches
202 \newcommand{\simplenametablerule}{\simplerule[2in]}
203 \newenvironment{simplenametable}[3][2in]
204     {   \begin{table}[ht] \caption{#2} \label{#3}
205         \begin{center}
206         \renewcommand{\simplenametablerule}{\simplerule[#1]}
207         \simplenametablerule \\
208         \begin{tabular*}{#1}{l}
209         }
210     {   \end{tabular*}
211         \vspace{4pt} \\
212         \simplenametablerule \\
213         \end{center}
214         \end{table}
215         }
216
217 % Complement of \isundefined
218 \newcommand{\isdefined}[1]{\not{\isundefined{#1}}}
219
220 \newcommand{\uselinenos}{\ifthen{\boolean{uselinenos}}{\linenumbers*}}
221
222 % Preferred changebar aliases
223 \newcommand{\bb}{\cbstart}      % Begin (change) bar
224 \newcommand{\eb}{\cbend}        % End (change) bar
225 \newcommand{\bbeb}{\bb\eb}      % Mark deleted word or phrase
226 % Mark deleted paragraph
227 \newcommand{\bbpareb}{\vspace{-0.6\baselineskip}\bb~\eb\vspace{-0.6\baselineskip}} 
228 % Variations for use inside an alltt environment--But don't work!
229 %\newcommand(\bballtt){\end{alltt}\bb\vspace{-0.8\baselineskip}\begin{alltt}}
230 %\newcommand{\eballtt}{\end{alltt}\eb\vspace{-0.8\baselineskip}\begin{alltt}}
231 %\newcommand(\bbeballtt){\end{alltt}\bb\eb\vspace{-0.8\baselineskip}\begin{alltt}}
232
233 % Define commands for all of the DWARF names (DW\_*, .debug_*, a few others)
234 %
235 %\newcommand{\definition}[1]{\textcolor{red!80!black}{#1}}
236 \newcommand{\definition}[1]{\textcolor{red!65!black}{#1}}
237 \newcommand{\definitionx}[1]{\definition{\addtoindex{#1}}}
238 \include{dwarfnamecmds}
239
240 % Define commands for pgf use in the name index figure (Fig 6.1)
241 %
242 \include{pgfcmdsfornameindexfig}
243
244 % --------------------------------
245 % --- Begin the document pages ---
246 % --------------------------------
247 %
248 \begin{document}
249 \frontmatter
250 \thispagestyle{empty}
251
252 \nonzeroparskip
253 \setlength{\parindent}{0pt} 
254 \setlength{\headheight}{6cm}
255 \setlength{\uppermargin}{6cm}
256 \setlength{\topsep}{0pt}
257 \tightlists                                     % less spacing before/after lists
258
259 \begin{center}
260 \LARGE
261 \textbf{\dwf}
262 \\
263 \textbf{Version 5}
264 \\
265 \vspace{1cm}
266 \includegraphics[keepaspectratio=true,scale=1.0]{dwarf-logo}
267 \\
268 \vspace{1cm}
269 \href{http://www.dwarfstd.org}{\dwf}
270 \href{http://www.dwarfstd.org}{Committee}
271 \\
272 \vspace{0.5cm} 
273 \url{http://www.dwarfstd.org}
274 \\
275 \vspace{2cm}
276 {\Large \textbf{\docdate}}
277 \\
278 \ifthenelse{\boolean{isdraft}}{
279         \vspace{2cm}
280         \draftmark}
281         {}
282 \end{center}
283
284 \textmd
285 \normalsize
286 \setlength{\headheight}{15pt}  
287 \pagestyle{plain}
288 %\makeevenhead{plain}{}{}{}
289 %\makeoddhead{plain}{}{}{}
290 %\makeevenfoot{plain}{}{}{}
291 %\makeoddfoot{plain}{}{}{}
292 \nonzeroparskip
293 \setlength{\parindent}{0pt} 
294 \settrims{0.5in}{0.5in}
295 \settypeblocksize{8.2in}{6.0in}
296 %\setlrmarginsandblock{0.6in}{0.6in}{*}
297 %\setheadfoot{15pt}{15pt}
298 %\setheaderspaces {*}{2\onelineskip}{*}
299 \nouppercaseheads
300 \makeevenhead{plain}{}{\rightmark}{}
301 \makeoddhead{plain}{}{\rightmark}{}
302 \makeevenfoot{plain}{\docdate}{\draftmark}{Page \thepage}
303 \makeoddfoot{plain}{\docdate}{\draftmark}{Page \thepage}
304
305 %\openany
306
307 \nonzeroparskip
308 \setlength{\parindent}{0pt} 
309 \flushleft
310 \include{copyright}
311 \include{foreword}
312
313 \newpage
314 ~ % Make the page non-empty...
315 \newpage
316 \tableofcontents
317
318 \clearpage
319 \listoffigures
320
321 \clearpage
322 \listoftables
323
324 \ifthenelse{\boolean{isdraft}}
325         {       %\emptypage
326                 {% Environment to keep the following header change local
327                 \clearpage
328                 \makeevenhead{plain}{}{Change Summary}{}
329                 \makeoddhead{plain}{}{Change Summary}{}
330                 \include{changesummary}
331                 %\emptypage
332                 }
333         }{}
334 %\cleardoublepage
335 \flushleft
336 \raggedbottom
337 \chapterstyle{default}
338
339 \setlength{\parindent}{0pt} 
340
341 \makepagestyle{fragFirstChPage}
342     \makeevenhead{fragFirstChPage}{}{}{}
343     \makeoddhead{fragFirstChPage}{}{}{}
344     \makeoddfoot{fragFirstChPage}{\docdate}{\draftmark}{Page \thepage}
345     \makeevenfoot{fragFirstChPage}{\docdate}{\draftmark}{Page \thepage}
346 \nouppercaseheads
347 \aliaspagestyle{chapter}{fragFirstChPage}
348
349 % ----- Start the main part of the document -----
350 \mainmatter
351 % Define the levels of sectionality that are numbered.
352 \setcounter{secnumdepth}{5}
353
354 \uselinenos\include{introduction}              %\emptypage
355 \uselinenos\include{generaldescription}        \emptypage
356 \uselinenos\include{programscope}              \emptypage
357 \uselinenos\include{dataobject}                \emptypage
358 \uselinenos\include{typeentries}               \emptypage
359 \uselinenos\include{otherdebugginginformation} \emptypage
360 \uselinenos\include{datarepresentation}        %\emptypage
361
362 %  The \appendix command toggles us into appendix chapters
363 \appendix
364
365 \uselinenos\include{attributesbytag}           %\emptypage
366 \uselinenos\include{debugsectionrelationships} \emptypage
367 \uselinenos\include{encodingdecoding}          \emptypage
368 \uselinenos\include{examples}                  \emptypage
369 \uselinenos\include{compression}               \emptypage
370 \uselinenos\include{splitobjects}              \emptypage
371 \uselinenos\include{sectionversionnumbers}     \emptypage
372 \nolinenumbers
373 \include{gnulicense}                           \emptypage
374 % Maybe someday the selected glossary concept will be of interest...
375 %\include{selectedglossary}                    %\emptypage
376 \printindex                                    \clearpage
377 \end{document}