%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Larry's favorite LaTeX macros for making technical books.  These have
% been refined for years, starting with SIGGRAPH course notes in the
% '90's, further refined for _Advanced RenderMan_.
%
% Please use or modify this at will.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Copyright Contributors to the Open Shading Language project.
% SPDX-License-Identifier: BSD-3-Clause
% https://github.com/AcademySoftwareFoundation/OpenShadingLanguage


%
% Define typesetting commands for filenames and code
%
% Just like Advanced RenderMan -- all code in courier, keywords in text
%    courier but not bold.
\def\codefont{\ttfamily}	% font to use for code
\def\ce{\codefont\bfseries}	% emphasize something in code


%
% Define typesetting commands for filenames and code
%
\def\cf{\codefont}		% abbreviation for \codefont
\def\fn{\codefont}		% in-line filenames & unix commands
\def\kw{\codefont}      	% in-line keyword

\newcommand{\var}[1]{{\kw \emph{#1}}}  % variable
\newcommand{\qkw}[1]{{\kw "#1"}}       % quoted keyword
\newcommand{\qkws}[1]{{\small \kw "#1"}}       % quoted keyword, small
\newcommand{\qkwf}[1]{{\footnotesize \kw "#1"}}       % quoted keyword, tiny



% Define some environments for easy typesetting of small amounts of
% code.  These are mostly just wrappers around verbatim, but the
% different varieties also change font sizes.
\newenvironment{code}{\small \verbatimtab}{\endverbatimtab}
\newenvironment{smallcode}{\small \renewcommand{\baselinestretch}{0.8} \verbatimtab}{\endverbatimtab \renewcommand{\baselinestretch}{1}}
\newenvironment{tinycode}{\footnotesize \renewcommand{\baselinestretch}{0.75} \verbatimtab}{\endverbatimtab \renewcommand{\baselinestretch}{1}}

% \begin{htmlonly}
% \renewenvironment{code}{\begin{verbatim}}{\end{verbatim}}
% \newenvironment{smallcode}{\begin{verbatim}}{\end{verbatim}}
% \newenvironment{tinycode}{\begin{verbatim}}{\end{verbatim}}
% \end{htmlonly}

\newcommand{\includedcode}[1]{{\small \verbatimtabinput{#1}}}
\newcommand{\smallincludedcode}[1]{{\small \renewcommand{\baselinestretch}{0.8} \verbatimtabinput{#1} \renewcommand{\baselinestretch}{1}}}
\newcommand{\tinyincludedcode}[1]{{\footnotesize \renewcommand{\baselinestretch}{0.75} \verbatimtabinput{#1} \renewcommand{\baselinestretch}{1}}}





% Also create a hyphenation list, essentially just to guarantee that
% type names aren't hyphenated
%\hyphenation{Attribute}

% Handy for parameter lists
\def\pl{{\rm\emph{...params...}\xspace}}
\def\dotdotdot{{\rm\emph{...}\xspace}}
\hyphenation{parameterlist}




%begin{latexonly}
\newenvironment{apilist}{\begin{list}{}{\medskip \item[]}}{\end{list}}
\newcommand{\apiitem}[1]{\vspace{12pt} \noindent {\bf\tt #1} \vspace{-10pt}\begin{apilist}\nopagebreak[4]}
\newcommand{\apiend}{\end{apilist}\medskip\pagebreak[2]}
\def\bigspc{\makebox[72pt]{}}
\def\spc{\makebox[24pt]{}}
\def\halfspc{\makebox[12pt]{}}
\def\neghalfspc{\hspace{-12pt}}
\def\negspc{\hspace{-24pt}}
\def\chapwidthbegin{}
\def\chapwidthend{}
%end{latexonly}


%\begin{htmlonly}
%\newcommand{\apiitem}[1]{\medskip \noindent {\bf #1} \begin{quote}}
%\newcommand{\apiend}{\end{quote}}
%\def\halfspc{\begin{rawhtml} &nbsp; &nbsp; \end{rawhtml}}
%\def\spc{\halfspc\halfspc}
%\pagecolor[named]{White}
%\def\chapwidthbegin{\begin{rawhtml}<p><table cellspacing=1><tr><td width=550>\end{rawhtml}}
%\def\chapwidthend{\begin{rawhtml}</td></tr></table>\end{rawhtml}}
%\end{htmlonly}


\newcommand{\apibinding}[3]{\apiitem{#1\\[1ex]#2\\[1ex]#3}}

\newcommand{\CPPBINDING}[1]{\par {\small C++ BINDING:}\par {\spc \codefont #1}}
\newcommand{\PARAMETERS}{\par {\small PARAMETERS:} \par}
\newcommand{\EXAMPLE}{\par {\small EXAMPLE:} \par}
\newcommand{\EXAMPLES}{\par {\small EXAMPLES:} \par}
\newcommand{\SEEALSO}{\par \hspace{-20pt} See Also: \par}



% The \begin{algorithm} \end{algorithm} macros (in algorithm.sty) are
% great for code that can fit all on one page.  But when it can't, use
% these macros.  The first parameter is the caption, the second is the
% label name.
\newcommand{\longalgorithmbegin}[2]{\noindent\hrulefill \\
  \refstepcounter{algorithm}
  \noindent {\bf Listing \arabic{chapter}.\arabic{algorithm}}: #1 \label{#2} \\
  \addcontentsline{loa}{algorithm}{\numberline {\arabic{algorithm}} #1}
  \noindent\hrulefill
}
\newcommand{\longalgorithmend}{\noindent\hrulefill \\}


\def\NEW{\marginpar[\medskip\hfill~\fbox{\sffamily \Huge NEW!}~]{\medskip~\fbox{\sffamily \Huge NEW!}~}}
\newcommand{\NEWdown}[1]{\marginpar[\vspace{#1}\hfill\fbox{\sffamily \Huge NEW!}]{\vspace{#1}\fbox{\sffamily \Huge NEW!}}}
\def\DEPRECATED{\marginpar[\medskip\hfill~\fbox{\sffamily \Large Deprecated}]{\medskip~\fbox{\sffamily \Large Deprecated}}}
\newcommand{\DEPRECATEDdown}[1]{\marginpar{\vspace{#1}\fbox{\sffamily \Large Deprecated}}}
\def\CHANGED{\marginpar[\medskip\hfill~\fbox{\sffamily \huge CHANGED!}~]{\medskip~\fbox{\sffamily \huge CHANGED!}~}}
\def\ENHANCED{\marginpar[\medskip\hfill~\fbox{\sffamily \huge ENHANCED}~]{\medskip~\fbox{\sffamily \huge ENHANCED}~}}
\def\QUESTION{\marginpar[\medskip\hfill~\fbox{\sffamily \Huge ?}~~~~]{\medskip~\fbox{\sffamily \Huge ?}~~~~}}


\newcommand{\indexapi}[1]{\index{#1@\tt#1\rm}}



\newenvironment{annotate}{\medskip\sffamily\em\noindent}{\medskip}
%\newenvironment{annotate}{\begin{comment}}{\end{comment}}
