Try out newly discovered needspace package; it is wonderful...
[dwarf-doc.git] / dwarf5 / latexdoc / dwarf5.tex
1 \documentclass[12pt,letterpaper,twoside]{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 \usepackage{url} % For color in letters. Links instead?
7 \usepackage{color} % For color in letters. Links instead?
8 \usepackage{ellipsis} % Provides ... as \dots
9 \usepackage{color}
10 \usepackage{listings}
11 \usepackage{alltt}
12 \lstset{ %
13 language={},               % choose the language of the code
14 basicstyle=\footnotesize,  % the size of the fonts that are used for the code
15 numbers=left,              % where to put the line-numbers
16 numberstyle=\footnotesize, % the size of the fonts that are used for the line-numbers
17 numberfirstline=true,
18 firstnumber=1,             % first line number in each listing
19 stepnumber=5,              % the step between two line-numbers. If it is 1 each line will be numbered
20 numbersep=10pt,            % how far the line-numbers are from the code
21 backgroundcolor=\color{white}, % choose the background color. You must add \usepackage{color}
22 showspaces=false,          % show spaces adding particular underscores
23 showstringspaces=false,    % underline spaces within strings
24 showtabs=false,            % show tabs within strings adding particular underscores
25 frame=single,              % adds a frame around the code
26 tabsize=2,                 % sets default tabsize to 2 spaces
27 captionpos=b,              % sets the caption-position to bottom
28 breaklines=true,           % sets automatic line breaking
29 breakatwhitespace=false,   % sets if automatic breaks should only happen at whitespace
30 escapeinside={\%*}{*)}     % if you want to add a comment within your code
31 }
32
33 \usepackage{amsmath}       % Provides \nobreakdash
34 \usepackage{graphicx}      % For pictures
35 \usepackage{longtable}     % For multipage tables
36 \usepackage{varioref}      % defines \vref
37 % \textregistered is the trademark symbol
38 \usepackage[headheight=16pt,paper=letterpaper]{geometry}
39 \setlength{\headheight}{15pt}  % avoids warning from latex
40 \usepackage{needspace}     % For assuring space remaining on a page
41 \usepackage{ifthen}        % For conditional processing
42 \usepackage{changepage}    % For odd/even page checks
43 \usepackage{epic}          % For eepic package 
44 \usepackage{eepic}         % For the diagram of section relationships
45 \usepackage{makeidx}       % For making an index
46 % hyperref must be the last package listed.
47 % The hyperref settings helps hypertext get right links in the 
48 % pdf of the index.
49 \usepackage[plainpages=false,pdfpagelabels,pagebackref]{hyperref} % Lets us generate colored active links inside a pdf.
50 \makeindex  % This and the makeidx package allow \index to create index entries.
51
52 \renewcommand{\familydefault}{phv}  % font family helvetica
53
54 \newcommand{\docdate}{31 January 2013}
55
56 \newcommand{\dwf}{DWARF Debugging Information Format}
57
58 \newenvironment{myindentpara}[1]%
59   {\begin{list}{}%
60     {\setlength{\leftmargin}{#1}}%
61     \item[]%
62   }
63   {\end{list}}
64
65 % broken somehow.
66 %\newcommand{\myindent1}[1]{\begin{myindentpara}{1cm}#1\end{myindentpara}}
67
68 \hypersetup{colorlinks=true,
69   %bookmarks=true,
70   pdfauthor={\dwf\ Committee},
71   pdftitle={\dwf\ Version 4.1}
72 }
73
74 % An environment to create a listing-like (boxed) presentation for DWARF examples
75 % Use like \begin{lstlisting}...\end{lstlisting}. Does not do line numbers (boo)
76 % but does full LaTex processing within its scope (unlike \verb).
77 \newsavebox{\savedwf}
78 \newenvironment{dwflisting}{\begin{lrbox}{\savedwf}
79   \begin{minipage}{\textwidth}\footnotesize}
80   {\end{minipage}\end{lrbox}\fbox{\usebox{\savedwf}}}
81 % A helper to annotate the parts of a multipage figure
82 \newcommand{\figurepart}[2]{\raggedleft{\textit{\tiny{part #1 of #2}}}}
83
84 % Generate a page ref.
85 % use like   \refersec{chap:registerbasedaddressing}
86 %\newcommand{\refersec}[1]{\ref{#1} on page \pageref{#1}}
87 \newcommand{\refersec}[1]{\vref{#1}}  % beware possible rerun loop
88 \newcommand{\referfol}[1]{\ref{#1} following}
89
90 % Generate a live link in the document
91 % use like \livelink{chap:DWOPdup}{DW\-\_OP\-\_dup}
92 \newcommand{\livelink}[2]{\hyperlink{#1}{#2}\index{#2}}
93 % use when the index is different from the text and target.
94 \newcommand{\livelinki}[3]{\hyperlink{#1}{#2}\index{#3}}
95 % livetarg is the declaration this is the target of livelinks.
96 % FIXME: we might want livetarg and livetargi  #2 to be \textbf{#2}
97 \newcommand{\livetarg}[2]{\hypertarget{#1}{#2}\index{#2}}
98 % When we want the index entry to look different from the name.
99 \newcommand{\livetargi}[3]{\hypertarget{#1}{#2}\index{#3}}
100
101 \newcommand{\dash}{\nobreakdash-\hspace{0pt}}  % So we handle dashes ok.
102
103 % The following two let us mark a word as 'do not link' or
104 % 'do not index' to indicate the word is used generically
105 % and has been considered so do not index or link it.
106 % There is no significant difference in the two commands, though
107 % \nolink would be more oriented to words such as flag or address
108 % that might be linked (and indexed) in some circumstances.
109 \newcommand{\nolink}[1]{#1}
110 \newcommand{\noindex}[1]{#1}
111
112 % For index entries.
113 \newcommand{\addtoindex}[1]{#1\index{#1}}
114 \newcommand{\addtoindexi}[2]{#1\index{#2}}
115 \newcommand{\addtoindexx}[1]{\index{#1}}
116
117 % Quote commands that avoid need for inline UTF-8 in these sources
118 \newcommand{\doublequote}[1]{\textquotedblleft #1\textquotedblright}
119 \newcommand{\singlequote}[1]{\textquoteleft #1\textquoteright}
120
121 % Better naming for the lowest level section header
122 \newcommand{\subsubsubsection}[1]{\paragraph{#1.}}
123
124 % Issue \clear space if less than n lines remain on page
125 \newcommand{\needlines}[1]{\needspace{#1\baselineskip}}
126
127 % Reduce vertical space at beginning of a list
128 \setlength{\topsep}{0in}
129
130 \newcommand{\emptypage}{
131     \clearpage
132     \vspace*{4in}
133     \begin{center} \textit{(empty page)} \end{center}
134     }
135
136 % A simple rule used in simple tables; default length is 2 inches
137 \newcommand{\simplerule}[1][2in]{\rule[4pt]{#1}{0.5pt}}
138
139 % A simple one column table of names; default width is 2 inches
140 \newcommand{\simplenametablerule}{\simplerule[2in]}
141 \newenvironment{simplenametable}[3][2in]
142     {   \begin{table}[here] \caption{#2} \label{#3}
143         \begin{center}
144         \renewcommand{\simplenametablerule}{\simplerule[#1]}
145         \simplenametablerule \\
146         \begin{tabular*}{#1}{l}
147         }
148     {   \end{tabular*}
149         \vspace{4pt} \\
150         \simplenametablerule \\
151         \end{center}
152         \end{table}
153         }
154
155 %--- Begin the document pages
156 %
157 \begin{document}
158 \frontmatter
159 \thispagestyle{empty}
160
161 \nonzeroparskip
162 \setlength{\parindent}{0pt} 
163 \setlength{\headheight}{6cm}
164 \setlength{\uppermargin}{6cm}
165
166 \begin{centering}
167 \LARGE
168 \textbf{\dwf}
169
170 \textbf{Version 4.1}
171
172 \centering
173 \includegraphics[keepaspectratio=true,scale=1.0]{DWlogo}
174
175 \centering
176 \vspace{3cm}
177 \href{http://www.dwarfstd.org}{\dwf\ Committee}
178
179 \vspace{2cm} 
180 \url{http://www.dwarfstd.org}
181
182 \large
183 \vspace{1in}
184 \textbf{\docdate}
185
186 \end{centering}
187
188 %\clearpage
189 \openany
190
191 \textmd
192 \normalsize
193 \setlength{\headheight}{15pt}  
194
195 \pagestyle{plain}
196 \makeevenhead{plain}{}{}{}
197 \makeoddhead{plain}{}{}{}
198 \makeevenfoot{plain}{}{}{}
199 \makeoddfoot{plain}{}{}{}
200
201 \nonzeroparskip
202 \setlength{\parindent}{0pt} 
203 \settrims{0.5in}{0.5in}
204 \settypeblocksize{8.2in}{6.0in}
205 %\setlrmarginsandblock{0.6in}{0.6in}{*}
206 %\setheadfoot{15pt}{15pt}
207 %\setheaderspaces {*}{2\onelineskip}{*}
208 \nouppercaseheads
209 \makeevenhead{plain}{}{\rightmark}{}
210 \makeoddhead{plain}{}{\rightmark}{}
211 \makeevenfoot{plain}{\docdate}{}{Page \thepage}
212 \makeoddfoot{plain}{\docdate}{}{Page \thepage}
213
214 %\openany
215
216 \nonzeroparskip
217 \setlength{\parindent}{0pt} 
218
219 \flushleft
220 \include{copyright}
221 \include{foreword}
222 \include{foreword4.1}
223 \emptypage
224
225 \cleardoublepage
226 \tableofcontents
227
228 \cleardoublepage
229 \listoffigures
230
231 \cleardoublepage
232 \listoftables
233
234 \flushleft
235 \raggedbottom
236 \chapterstyle{section}
237
238 \setlength{\parindent}{0pt} 
239
240 \makepagestyle{fragFirstChPage}
241     \makeevenhead{fragFirstChPage}{}{}{}
242     \makeoddhead{fragFirstChPage}{}{}{}
243     \makeoddfoot{fragFirstChPage}{\docdate}{}{Page \thepage}
244     \makeevenfoot{fragFirstChPage}{\docdate}{}{Page \thepage}
245 \nouppercaseheads
246 \aliaspagestyle{chapter}{fragFirstChPage}
247
248 % ----- Start the main part of the document -----
249 \mainmatter
250 % Define the levels of sectionality that are numbered.
251 \setcounter{secnumdepth}{5}
252 \include{introduction}
253 \include{generaldescription}            %\emptypage
254 \include{programscope}                  \emptypage
255 \include{dataobject}                    \emptypage
256 \include{typeentries}                   \emptypage
257 \include{otherdebugginginformation}
258 \include{datarepresentation}            \emptypage
259 %  The \appendix toggles us into appendix chapters
260 \appendix
261 \include{attributesbytag}
262 \include{debugsectionrelationships}     \emptypage
263 \include{encodingdecoding}              \emptypage
264 \include{examples}                      \emptypage
265 \include{compression}                   \emptypage
266 \include{sectionversionnumbers}
267 \include{gnulicense}
268 \printindex
269 \end{document}