Backup of today's work. Still awaiting a couple more editorial inputs.
[dwarf-doc.git] / dwarf5 / latexdoc / dwarf5.tex
index 5cb951a..d018d5f 100644 (file)
@@ -3,13 +3,14 @@
 % If draft is in the document class list, pix are just suggested
 % by an outline, the pic does not appear as a picture.
 %
-\newcommand{\docdate}{August 28, 2015}
+\newcommand{\docdate}{January 24, 2017}
 %
 \usepackage{ifthen}
     \newcommand{\ifthen}[2]{\ifthenelse{#1}{#2}{}}
     \newboolean{isdraft}\setboolean{isdraft}{true}
-    \newboolean{uselinenos}\setboolean{uselinenos}{true}
-\newcommand{\draftmark}{\ifthenelse{\boolean{isdraft}}{*** DRAFT ***}{}}
+    \newboolean{uselinenumbers}\setboolean{uselinenumbers}{true}
+    \newboolean{usechangesummary}\setboolean{usechangesummary}{false}
+\newcommand{\draftmark}{\ifthenelse{\boolean{isdraft}}{***PRE-RELEASE STANDARD DRAFT \#2***}{}}
 %
 \usepackage[T1]{fontenc}
 \usepackage{palatino}
@@ -18,7 +19,7 @@
 \usepackage{url}          % for color in letters. Links instead?
 \usepackage[usenames]{color}%for color in letters. Links instead?
 \usepackage{ellipsis}     % provides ... as \dots
-\usepackage[utf8]{inputenc}% to type directly diacritic characters
+%\usepackage[utf8]{inputenc}% to type directly diacritic characters
 %\usepackage{color}
 \usepackage{listings}
 \usepackage{alltt}
@@ -49,7 +50,11 @@ escapeinside={\%*}{*)}     % if you want to add a comment within your code
 \usepackage{graphicx}      % For pictures
 \usepackage{epstopdf}      % Autoconvert .eps to .pdf
     \epstopdfsetup{suffix=-generated} % Mark generaed PDF as such
-\usepackage{lineno}        % line numbers
+\usepackage[pagewise]{lineno} % line numbers
+    \pagewiselinenumbers
+    \setlength\linenumbersep{3em}
+    \renewcommand\linenumberfont{\normalfont\itshape\tiny} 
+    \nolinenumbers    
 \usepackage{longtable}     % For multipage tables
 \usepackage{hhline}        % Single column horizontal lines
 \usepackage{varioref}      % defines \vref
@@ -58,6 +63,7 @@ escapeinside={\%*}{*)}     % if you want to add a comment within your code
     \setlength{\headheight}{15pt}  % avoids warning from latex
 \usepackage{needspace}     % For assuring space remaining on a page
 \usepackage{ifthen}        % For conditional processing
+\include{dwarfchangebarpatch} % Patch needed for package changebar
 \usepackage{changepage}    % For odd/even page checks
 \usepackage[usenames,dvipsnames]{xcolor}
 \usepackage{lscape}        % For landscape mode (Appendix B)
@@ -72,13 +78,15 @@ escapeinside={\%*}{*)}     % if you want to add a comment within your code
     \usetikzlibrary{shapes.multipart}
     \usetikzlibrary{shapes.symbols}
 \usepackage{changebar}     % For change bars in margin
+\usepackage{xspace}
 \usepackage{makeidx}       % For making an index
 % hyperref must be the last package listed.
 % The hyperref settings helps hypertext get links right in the 
 % pdf of the index. 
 % Also, allcolors lets us generate colored active links inside a pdf.
 % And breaklinks resolves truncation issues with very long link names.
-\usepackage[breaklinks,plainpages=false,pdfpagelabels,pagebackref,allcolors=blue,bookmarksnumbered=true]{hyperref}
+\usepackage[breaklinks,plainpages=false,pdfpagelabels,pagebackref,
+            allcolors=blue!80!black,bookmarksnumbered=true]{hyperref}
 \makeindex  % This and the makeidx package allow \index to create index entries.
 
 \newcommand{\dwf}{DWARF Debugging Information Format}
@@ -96,13 +104,32 @@ escapeinside={\%*}{*)}     % if you want to add a comment within your code
   pdftitle={\dwf\ Version 5}
 }
 
