Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/LaTeXmacros/common.tex

    r9724df0 rb52d900  
    1111%% Created On       : Sat Apr  9 10:06:17 2016
    1212%% Last Modified By : Peter A. Buhr
    13 %% Last Modified On : Mon Jun 20 09:35:20 2016
    14 %% Update Count     : 178
     13%% Last Modified On : Sat Apr  9 10:06:39 2016
     14%% Update Count     : 1
    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 
    4019% Names used in the document.
    4120
    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
     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
    4524\def\c11{ISO/IEC C} % C11 name (cannot have numbers in latex command name)
    4625
     
    4827
    4928\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 
    5529% allow escape sequence in lstinline
    5630%\usepackage{etoolbox}
    5731%\patchcmd{\lsthk@TextStyle}{\let\lst@DefEsc\@empty}{}{}{\errmessage{failed to patch}}
    5832
    59 \usepackage{pslatex}                                                                    % reduce size of san serif font
    60 \usepackage{relsize}                                    % must be after change to small or selects old size
     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
    6146
    6247% reduce size of chapter/section titles
     
    8166    \vskip 50\p@
    8267  }}
    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}}
     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}}
    8570\renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}{-2.5ex \@plus -1ex \@minus -.2ex}{1.0ex \@plus .2ex}{\normalfont\normalsize\bfseries}}
    8671\renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}{-2.0ex \@plus -1ex \@minus -.2ex}{-1em}{\normalfont\normalsize\bfseries}}
     
    9075\newcommand{\definition}[1]{\textbf{\hyperpage{#1}}}
    9176\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}}
    9281
    9382% Define some commands that produce formatted index entries suitable for cross-references.
     
    120109\newcommand{\@sIndex}[2][\@empty]{#2\ifx#1\@empty\index{#2}\else\index{#1@{\protect#2}}\fi}
    121110
    122 \newcommand{\Indexc}[1]{\lstinline$#1$\index{#1@\lstinline$#1$}}
    123 \newcommand{\indexc}[1]{\index{#1@\lstinline$#1$}}
    124 
    125111\newcommand{\newtermFontInline}{\emph}
    126112\newcommand{\newterm}{\@ifstar\@snewterm\@newterm}
     
    130116
    131117\newenvironment{quote2}{%
    132         \list{}{\lstset{resetmargins=true,aboveskip=0pt,belowskip=0pt}\topsep=4pt\parsep=0pt\leftmargin=\parindent\rightmargin\leftmargin}%
     118        \list{}{\lstset{resetmargins=true}\leftmargin=\parindent\rightmargin\leftmargin}%
    133119        \item\relax
    134120}{%
     
    136122}% quote2
    137123\newenvironment{rationale}{%
    138   \begin{quote2}\noindent$\Box$\enspace
     124  \begin{quotation}\noindent$\Box$\enspace
    139125}{%
    140   \hfill\enspace$\Box$\end{quote2}
     126  \hfill\enspace$\Box$\end{quotation}
    141127}%
    142128
    143129% blocks and titles
    144130\newcommand{\define}[1]{\emph{#1\/}\index{#1}}
     131\newcommand{\rewrite}{\(\Rightarrow\)}
    145132\newcommand{\rewriterules}{\paragraph{Rewrite Rules}~\par\noindent}
    146133\newcommand{\examples}{\paragraph{Examples}~\par\noindent}
     
    150137
    151138% BNF macros
    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}}
     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}}
    166145\newcommand{\opt}{$_{opt}$\ }
    167146
     
    200179                fallthru,finally,forall,ftype,_Generic,_Imaginary,inline,__label__,lvalue,_Noreturn,otype,restrict,_Static_assert,
    201180                _Thread_local,throw,throwResume,trait,try,typeof,__typeof,__typeof__,},
     181        moredelim=**[is][\color{red}]{`}{`}, % red highlighting of program text
    202182}%
    203183
     
    205185language=CFA,
    206186columns=flexible,
    207 basicstyle=\linespread{0.9}\sf,
    208 stringstyle=\tt,
     187basicstyle=\sf\relsize{-1},
    209188tabsize=4,
    210 xleftmargin=\parindentlnth,
    211 extendedchars=true,
    212 escapechar=§,
     189xleftmargin=\parindent,
     190escapechar=@,
    213191mathescape=true,
    214192keepspaces=true,
    215193showstringspaces=false,
    216194showlines=true,
    217 aboveskip=4pt,
    218 belowskip=3pt,
    219 moredelim=**[is][\color{red}]{®}{®}, % red highlighting
    220 moredelim=**[is][\color{blue}]{ß}{ß}, % blue highlighting
    221 moredelim=**[is][\color{OliveGreen}]{¢}{¢}, % green highlighting
    222 moredelim=[is][\lstset{keywords={}}]{¶}{¶}, % temporarily turn off keywords
    223 % replace/adjust listing characters that look bad in sanserif
    224 literate={-}{\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,
     195aboveskip=6pt,
     196belowskip=4pt,
     197literate={\\`}{\raisebox{0.3ex}{\ttfamily\upshape \hspace*{-2pt}`}}1, % escape \`, otherwise used for red highlighting
    227198}%
    228199
    229 \lstMakeShortInline©    % single-character for \lstinline
     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
    230215
    231216% Local Variables: %
Note: See TracChangeset for help on using the changeset viewer.