This is the first pass of incorporating review commments from the
[dwarf-doc.git] / dwarf5 / latexdoc / dwarf5.tex
index 84bb385..6544b90 100644 (file)
@@ -1,56 +1,67 @@
-\documentclass[12pt,letterpaper,oneside]{memoir} 
+\documentclass[12pt,letterpaper,twoside]{memoir} 
 % for debugging, add 'draft' (without quotes) to the [] document class list.
 % If draft is in the document class list, pix are just suggested
 % by an outline, the pic does not appear as a picture.
 %
-\usepackage{url} % For color in letters. Links instead?
-\usepackage{color} % For color in letters. Links instead?
-\usepackage{ellipsis} % Provides ... as \dots
-\usepackage{color}
+\newcommand{\docdate}{19 April 2013 (***Draft***)}
+%
+\usepackage{url}                  % For color in letters. Links instead?
+\usepackage[usenames]{color} % For color in letters. Links instead?
+\usepackage{ellipsis}     % Provides ... as \dots
+%\usepackage{color}
 \usepackage{listings}
 \usepackage{alltt}
 \lstset{ %
-language=C++,              % choose the language of the code
+language={},               % choose the language of the code
 basicstyle=\footnotesize,  % the size of the fonts that are used for the code
 numbers=left,              % where to put the line-numbers
 numberstyle=\footnotesize, % the size of the fonts that are used for the line-numbers
-stepnumber=1,              % the step between two line-numbers. If it is 1 each line will be numbered
-numbersep=5pt,             % how far the line-numbers are from the code
+numberfirstline=true,
+firstnumber=1,             % first line number in each listing
+stepnumber=5,              % the step between two line-numbers. If it is 1 each line will be numbered
+numbersep=10pt,            % how far the line-numbers are from the code
 backgroundcolor=\color{white}, % choose the background color. You must add \usepackage{color}
 showspaces=false,          % show spaces adding particular underscores
 showstringspaces=false,    % underline spaces within strings
 showtabs=false,            % show tabs within strings adding particular underscores
-frame=single,           % adds a frame around the code
-tabsize=2,              % sets default tabsize to 2 spaces
-captionpos=b,           % sets the caption-position to bottom
-breaklines=true,        % sets automatic line breaking
-breakatwhitespace=false,% sets if automatic breaks should only happen at whitespace
-escapeinside={\%*}{*)}  % if you want to add a comment within your code
+frame=single,              % adds a frame around the code
+tabsize=2,                 % sets default tabsize to 2 spaces
+captionpos=b,              % sets the caption-position to bottom
+breaklines=true,           % sets automatic line breaking
+breakatwhitespace=false,   % sets if automatic breaks should only happen at whitespace
+escapeinside={\%*}{*)}     % if you want to add a comment within your code
 }
 
-\usepackage{amsmath} % Provides \nobreakdash
-\usepackage{graphicx} % For pictures
-\usepackage{longtable}
+\usepackage{amsmath}       % Provides \nobreakdash
+\usepackage{graphicx}      % For pictures
+\usepackage{longtable}     % For multipage tables
+\usepackage{varioref}      % defines \vref
 % \textregistered is the trademark symbol
 \usepackage[headheight=16pt,paper=letterpaper]{geometry}
 \setlength{\headheight}{15pt}  % avoids warning from latex
-\usepackage{epic} % For eepic package 
-\usepackage{eepic} % For the diagram of section relationships
-\usepackage{makeidx}
+\usepackage{needspace}     % For assuring space remaining on a page
+\usepackage{ifthen}        % For conditional processing
+\usepackage{changepage}    % For odd/even page checks
+\usepackage{epic}          % For eepic package 
+\usepackage{eepic}         % For the diagram of section relationships
+\usepackage{eepicemu}      % For the diagram of section relationships
+\usepackage{makeidx}       % For making an index
 % hyperref must be the last package listed.