-% 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).
+% An environment to create a listing-like (boxed) presentation for 
+% DWARF examples Use like \begin{nlnlisting}...\end{nlnlisting}. 
+% Does not do line numbers 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}}}
+\newenvironment{dwflisting}
+  {\nolinenumbers\begin{lrbox}{\savedwf}\begin{minipage}{\textwidth}\footnotesize}
+  {\end{minipage}\end{lrbox}\fbox{\usebox{\savedwf}} 
+   \condlinenumbers}
+
+% Conditionally turn on line numbers
+\newcommand{\condlinenumbers}{\ifthen{\boolean{uselinenumbers}}{\linenumbers}}
+
+% An environment that turns off line numbers then conditionally turns
+% them back on at the end
+\newenvironment{nolinenumbersenv}
+    {\nolinenumbers}
+    {\par\condlinenumbers}
+
+% An environment like lstlisting that is wrapped to prevent the
+% contents of the listing from having line numbers generated by
+% the lineno package
+\lstnewenvironment{nlnlisting}    % listing-specific newenvironment command
+    {\nolinenumbers}
+    {\condlinenumbers}
+    
 % A helper to annotate the parts of a multipage figure
 \newcommand{\figurepart}[2]{\raggedleft{\textit{\tiny{part #1 of #2}}}}
 
@@ -115,8 +142,8 @@ escapeinside={\%*}{*)}     % if you want to add a comment within your code
 \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}
+% Generate a live link in the document that gets indexed as well
+% 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}}
@@ -141,13 +168,17 @@ escapeinside={\%*}{*)}     % if you want to add a comment within your code
 
 % For index entries. The tt-variant of each pair is designed to
 % allow a word to appear in tt font in the main test and the index
