blob: 7da4e63a4529e0d6128d0b840720865f5f8d6631 [file] [log] [blame]
\usepackage[T1]{fontenc}
\usepackage{pslatex}
\usepackage{microtype}
\usepackage{fullpage}
\usepackage{graphicx}
\usepackage{hevea}
\usepackage{url}
\usepackage{color}
\usepackage{hyperref}
% Not supported by Hevea, so don't bother: \usepackage{minitoc}
\usepackage{proof}
\usepackage{relsize}
% \def\codesize{\smaller}
\def\codesize{\relax} % for "pslatex"
%HEVEA \def\codesize{\relax}
%%BEGIN LATEX
\newcommand{\code}[1]{\ifmmode{\mbox{\codesize\ttfamily{#1}}}\else{\codesize\ttfamily #1}\fi}
%\DeclareRobustCommand{\code}[1]{\codesize{\path{#1}}}
%%END LATEX
%%HEVEA \newcommand{\code}[1]{\codesize{\texttt{#1}}}
\def\<#1>{\code{#1}}
% This can't handle a URL with an embedded "#" -- at least at UW CSE
\newcommand{\myurl}[1]{{\codesize\url{#1}}}
%HEVEA \def\myurl{\url}
% A command that shows the URL in the printed manual.
% make a URL visible in PDF the but just be attached to anchor text in HTML:
%BEGIN LATEX
\newcommand{\ahreforurl}[2]{#2 (\url{#1})}
%END LATEX
%HEVEA \newcommand{\ahreforurl}[2]{\href{#1}{#2}}
\usepackage{listings}
\usepackage{alltt}
\usepackage{fancyvrb}
%BEGIN LATEX
\RecustomVerbatimEnvironment{Verbatim}{Verbatim}{fontsize=\codesize}
%END LATEX
\newenvironment{mysmall}
{\ifhevea\makeatletter\@open{DIV}{style="font-size:small;"}\makeatother
\else\begin{smaller}\fi}
{\ifhevea\makeatletter\@close{DIV}\makeatother
\else\end{smaller}\fi}
\newenvironment{myxsmall}
{\ifhevea\makeatletter\@open{DIV}{style="font-size:x-small;"}\makeatother
\else\begin{smaller}\begin{smaller}\fi}
{\ifhevea\makeatletter\@close{DIV}\makeatother
\else\end{smaller}\end{smaller}\fi}
\newenvironment{myxxsmall}
{\ifhevea\makeatletter\@open{DIV}{style="font-size:xx-small;"}\makeatother
\else\begin{smaller}\begin{smaller}\begin{smaller}\fi}
{\ifhevea\makeatletter\@close{DIV}\makeatother
\else\end{smaller}\end{smaller}\end{smaller}\fi}
%HEVEA \footerfalse % Disable hevea advertisement in footer
\newcommand{\htmlhr}{\relax}
%HEVEA \renewcommand{\htmlhr}{\@hr{}{}}
% Problem with using "\newcommand" or "\renewcommand": Hevea writes this
% into manual.image.tex, and invokes LaTeX on it. Sometimes running "make"
% leads to an error as a result, sometimes not. I don't know the pattern
% of the failures, though running "make clean" and then "make" seems to
% work. So maybe there's a problem with an auxiliary file. Solve it by
% always defining \discretionary, so that \renewcommand works.
%HEVEA \def\discretionary{\relax}\renewcommand{\discretionary}[3]{\relax}
%HEVEA \newstyle{.lstframe}{margin:auto;margin-bottom:2em}
% Make images larger and thus less pixelated. This is not really a solution.
%HEVEA\@addimagenopt{-mag 2000}
% This avoids Hevea's built-in conversion.
% The argument is the HEIGHT, not the width.
\newcommand{\includeimage}[2]{%
\begin{center}
\includeimagenocentering{#1}{#2}%
%BEGIN LATEX
\vspace{-1.5\baselineskip}
%END LATEX
\end{center}}
% The argument is the HEIGHT, not the width.
\newcommand{\includeimagenocentering}[2]{%
\ifhevea\imgsrc{#1.svg}\else%
\resizebox{!}{#2}{\includegraphics{figures/#1}}\fi}
% At least 80% of every float page must be taken up by
% floats; there will be no page with more than 20% white space.
\def\topfraction{.8}
\def\dbltopfraction{\topfraction}
\def\floatpagefraction{\topfraction} % default .5
\def\dblfloatpagefraction{\topfraction} % default .5
\def\textfraction{.2}
% Left and right curly braces and backslash, in tt font
\newcommand{\ttlcb}{\texttt{\char "7B}}
\newcommand{\ttrcb}{\texttt{\char "7D}}
\newcommand{\ttbs}{\texttt{\char "5C}}
%BEGIN LATEX
%% Bring items closer together in list environments
% Prevent infinite loops
\let\Itemize =\itemize
\let\Enumerate =\enumerate
\let\Description =\description
% Zero the vertical spacing parameters
\def\Nospacing{\itemsep=0pt\topsep=0pt\partopsep=0pt\parskip=0pt\parsep=0pt}
% Redefine the environments in terms of the original values
\renewenvironment{itemize}{\Itemize\Nospacing}{\endlist}
\renewenvironment{enumerate}{\Enumerate\Nospacing}{\endlist}
\renewenvironment{description}{\Description\Nospacing}{\endlist}
% Add line between figure and text
\makeatletter
\def\topfigrule{\kern3\p@ \hrule \kern -3.4\p@} % the \hrule is .4pt high
\def\botfigrule{\kern-3\p@ \hrule \kern 2.6\p@} % the \hrule is .4pt high
\def\dblfigrule{\kern3\p@ \hrule \kern -3.4\p@} % the \hrule is .4pt high
\makeatother
%END LATEX
% Reference to Checker Framework Javadoc for a class (not a method, etc.).
% Arg 1: directory under org/checkerframework/, including internal "/", but
% no leading or trailing "/".
% Arg 2: class name.
% In the printed version, only the base class name appears.
% In the HTML version, it's a link to the Javadoc.
\newcommand{\refclass}[2]{\href{../api/org/checkerframework/#1/#2.html}{\<#2>}}
% Reference to Checker Framework Javadoc for a type qualifier/annotation class
% (not a method, etc.). Like \refclass, but prepends an @ to the qualifier name.
\newcommand{\refqualclass}[2]{\href{../api/org/checkerframework/#1/#2.html}{\<@#2>}}
% Reference to Checker Framework Javadoc for a type qualifier/annotation class
% (not a method, etc.) that takes parameters. This prepends an @ to the
% qualifier name and includes parentheses around the parameters.
\newcommand{\refqualclasswithparams}[3]{\href{../api/org/checkerframework/#1/#2.html}{\<@#2>}\<(\allowbreak #3)>}
% Reference to Checker Framework Javadoc for a method or field.).
% Arg 1: package name under org/checkerframework, using "/" as a separator,
% with no leading or trailing "/". example: "checker/nullness/qual"
% Arg 2: class name.
% Arg 3: method name.
% Arg 4: fully-qualified arguments. Example: "(T)". For Java 8, may need
% to use "-T-" with dashes instead of parentheses.
% In the printed version, only "class.method" appears.
% In the HTML version, it's a link to the Javadoc.
\newcommand{\refmethod}[4]{\href{../api/org/checkerframework/#1/#2.html\##3#4}{\<#2.#3>}}
% Omits the class name in the visible text; is terser. Good for mentioning
% a method that needs to be overridden.
\newcommand{\refmethodterse}[4]{\href{../api/org/checkerframework/#1/#2.html\##3#4}{\<#3>}}
% Permits specification of the anchor text. Good for mentioning the
% arguments of an overloaded method that needs to be overridden.
\newcommand{\refmethodanchortext}[5]{\href{../api/org/checkerframework/#1/#2.html\##3#4}{\<#5>}}
% Like refmethod, but formatted more concisely as ``field'' instead of
% ``Class.field''. The last argument is usually empty {}.
\newcommand{\refenum}[4]{\href{../api/org/checkerframework/#1/#2.html\##3#4}{\<#3>}}
% Reference to Sun Javadoc.
% Arg 1: .html reference, without the .../api/ prefix
% Arg 2: What will appear in the formatted manual.
% Do not use \url in the body of any macro
\newcommand{\sunjavadoc}[2]{\href{https://docs.oracle.com/en/java/javase/11/docs/api/#1}{\<#2>}}
% Like \sunjavadoc, but for annotations and prepends "@".
\newcommand{\sunjavadocanno}[2]{\href{https://docs.oracle.com/en/java/javase/11/docs/api/#1}{\<@#2>}}
% Now, for Java EE (version 7 is the last version):
\newcommand{\javaeejavadoc}[2]{\href{https://docs.oracle.com/javaee/7/api/#1}{\<#2>}}
\newcommand{\javaeejavadocanno}[2]{\href{https://docs.oracle.com/javaee/7/api/#1}{\<@#2>}}
% These commands are for long-range references: those not in the same chapter.
\newcommand{\refwithpage}[1]{\ref{#1}, page~\pageref{#1}}
%HEVEA \renewcommand{\refwithpage}[1]{\ref{#1}}
\newcommand{\refwithpageparen}[1]{\ref{#1} (page~\pageref{#1})}
%HEVEA \renewcommand{\refwithpageparen}[1]{\ref{#1}}
% Use \chapterpageref to reference only chapters, not sections.
\newcommand{\chapterpageref}[1]{Chapter~\refwithpage{#1}}
\ifhevea
% Using a Unicode character avoids needing to use an image. Unfortunately,
% this Unicode character is not installed on all computers, so use an image
% anyway.
% \newcommand{\linkicon}{{\small\@print@u{128279}}}
\newcommand{\linkicon}{\imgsrc[width="10" height="10"]{chainlink.svg}}
\newcommand{\selflink}[1]{\if@refs\ \ahrefloc{#1}{\linkicon}\fi}
\newcommand{\mksectionAndLabel}[1]
{\newcommand{\csname #1AndLabel\endcsname}[2]
{\csname #1\endcsname{##1\label{##2}\selflink{##2}}}}
\mksectionAndLabel{chapter}
\mksectionAndLabel{section}
\mksectionAndLabel{subsection}
\mksectionAndLabel{subsubsection}
\mksectionAndLabel{paragraph}
\else
\newcommand{\selflink}[1]{}
\newcommand{\chapterAndLabel}[2]{\chapter{#1}\label{#2}}
\newcommand{\sectionAndLabel}[2]{\section{#1}\label{#2}}
\newcommand{\subsectionAndLabel}[2]{\subsection{#1}\label{#2}}
\newcommand{\subsubsectionAndLabel}[2]{\subsubsection{#1}\label{#2}}
\newcommand{\paragraphAndLabel}[2]{\paragraph{#1}\label{#2}}
\fi
% LocalWords: fontsize mysmall myxsmall myxxsmall subsubsection