-% hypertextnames=false helps hypertext get right links.
-\usepackage[hypertexnames=false]{hyperref}  % Lets us generate colored active links inside a pdf.
+% The hyperref settings helps hypertext get right links in the 
+% pdf of the index.
+\usepackage[plainpages=false,pdfpagelabels,pagebackref,allcolors=blue]{hyperref} % Lets us generate colored active links inside a pdf.
 \makeindex  % This and the makeidx package allow \index to create index entries.
 
-\newcommand{\docdate}{13 May 2012}
+\renewcommand{\familydefault}{phv}  % font family helvetica
 
 \newcommand{\dwf}{DWARF Debugging Information Format}
+
 \newenvironment{myindentpara}[1]%
- {\begin{list}{}%
-   {\setlength{\leftmargin}{#1}}%
-   \item[]%
- }
- {\end{list}}
 {\begin{list}{}%
+    {\setlength{\leftmargin}{#1}}%
+    \item[]%
 }
 {\end{list}}
 
 % broken somehow.
 %\newcommand{\myindent1}[1]{\begin{myindentpara}{1cm}#1\end{myindentpara}}
@@ -61,29 +72,113 @@ escapeinside={\%*}{*)}  % if you want to add a comment within your code
   pdftitle={\dwf\ Version 4.1}
 }
 
+% An environment to create a listing-like (boxed) presentation for DWARF examples
+% Use like \begin{lstlisting}...\end{lstlisting}. Does not do line numbers (boo)
+% but does full LaTex processing within its scope (unlike \verb).
+\newsavebox{\savedwf}
+\newenvironment{dwflisting}{\begin{lrbox}{\savedwf}
+  \begin{minipage}{\textwidth}\footnotesize}
+  {\end{minipage}\end{lrbox}\fbox{\usebox{\savedwf}}}
+% A helper to annotate the parts of a multipage figure
+\newcommand{\figurepart}[2]{\raggedleft{\textit{\tiny{part #1 of #2}}}}
+
 % Generate a page ref.
 % use like   \refersec{chap:registerbasedaddressing}
-\newcommand{\refersec}[1]{ \ref{#1} Page \pageref{#1} }
-
-%Generate a live link into the doc
-% use like \livelink{DW\_OP\_dup}{chap:DWOPdup}
-\newcommand{\livelink}[2]{ \hyperref[#2]{#1} }
+%\newcommand{\refersec}[1]{\ref{#1} on page \pageref{#1}}
+\newcommand{\refersec}[1]{\vref{#1}}  % beware possible rerun loop
+\newcommand{\referfol}[1]{\ref{#1} following}
+
+% Generate a live link in the document
+% use like \livelink{chap:DWOPdup}{DW\-\_OP\-\_dup}
+\newcommand{\livelink}[2]{\hyperlink{#1}{#2}\index{#2}}
+% use when the index is different from the text and target.
+\newcommand{\livelinki}[3]{\hyperlink{#1}{#2}\index{#3}}
+% livetarg is the declaration this is the target of livelinks.
+% FIXME: we might want livetarg and livetargi  #2 to be \textbf{#2}
+\newcommand{\livetarg}[2]{\hypertarget{#1}{#2}\index{#2}}
+% When we want the index entry to look different from the name.
+\newcommand{\livetargi}[3]{\hypertarget{#1}{#2}\index{#3}}
 
 \newcommand{\dash}{\nobreakdash-\hspace{0pt}}  % So we handle dashes ok.
 
-%Fors simple index entries, this saves typing.
-\newcommand{\addtoindex}[1]{#1\index{#1}}
-
+% The following two let us mark a word as 'do not link' or
+% 'do not index' to indicate the word is used generically
+% and has been considered so do not index or link it.
+% There is no significant difference in the two commands, though
+% \nolink would be more oriented to words such as flag or address
+% that might be linked (and indexed) in some circumstances.
+\newcommand{\nolink}[1]{#1}
+\newcommand{\noindex}[1]{#1}
 
+% For index entries.
+\newcommand{\addtoindex}[1]{#1\index{#1}}
+\newcommand{\addtoindexi}[2]{#1\index{#2}}
+\newcommand{\addtoindexx}[1]{\index{#1}}
+
+% Quote commands that avoid need for inline UTF-8 in these sources
+\newcommand{\doublequote}[1]{\textquotedblleft #1\textquotedblright}
+\newcommand{\singlequote}[1]{\textquoteleft #1\textquoteright}
+
+% Better naming for the lowest level section header
+\newcommand{\subsubsubsection}[1]{\paragraph{#1.}}
+
+% Issue \clearpage if less than n lines remain on page
+\newcommand{\needlines}[1]{\needspace{#1\baselineskip}}
+
+% Helper for item lists with bold subject markers
+\newcommand{\itembf}[1]{\item \textbf{#1}}
+\newcommand{\itembfnl}[1]{\itembf{#1} \\}
+
+% And description lists with normal (not bold) text
+\renewcommand{\descriptionlabel}[1]{\hspace{\labelsep}\textnormal{#1}}
+\newcommand{\descriptionlabelnl}[1]{\item[#1] \mbox{}\\}
+
+% Reduce vertical space at beginning of a list
+\setlength{\topsep}{0in}
+
+\newcommand{\emptypage}{
+    \clearpage
+    \vspace*{4in}
+    \begin{center} \textit{(empty page)} \end{center}
+    }
+
+% A simple rule used in simple tables; default length is 2 inches
+\newcommand{\simplerule}[1][2in]{\rule[4pt]{#1}{0.5pt}}
+
+% A simple one column table of names; default width is 2 inches
+\newcommand{\simplenametablerule}{\simplerule[2in]}
+\newenvironment{simplenametable}[3][2in]
+    {   \begin{table}[here] \caption{#2} \label{#3}
+        \begin{center}
+        \renewcommand{\simplenametablerule}{\simplerule[#1]}
+        \simplenametablerule \\
+        \begin{tabular*}{#1}{l}
+        }
+    {   \end{tabular*}
+        \vspace{4pt} \\
+        \simplenametablerule \\
+        \end{center}
+        \end{table}
+        }
+
+\newcommand{\xffffffff}                {\texttt{0xffffffff}}                   % use with following punctutation
+\newcommand{\wffffffff}                {\texttt{0xffffffff}\ }                 % use as separate "word"
+\newcommand{\xfffffffzero}             {\texttt{0xfffffff0}}                   % use with following punctutation
+\newcommand{\wfffffffzero}             {\texttt{0xfffffff0}\ }
+\newcommand{\xffffffffffffffff}        {\texttt{0xffffffffffffffff}}   % use with following punctutation
+\newcommand{\wffffffffffffffff}        {\texttt{0xffffffffffffffff}\ }
+
+%--- Begin the document pages
+%
 \begin{document}
-\pagestyle{empty}
+\frontmatter
+\thispagestyle{empty}
+
 \nonzeroparskip
 \setlength{\parindent}{0pt} 
 \setlength{\headheight}{6cm}
 \setlength{\uppermargin}{6cm}
 
-
-
 \begin{centering}
 \LARGE
 \textbf{\dwf}
@@ -91,30 +186,34 @@ escapeinside={\%*}{*)}  % if you want to add a comment within your code
 \textbf{Version 4.1}
 
 \centering
-\includegraphics[keepaspectratio=true,scale=0.5]{DWlogo}
+\vspace{1cm}
+\includegraphics[keepaspectratio=true,scale=1.0]{dwarf-logo}
 
-\centering
-\href{http://www.dwarfstd.org}{\dwf\ Committee} 
+%\centering
+\vspace{2cm}
+\href{http://www.dwarfstd.org}{\dwf\ Committee}
 
+\vspace{1cm} 
 \url{http://www.dwarfstd.org}
 
+\large
+\vspace{2cm}
 \textbf{\docdate}
 
 \end{centering}
-\openany
-\clearpage
-\openany
 
-\frontmatter
+%\clearpage
+%\openany
+
 \textmd
 \normalsize
 \setlength{\headheight}{15pt}  
 
 \pagestyle{plain}
-\makeevenhead{plain}{}{}{}
-\makeoddhead{plain}{}{}{}
-\makeevenfoot{plain}{}{}{}
-\makeoddfoot{plain}{}{}{}
+%\makeevenhead{plain}{}{}{}
+%\makeoddhead{plain}{}{}{}
+%\makeevenfoot{plain}{}{}{}
+%\makeoddfoot{plain}{}{}{}
 
 \nonzeroparskip
 \setlength{\parindent}{0pt} 
@@ -129,57 +228,58 @@ escapeinside={\%*}{*)}  % if you want to add a comment within your code
 \makeevenfoot{plain}{\docdate}{}{Page \thepage}
 \makeoddfoot{plain}{\docdate}{}{Page \thepage}
 
-\openany
-\pagenumbering{roman}
+%\openany
+
 \nonzeroparskip
 \setlength{\parindent}{0pt} 
 
+\flushleft
 \include{copyright}
 \include{foreword}
+\include{foreword4.1}
+\emptypage
 
+\newpage
 \tableofcontents
+
+\cleardoublepage
 \listoffigures
-\listoftables
 
-\mainmatter
+\cleardoublepage
+\listoftables
 
-% Define the levels of sectionality that are numbered.
-\setcounter{secnumdepth}{5}
+\flushleft
+\raggedbottom
+\chapterstyle{section}
 
-\nonzeroparskip
 \setlength{\parindent}{0pt} 
 
 \makepagestyle{fragFirstChPage}
-
-\makeevenhead{fragFirstChPage}{}{}{}
-\makeoddhead{fragFirstChPage}{}{}{}
-\makeoddfoot{fragFirstChPage}{\docdate}{}{Page \thepage}
-\makeevenfoot{fragFirstChPage}{\docdate}{}{Page \thepage}
-
-\aliaspagestyle{chapter}{fragFirstChPage}
-
-
-
-\chapterstyle{section}
-\pagenumbering{arabic}
-
+    \makeevenhead{fragFirstChPage}{}{}{}
+    \makeoddhead{fragFirstChPage}{}{}{}
+    \makeoddfoot{fragFirstChPage}{\docdate}{}{Page \thepage}
+    \makeevenfoot{fragFirstChPage}{\docdate}{}{Page \thepage}
+\nouppercaseheads
 \aliaspagestyle{chapter}{fragFirstChPage}
 
-
+% ----- Start the main part of the document -----
+\mainmatter
+% Define the levels of sectionality that are numbered.
+\setcounter{secnumdepth}{5}
 \include{introduction}
-\include{generaldescription}
-\include{programscope}
-\include{dataobject}
-\include{typeentries}
-\include{otherdebugginginformation}
-\include{datarepresentation}
+\include{generaldescription}            \emptypage
+\include{programscope}                  \emptypage
+\include{dataobject}                    \emptypage
+\include{typeentries}                   \emptypage
+\include{otherdebugginginformation} \emptypage
+\include{datarepresentation}            %\emptypage
 %  The \appendix toggles us into appendix chapters
 \appendix
 \include{attributesbytag}
-\include{appendixdebugrelationships}
-\include{encodingdecoding}
-\include{examples}
-\include{compression}
+\include{debugsectionrelationships}     %\emptypage
+\include{encodingdecoding}              \emptypage
+\include{examples}                      %\emptypage
+\include{compression}                   %\emptypage
 \include{sectionversionnumbers}
 \include{gnulicense}
 \printindex