-% but to collate in the index in its non-tt order. (LaTex normally
-% sorts all tt words before all non-tt words.)
+% but to collate in the index in its non-tt order. Similarly for
+% the it-variant using italics font. 
+% (LaTex normally % sorts all tt words before all non-tt words.)
 \newcommand{\addtoindex}[1]{#1\index{#1}}
+\newcommand{\additindex}[1]{\textit{#1}\index{#1@\textit{#1}}}
 \newcommand{\addttindex}[1]{\texttt{#1}\index{#1@\texttt{#1}}}
 \newcommand{\addtoindexi}[2]{#1\index{#2}}
+\newcommand{\additindexi}[2]{\textit{#1}\index{#2@\textit{#2}}}
 \newcommand{\addttindexi}[2]{\texttt{#1}\index{#2@\texttt{#2}}}
 \newcommand{\addtoindexx}[1]{\index{#1}}
+\newcommand{\additindexx}[1]{\index{#1@\textit{#1}}}
 \newcommand{\addttindexx}[1]{\index{#1@\texttt{#1}}}
 
 % Quote commands that avoid need for inline UTF-8 in these sources
@@ -156,12 +187,9 @@ escapeinside={\%*}{*)}     % if you want to add a comment within your code
 
 % Better naming for the lowest level section header
 \newcommand{\subsubsubsection}[1]{\paragraph{#1}~\newline}
-%\newcommand{\subsubsubsubsection}[1]{\subparagraph{#1}.~}  %% Huh?
 \newcommand{\subsubsubsubsection}[1]{\textbf{#1}.~~}
-%\newcommand{\subsubsubsection}         %% Has to be in a style file--ugh...
-%   {\@startsection{subsubsubsection}{4}{0mm}{-\baselineskip}{\baselineskip}{\normalfont\normalsize\itshap}}
 
-% Issue \clearpage if less than n lines remain on page
+% Start new page if less than n lines remain on current page
 \newcommand{\needlines}[1]{\needspace{#1\baselineskip}}
 
 % Helper for item lists with bold subject markers
@@ -172,6 +200,12 @@ escapeinside={\%*}{*)}     % if you want to add a comment within your code
 \renewcommand{\descriptionlabel}[1]{\hspace{\labelsep}\textnormal{#1}}
 \newcommand{\descriptionlabelnl}[1]{\item[#1] \mbox{}\\}
 
+% Define an alternate footnote command that creates ragged right text
+% (using \raggedright in the parameter does not work)
+\newcommand\footnoteRR[1]{\footnote{\raggedright#1}}
+
+% Emit an empty page
+%
 \newcommand{\emptypage}{
     \clearpage
     \vspace*{4in}
@@ -195,7 +229,7 @@ escapeinside={\%*}{*)}     % if you want to add a comment within your code
 % A simple one column table of names; default width is 2 inches
 \newcommand{\simplenametablerule}{\simplerule[2in]}
 \newenvironment{simplenametable}[3][2in]
-    {   \begin{table}[h] \caption{#2} \label{#3}
+    {   \begin{table}[ht] \caption{#2} \label{#3}
         \begin{center}
         \renewcommand{\simplenametablerule}{\simplerule[#1]}
         \simplenametablerule \\
@@ -211,16 +245,21 @@ escapeinside={\%*}{*)}     % if you want to add a comment within your code
 % Complement of \isundefined
 \newcommand{\isdefined}[1]{\not{\isundefined{#1}}}
 
-\newcommand{\uselinenos}{\ifthen{\boolean{uselinenos}}{\linenumbers*}}
-
-% Preferred changebar asliases
+% Preferred changebar aliases
 \newcommand{\bb}{\cbstart}      % Begin (change) bar
 \newcommand{\eb}{\cbend}        % End (change) bar
-\newcommand{\bbpareb}{\bb~\eb\vspace{-1.5\baselineskip}} % Mark deleted paragraph
+\newcommand{\bbeb}{\bb\eb}      % Mark deleted word or phrase
+% Mark deleted paragraph
+\newcommand{\bbpareb}{\vspace{-0.6\baselineskip}\bb~\eb\vspace{-0.6\baselineskip}} 
+% Variations for use inside an alltt environment--But don't work!
+%\newcommand(\bballtt){\end{alltt}\bb\vspace{-0.8\baselineskip}\begin{alltt}}
+%\newcommand{\eballtt}{\end{alltt}\eb\vspace{-0.8\baselineskip}\begin{alltt}}
+%\newcommand(\bbeballtt){\end{alltt}\bb\eb\vspace{-0.8\baselineskip}\begin{alltt}}
 
 % Define commands for all of the DWARF names (DW\_*, .debug_*, a few others)
 %
-\newcommand{\definition}[1]{\textcolor{red!80!black}{#1}}
+%\newcommand{\definition}[1]{\textcolor{red!80!black}{#1}}
+\newcommand{\definition}[1]{\textcolor{red!65!black}{#1}}
 \newcommand{\definitionx}[1]{\definition{\addtoindex{#1}}}
 \include{dwarfnamecmds}
 
@@ -228,7 +267,9 @@ escapeinside={\%*}{*)}     % if you want to add a comment within your code
 %
 \include{pgfcmdsfornameindexfig}
 
-%--- Begin the document pages
+% --------------------------------
+% --- Begin the document pages ---
+% --------------------------------
 %
 \begin{document}
 \frontmatter
@@ -306,8 +347,8 @@ escapeinside={\%*}{*)}     % if you want to add a comment within your code
 \clearpage
 \listoftables
 
-\ifthenelse{\boolean{isdraft}}
-       {       %\emptypage
+\ifthenelse{\boolean{usechangesummary}}
+       {       \emptypage
                {% Environment to keep the following header change local
                \clearpage
                \makeevenhead{plain}{}{Change Summary}{}
@@ -315,7 +356,7 @@ escapeinside={\%*}{*)}     % if you want to add a comment within your code
                \include{changesummary}
                 %\emptypage
                }
-       }{}
+       }{\emptypage}
 %\cleardoublepage
 \flushleft
 \raggedbottom
@@ -336,30 +377,27 @@ escapeinside={\%*}{*)}     % if you want to add a comment within your code
 % Define the levels of sectionality that are numbered.
 \setcounter{secnumdepth}{5}
 
-\uselinenos\include{introduction}              %\emptypage
-\uselinenos\include{generaldescription}        %\emptypage
-\uselinenos\include{programscope}              \emptypage
-\uselinenos\include{dataobject}                %\emptypage
-\uselinenos\include{typeentries}               %\emptypage
-\uselinenos\include{otherdebugginginformation} \emptypage
-\uselinenos\include{datarepresentation}        %\emptypage
+\condlinenumbers\include{introduction}              \emptypage
+\condlinenumbers\include{generaldescription}        %\emptypage
+\condlinenumbers\include{programscope}              \emptypage
+\condlinenumbers\include{dataobject}                \emptypage
+\condlinenumbers\include{typeentries}               %\emptypage
+\condlinenumbers\include{otherdebugginginformation} %\emptypage
+\condlinenumbers\include{datarepresentation}        %\emptypage
 
 %  The \appendix command toggles us into appendix chapters
 \appendix
 
-\uselinenos\include{attributesbytag}          %\emptypage
-\uselinenos\include{debugsectionrelationships} \emptypage
-\uselinenos\include{encodingdecoding}          \emptypage
-\uselinenos\include{examples}                  %\emptypage
-\uselinenos\include{compression}               \emptypage
-\uselinenos\include{splitobjects}             \emptypage
-\uselinenos\include{sectionversionnumbers}     \emptypage
+\condlinenumbers\include{attributesbytag}              %\emptypage
+\condlinenumbers\include{debugsectionrelationships} \emptypage
+\condlinenumbers\include{encodingdecoding}          \emptypage
+\condlinenumbers\include{examples}                  %\emptypage
+\condlinenumbers\include{compression}               \emptypage
+\condlinenumbers\include{splitobjects}             \emptypage
+\condlinenumbers\include{sectionversionnumbers}     \emptypage
 \nolinenumbers
 \include{gnulicense}                           \emptypage
-
 % Maybe someday the selected glossary concept will be of interest...
-%\include{selectedglossary}             %\emptypage
-
-\printindex
-
+%\include{selectedglossary}                    %\emptypage
+\printindex                                    \clearpage
 \end{document}