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