Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/LaTeXmacros/common.tex

    rb52d900 r9724df0  
    1111%% Created On       : Sat Apr  9 10:06:17 2016
    1212%% Last Modified By : Peter A. Buhr
    13 %% Last Modified On : Sat Apr  9 10:06:39 2016
    14 %% Update Count     : 1
     13%% Last Modified On : Mon Jun 20 09:35:20 2016
     14%% Update Count     : 178
    1515%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1616
    1717%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1818
     19\setlength{\textheight}{9in}
     20%\oddsidemargin 0.0in
     21\renewcommand{\topfraction}{0.8}        % float must be greater than X of the page before it is forced onto its own page
     22\renewcommand{\bottomfraction}{0.8}     % float must be greater than X of the page before it is forced onto its own page
     23\renewcommand{\floatpagefraction}{0.8}  % float must be greater than X of the page before it is forced onto its own page
     24\renewcommand{\textfraction}{0.0}       % the entire page maybe devoted to floats with no text on the page at all
     25
     26\lefthyphenmin=4
     27\righthyphenmin=4
     28
     29\usepackage{pslatex}                            % reduce size of san serif font
     30
     31\usepackage[ignoredisplayed]{enumitem}  % do not affect trivlist
     32\setlist{labelsep=1ex}% global
     33\setlist[itemize]{topsep=0.5ex,parsep=0.25ex,itemsep=0.25ex,listparindent=\parindent,leftmargin=\parindent}% global
     34\setlist[itemize,1]{label=\textbullet}% local
     35%\renewcommand{\labelitemi}{{\raisebox{0.25ex}{\footnotesize$\bullet$}}}
     36\setlist[enumerate]{listparindent=\parindent}% global
     37\setlist[enumerate,2]{leftmargin=\parindent,labelsep=*,align=parleft,label=\alph*.}% local
     38\setlist[description]{listparindent=\parindent,leftmargin=\parindent,labelsep=*}
     39
    1940% Names used in the document.
    2041
    21 \newcommand{\CFA}{C$\mathbf\forall$\xspace}                             % set language symbolic name
    22 \newcommand{\CFL}{Cforall\xspace}                                               % set language text name
    23 \newcommand{\CC}{C\kern-.1em\hbox{+\kern-.25em+}\xspace} % CC symbolic name
     42\newcommand{\CFA}{C$\mathbf\forall$\xspace}              % set language symbolic name
     43\newcommand{\CFL}{Cforall\xspace}                        % set language text name
     44\newcommand{\CC}{\rm C\kern-.1em\hbox{+\kern-.25em+}\xspace} % CC symbolic name
    2445\def\c11{ISO/IEC C} % C11 name (cannot have numbers in latex command name)
    2546
     
    2748
    2849\makeatletter
     50% parindent is relative, i.e., toggled on/off in environments like itemize, so store the value for
     51% use rather than use \parident directly.
     52\newlength{\parindentlnth}
     53\setlength{\parindentlnth}{\parindent}
     54
    2955% allow escape sequence in lstinline
    3056%\usepackage{etoolbox}
    3157%\patchcmd{\lsthk@TextStyle}{\let\lst@DefEsc\@empty}{}{}{\errmessage{failed to patch}}
    3258
    33 % make fontsize "small" slightly larger, specifically for san serif (helvetica) in program code
    34 \renewcommand\small{%
    35    \@setfontsize\small{8.5}{11}%
    36    \abovedisplayskip 8.5pt \@plus 3pt \@minus 4pt
    37    \abovedisplayshortskip \z@ \@plus 2pt
    38    \belowdisplayshortskip 4pt \@plus 2pt \@minus 2pt
    39    \def\@listi{\leftmargin\leftmargini
    40                \topsep 4pt \@plus 2pt \@minus 2pt
    41                \parsep 2pt \@pluspt \@minuspt
    42                \itemsep \parsep}%
    43    \belowdisplayskip \abovedisplayskip
    44 }
    45 \usepackage{relsize}                                                                    % must be after change to small or selects old size
     59\usepackage{pslatex}                                                                    % reduce size of san serif font
     60\usepackage{relsize}                                    % must be after change to small or selects old size
    4661
    4762% reduce size of chapter/section titles
     
    6681    \vskip 50\p@
    6782  }}
    68 \renewcommand\section{\@startsection{section}{1}{\z@}{-3.0ex \@plus -1ex \@minus -.2ex}{1.0ex \@plus .2ex}{\normalfont\large\bfseries}}
    69 \renewcommand\subsection{\@startsection{subsection}{2}{\z@}{-2.5ex \@plus -1ex \@minus -.2ex}{1.0ex \@plus .2ex}{\normalfont\normalsize\bfseries}}
     83\renewcommand\section{\@startsection{section}{1}{\z@}{-3.5ex \@plus -1ex \@minus -.2ex}{1.75ex \@plus .2ex}{\normalfont\large\bfseries}}
     84\renewcommand\subsection{\@startsection{subsection}{2}{\z@}{-3.25ex \@plus -1ex \@minus -.2ex}{1.5ex \@plus .2ex}{\normalfont\normalsize\bfseries}}
    7085\renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}{-2.5ex \@plus -1ex \@minus -.2ex}{1.0ex \@plus .2ex}{\normalfont\normalsize\bfseries}}
    7186\renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}{-2.0ex \@plus -1ex \@minus -.2ex}{-1em}{\normalfont\normalsize\bfseries}}
     
    7590\newcommand{\definition}[1]{\textbf{\hyperpage{#1}}}
    7691\newcommand{\see}[1]{\emph{see} #1}
    77 
    78 % reduce bullet size and spacing for "itemize" macro
    79 \renewcommand{\labelitemi}{{\raisebox{0.25ex}{\footnotesize$\bullet$}}}
    80 \renewenvironment{itemize}{\begin{list}{\labelitemi}{\topsep=5pt\itemsep=5pt\parsep=0pt}}{\end{list}}
    8192
    8293% Define some commands that produce formatted index entries suitable for cross-references.
     
    109120\newcommand{\@sIndex}[2][\@empty]{#2\ifx#1\@empty\index{#2}\else\index{#1@{\protect#2}}\fi}
    110121
     122\newcommand{\Indexc}[1]{\lstinline$#1$\index{#1@\lstinline$#1$}}
     123\newcommand{\indexc}[1]{\index{#1@\lstinline$#1$}}
     124
    111125\newcommand{\newtermFontInline}{\emph}
    112126\newcommand{\newterm}{\@ifstar\@snewterm\@newterm}
     
    116130
    117131\newenvironment{quote2}{%
    118         \list{}{\lstset{resetmargins=true}\leftmargin=\parindent\rightmargin\leftmargin}%
     132        \list{}{\lstset{resetmargins=true,aboveskip=0pt,belowskip=0pt}\topsep=4pt\parsep=0pt\leftmargin=\parindent\rightmargin\leftmargin}%
    119133        \item\relax
    120134}{%
     
    122136}% quote2
    123137\newenvironment{rationale}{%
    124   \begin{quotation}\noindent$\Box$\enspace
     138  \begin{quote2}\noindent$\Box$\enspace
    125139}{%
    126   \hfill\enspace$\Box$\end{quotation}
     140  \hfill\enspace$\Box$\end{quote2}
    127141}%
    128142
    129143% blocks and titles
    130144\newcommand{\define}[1]{\emph{#1\/}\index{#1}}
    131 \newcommand{\rewrite}{\(\Rightarrow\)}
    132145\newcommand{\rewriterules}{\paragraph{Rewrite Rules}~\par\noindent}
    133146\newcommand{\examples}{\paragraph{Examples}~\par\noindent}
     
    137150
    138151% BNF macros
    139 \def\syntax{\paragraph{Syntax}\trivlist\parindent=.5in\item[\hskip.5in]}
    140 \let\endsyntax=\endtrivlist
    141 \newcommand{\lhs}[1]{\par{\emph{#1:}}\index{#1@{\emph{#1}}|italic}}
    142 \newcommand{\rhs}{\hfil\break\hbox{\hskip1in}}
    143 \newcommand{\oldlhs}[1]{\emph{#1: \ldots}\index{#1@{\emph{#1}}|italic}}
    144 \newcommand{\nonterm}[1]{\emph{#1\/}\index{#1@{\emph{#1}}|italic}}
     152\newenvironment{syntax}{
     153\paragraph{Syntax}
     154\begin{quote2}
     155\begin{description}[noitemsep,leftmargin=\parindentlnth]
     156}{
     157\end{description}
     158\end{quote2}
     159}
     160% \def\syntax{\paragraph{Syntax}\trivlist\parindent=.5in\item[\hskip.5in]}
     161%\let\endsyntax=\endtrivlist
     162\newcommand{\lhs}[1]{\item[\emph{#1:}\index{#1@{\emph{#1}}|italic}]~\ignorespaces}
     163\newcommand{\oldlhs}[1]{\item[\emph{#1:}\index{#1@{\emph{#1}}|italic}~\dots]~}
     164\newcommand{\rhs}{\hfil\newline}
     165\newcommand{\nonterm}[1]{\emph{#1}\index{#1@{\emph{#1}}|italic}}
    145166\newcommand{\opt}{$_{opt}$\ }
    146167
     
    179200                fallthru,finally,forall,ftype,_Generic,_Imaginary,inline,__label__,lvalue,_Noreturn,otype,restrict,_Static_assert,
    180201                _Thread_local,throw,throwResume,trait,try,typeof,__typeof,__typeof__,},
    181         moredelim=**[is][\color{red}]{`}{`}, % red highlighting of program text
    182202}%
    183203
     
    185205language=CFA,
    186206columns=flexible,
    187 basicstyle=\sf\relsize{-1},
     207basicstyle=\linespread{0.9}\sf,
     208stringstyle=\tt,
    188209tabsize=4,
    189 xleftmargin=\parindent,
    190 escapechar=@,
     210xleftmargin=\parindentlnth,
     211extendedchars=true,
     212escapechar=§,
    191213mathescape=true,
    192214keepspaces=true,
    193215showstringspaces=false,
    194216showlines=true,
    195 aboveskip=6pt,
    196 belowskip=4pt,
    197 literate={\\`}{\raisebox{0.3ex}{\ttfamily\upshape \hspace*{-2pt}`}}1, % escape \`, otherwise used for red highlighting
     217aboveskip=4pt,
     218belowskip=3pt,
     219moredelim=**[is][\color{red}]{®}{®}, % red highlighting
     220moredelim=**[is][\color{blue}]{ß}{ß}, % blue highlighting
     221moredelim=**[is][\color{OliveGreen}]{¢}{¢}, % green highlighting
     222moredelim=[is][\lstset{keywords={}}]{¶}{¶}, % temporarily turn off keywords
     223% replace/adjust listing characters that look bad in sanserif
     224literate={-}{\raisebox{-0.15ex}{\texttt{-}}}1 {^}{\raisebox{0.6ex}{$\scriptscriptstyle\land\,$}}1
     225        {~}{\raisebox{0.3ex}{$\scriptstyle\sim\,$}}1 {_}{\makebox[1.2ex][c]{\rule{1ex}{0.1ex}}}1 {`}{\ttfamily\upshape\hspace*{-0.1ex}`}1
     226        {<-}{$\leftarrow$}2 {=>}{$\Rightarrow$}2 {...}{$\dots$}2,
    198227}%
    199228
    200 \makeatletter
    201 % replace/adjust listings characters that look bad in sanserif
    202 \lst@CCPutMacro
    203 \lst@ProcessOther{"22}{\lst@ttfamily{"}{\raisebox{0.3ex}{\ttfamily\upshape "}}} % replace double quote
    204 \lst@ProcessOther{"27}{\lst@ttfamily{'}{\raisebox{0.3ex}{\ttfamily\upshape '\hspace*{-2pt}}}} % replace single quote
    205 \lst@ProcessOther{"2D}{\lst@ttfamily{-}{\ttfamily\upshape -}} % replace minus
    206 \lst@ProcessOther{"3C}{\lst@ttfamily{<}{\texttt{<}}} % replace less than
    207 \lst@ProcessOther{"3E}{\lst@ttfamily{<}{\texttt{>}}} % replace greater than
    208 \lst@ProcessOther{"5E}{\raisebox{0.4ex}{$\scriptstyle\land\,$}} % replace circumflex
    209 \lst@ProcessOther{"5F}{\lst@ttfamily{\char95}{{\makebox[1.2ex][c]{\rule{1ex}{0.1ex}}}}} % replace underscore
    210 \lst@ProcessOther{"60}{\lst@ttfamily{`}{\raisebox{0.3ex}{\ttfamily\upshape \hspace*{-2pt}`}}} % replace backquote
    211 \lst@ProcessOther{"7E}{\raisebox{0.3ex}{$\scriptstyle\sim\,$}} % replace tilde
    212 %\lst@ProcessOther{"7E}{\raisebox{-.4ex}[1ex][0pt]{\textasciitilde}} % lower tilde
    213 \@empty\z@\@empty % NECESSARY DO NOT REMOVE
    214 \makeatother
     229\lstMakeShortInline©    % single-character for \lstinline
    215230
    216231% Local Variables: %
Note: See TracChangeset for help on using the changeset viewer.