% $Id: tex-live.sty 67184 2023-05-22 17:31:16Z karl $
% TeX Live documentation style.  Written by many people over many years.
% Public domain.
%
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesPackage{tex-live}[2023-05-22 TeX Live Guide style]
%
% the bottom margin still ends up larger than the top margin;
% maybe one of our other packages is interfering?
\RequirePackage[a4paper,lines=47,hmargin=2.6cm,vmarginratio=5:4]{geometry}
%
\RequirePackage{alltt}
\RequirePackage{array}
\RequirePackage{colortbl}
\RequirePackage{comment}
\RequirePackage{float}
\RequirePackage{graphicx}
\RequirePackage{longtable}
\RequirePackage{shortvrb}
\RequirePackage[normalem]{ulem}
\RequirePackage[obeyspaces]{url}
\RequirePackage{xspace}
%
% for a proper \acro command.
\RequirePackage{relsize}
%\DeclareRobustCommand{\acro}[1]{\textscale{.9}{#1}\@}
\def\acro#1{\texorpdfstring{\textscale{.9}{#1}}{#1}\@}
%
%% No lmodern for Russian; LM doesn't have cyrillic.
\ifx\tldocrussion\undefined \RequirePackage{lmodern}\fi
%
\usepackage{textcomp}% including \textbullet
\def\p.{p.\,}

\RequirePackage{fancyvrb}
\DefineVerbatimEnvironment{verbatim}{Verbatim}{fontsize=\normalsize}
\DefineVerbatimEnvironment{sverbatim}{Verbatim}{fontsize=\small}
\DefineVerbatimEnvironment{fverbatim}{Verbatim}{fontsize=\footnotesize}
\DefineVerbatimEnvironment{boxedverbatim}
 {Verbatim}{fontsize=\footnotesize,frame=single}
\DefineVerbatimEnvironment{Verbatim}{Verbatim}{fontsize=\normalsize}
\def\verbatiminput#1{\VerbatimInput[fontsize=\small]{#1}}
\def\boxedverbatiminput#1{\VerbatimInput[frame=single,fontsize=\footnotesize]{#1}}
\def\listinginput#1#2{\VerbatimInput[fontsize=\scriptsize,firstnumber=#1,numbers=left]{#2}}
\MakeShortVerb\|
%
%
\pagestyle{headings}
%
% LaTeX parameters.
\renewcommand{\topfraction}{0.85}
\renewcommand{\floatpagefraction}{0.86}
\renewcommand{\textfraction}{0.1}
\renewcommand{\abovecaptionskip}{4pt}
\renewcommand{\belowcaptionskip}{4pt}
\setcounter{tocdepth}{3}
\setcounter{secnumdepth}{3}
\setcounter{topnumber}{5}
\setcounter{totalnumber}{5}
%
% linebreaking, etc.
\hbadness=4000
\vbadness=4000
\emergencystretch=.1\hsize
\relpenalty=500
%
\def\slash{/\penalty\z@\hskip\z@skip }
%
% various sorts of names
\newcommand*{\pkgname}[1]{\textsf{#1}}% package name
\newcommand*{\optname}[1]{\texttt{#1}}% (package,class) option name
\newcommand*{\cmdname}[1]{\textsf{#1}}% command name
\newcommand*{\colname}[1]{\emph{#1}}%   collection name
\newcommand*{\dirname}[1]{\path{#1}}%   directory name
\def\filename#1{\path{#1}}%  file name
\newcommand*{\envname}[1]{\texttt{#1}}% environment variable name
\newcommand{\code}[1]{\texttt{#1}}
\newcommand{\file}[1]{\texttt{#1}}
\newcommand{\prog}[1]{\textsf{#1}}% same as \cmdname
\newcommand{\samp}[1]{`\texttt{#1}'\@}
\newcommand{\var}[1]{{\sl #1}}% not \textsl, for roman not typewriter slanted.
\newcommand{\ttvar}[1]{\texttt{\var{#1}}}
%
% underlined command input.
%\def\Ucom#1{%
%   \uline{\rule[-.2\baselineskip]{0pt}{.9\baselineskip}\ttfamily #1}}
% bold command input
\def\Ucom#1{{\bfseries\ttfamily #1}}
%
% \CDref is for url's with a #, where we need to write the target url and
% displayed url separately in the input, due to catcode madness.
% (We could simplify/remove this next time, I think.)
\def\CDref#1#2{\texttt{#1}}
%
% \OnCD no longer has any use at all, since we don't have unpacked files
% on the DVD and it has never worked when reading the PDF online.
\def\OnCD#1{\path{#1}}
% 
% \OnCD is currently for any other reference to a file or directory in
% the distribution.  PDF readers only open .pdf files, though, so we
% should change this to only use \href for those.  Or more likely use
% different macros in the source.
%\def\OnCD#1{\href{../../../../#1}{\path{#1}}}
%
% \href incorrectly appends .pdf to anything without an extension; these
% definitions using \hyper@linkurl do not, but they fail for .pdf
% references -- which are the only ones that work anyway.  So this is
% useless, in practice.
%\def\CDref#1#2{\hyper@linkurl{#2}{../../../../#1}}
%\def\OnCD#1{\hyper@linkurl{\path{#1}}{../../../../#1}}

% GUI menu/button/tab sequence:
\def\guiseq#1{\textsf{#1}}
\def\arw{\unskip$\rightarrow$\ignorespaces}
%
% Special names.
\def\dpi{$\,$dpi\xspace}
\def\bs{{\protect\normalfont\ttfamily\char'134}}
\DeclareRobustCommand{\cs}[1]{{\normalfont\ttfamily\char`\\#1}}
\def\Q#1{\par\vskip6pt\leftline{#1}\par}
\def\hyph{-}
%
% many abbreviations.
\def\AllTeX{(\La\kern-.075em)\kern-.075em\TeX}
\def\AFMtoTFM{\cmdname{AFM2TFM}\null}
\def\bv{\emph{Baskerville}}
\let\BV=\bv
\newcommand{\CS}{$\mathcal{C}\kern-.1667em\lower.5ex%
                 \hbox{$\mathcal{S}$}\kern-.075em $}
\def\Dash{\unskip\nobreak\thinspace---\thinspace\ignorespaces}
\def\dvicopy{\cmdname{dvicopy}}
\def\dvidvi{\cmdname{dvidvi}}
\def\dvips{\cmdname{dvips}}
\def\eTeX{$\varepsilon$-\TeX}
\def\fpTeX{\textrm{fp}\TeX\xspace}
\def\GFtoDVI{\cmdname{GFtoDVI}\null}
\def\GFtoPK{\cmdname{GFtoPK}\null}
\def\GFtype{\cmdname{GFtype}}
\def\GUI{GUI\xspace}
\def\KPS{Kpathsea}
% This code % is hacked from its definition of \cs{LaTeX}; it allows
% slants (for example) to propagate into the raised (small) `A':
\newcommand{\La}%
   {L\kern-.36em
        {\setbox0\hbox{T}%
         \vbox to\ht0{\hbox{$\m@th$%
                            \csname S@\f@size\endcsname
                            \fontsize\sf@size\z@
                            \math@fontsfalse\selectfont
                            A}%
                      \vss}%
        }}
\def\OMEGA{$\Omega$}
\def\OzMF{OzMF}
\def\OzMP{OzMP}
\def\OzTeX{O\kern-.03em z\kern-.15em\TeX}
\def\PKtype{\cmdname{PKtype}}
\def\PLtoTF{\cmdname{PLtoTF}\null}
\def\ProTeXt{pro\TeX t}
\def\teTeX{\textrm{te}\TeX\xspace}
\def\TeXLive{\TeX{} Live\xspace}
\def\TFtoPL{\cmdname{TFtoPL}\null}
\def\TK{\TeX\ Collection}
\let\TL=\TeXLive
\def\TypeI{Type~1}
\def\VFtoVP{\cmdname{VFtoVP}\null}
\def\VPtoVF{\cmdname{VPtoVF}\null}
\def\Thanh{H\`an~Th\ifx  % get Unicode char in tex4ht's HTML output
     \HCode\UnDef\^e\llap{\raise 0.5ex\hbox{\'{}}}\else
     \HCode{\string&\#x1EBF;}\fi~Th\`anh}
\def\XEmTeX{\textrm{XEm}\TeX\xspace}
\def\XEmacs{\textrm{XEmacs}\xspace}
\def\XeTeX{Xe\TeX}
\def\Webc{Web2C}
\providecommand*{\CD}{CD\xspace}
\providecommand*{\CTAN}{CTAN\xspace}
\providecommand*{\DVD}{DVD\xspace}
\providecommand*{\GNU}{GNU\xspace}
\providecommand*{\HTML}{HTML\xspace}
\providecommand*{\ISO}{ISO\xspace}
\providecommand*{\MacOSX}{\texorpdfstring{Mac\,OS\,X}{MacOSX}\xspace}
\providecommand*{\macOS}{macOS\xspace}
\providecommand*{\PS}{Post\-Script\xspace}
\providecommand*{\TDS}{TDS\xspace}
\providecommand*{\USB}{USB\xspace}
\providecommand*{\dvi}{DVI\xspace}
\providecommand*{\web}{\texttt{WEB}\xspace}

% Include a png image.
% #1 - basename of image file in ../texlive-common/, always .png
% #2 - width for TeX
% #3 - alt text for image; used only in html
\def\tlpng#1#2#3{%
  \ifnum \Status=2 % html, have to have explicit relative path in output
    \includegraphics[alt={#3}]{../texlive-common/#1.png}%
    %
    % We intentionally are not specifying the size, so that the natural
    % size of the graphic is used in the HTML output. Thus we do not
    % get a graphics.sty warning about "cannot determine size of graphic
    % (no BoundingBox)" on every image. Unfortunately there is no good
    % way to eliminate that except by eliminating all LaTeX errors
    % (\@latex@error), which does not seem like a good idea.
  \else % not html, handled by TEXINPUTS in Makefile
    \par
    \centerline{\includegraphics[width=#2]{#1.png}}%
  \fi
}

% description-like environment that uses tt instead of bf, and doesn't
% go to the left margin.  Without the \hfil, get an underfull box.
% Don't know why \descriptionlabel doesn't.
%
\newenvironment{ttdescription}
  {\begin{list}{label must be supplied}{%
     \itemsep=0pt  % these lists tend to have short descriptions
     \parindent=0pt
     \let\makelabel=\ttdescriptionlabel}}%
  {\end{list}}
\newcommand*\ttdescriptionlabel[1]{\hspace\labelsep
                                   \normalfont\ttfamily #1\hfil}
%
% Likewise, for commands using sans serif.
\newenvironment{cmddescription}
  {\begin{list}{label must be supplied}{%
     \itemsep=0pt
     \let\makelabel=\cmddescriptionlabel}}%
  {\end{list}}
\newcommand*\cmddescriptionlabel[1]{\hspace\labelsep
                                    \normalfont\sffamily #1\hfil}

% General squeezed itemize/enumerate; no extra space at top or between items.
\newenvironment{itemize*}%
  {\begin{itemize}%
    \setlength{\itemsep}{0pt}%
    \setlength{\parskip}{0pt}%
    \setlength{\topsep}{0pt}%
    \setlength{\partopsep}{0pt}%
  }%
  {\end{itemize}}

\newenvironment{enumerate*}%
  {\begin{enumerate}%
    \setlength{\itemsep}{0pt}%
    \setlength{\parskip}{0pt}}%
  {\end{enumerate}}

\newsavebox{\wbox}
\newenvironment{warningbox}
 {\begin{lrbox}{\wbox}
 \begin{minipage}{.95\textwidth}}
 {\end{minipage}\end{lrbox}\fbox{\usebox{\wbox}}}
%
% lrbox is used as a representation marking. I changed it to
% lrBox in tne source file, to get closer to logical marking
\newsavebox{\mylrbox}
\newenvironment{lrBox}
 {\begin{lrbox}{\mylrbox}}
 {\end{lrbox}}


% emacs-page output setup
%
\ifx \HCode\UnDef
  \providecommand{\Status}{0}% running TeX
\else
  \providecommand{\Status}{2}% running TeX4ht
\fi
%\typeout{Status is \Status}
%
\newif\ifSingleColumn
%
% By default, we won't be creating hyperlinks.
\def\href#1#2{#2}
\def\hypertarget#1#2{}
\def\email#1{\href{mailto:#1}{\path{#1}}}  % \path comes from url
\def\htmlanchor#1{}
%
\definecolor{hypercolor}{rgb}{0.5,0.0,0.5} % purplish external links.
%
%
\ifcase\Status
  % \Status = 0
  \typeout{TeX Live documentation in DVI format}
  \SingleColumntrue
  \newenvironment{multicols}[1]{}{}
 \or
  % \Status = 1
  \typeout{TeX Live documentation in PDF format}
  \RequirePackage[breaklinks,
                  colorlinks,linkcolor=hypercolor,citecolor=hypercolor,
                    urlcolor=hypercolor,filecolor=hypercolor,
                  bookmarksopen,
                  %pdfstartview={FitBH -320000}, % fails with acrobat7
                  hyperindex]
        {hyperref}
  \SingleColumntrue
  \newenvironment{multicols}[1]{}{}
 \or
  % \Status = 2
  \typeout{TeX Live documentation in HTML format}
  \SingleColumntrue
  \newenvironment{multicols}[1]{}{}
  % Our config file, live4ht.cfg, is read from the htlatex call
  % in the Makefile.
  \RequirePackage[tex4ht]{hyperref}  \hyperlinkfileprefix{}
  % definitions need simplifying for TeX4ht to make relative paths work.
  \def\CDref#1#2{\href{../../../../#1}{#2}}
  \def\OnCD#1{\href{../../../../#1}{#1}}
  \def\htmlanchor#1{\HCode{<a id="#1"></a>}}
 \or
  % \Status = 3
  \typeout{TeX Live documentation as a Baskerville issue}
  \@ifundefined{Fonts}%
    {\RequirePackage{ae}}%
    {\RequirePackage[T1]{\Fonts}}
  \RequirePackage{bvoutln}% outline of baskerville
  \SingleColumnfalse
  \RequirePackage{multicol}
 \or
  % \Status = 4
  \typeout{TeX Live documentation as a TUB article}
  \@ifundefined{Fonts}%
    {\RequirePackage{ae}}%
    {\RequirePackage[T1]{\Fonts}}
  \SingleColumnfalse
  \newenvironment{multicols}[1]{}{}
\fi
%
\ifnum \Status=4
\else
  \RequirePackage{texnames}
  \providecommand\TeXXeT{\TeX-{}-%
    \kern-.1emX\kern-.125em\lower.5ex\hbox{E}\kern-.1667emT\@}
  \def\MP{MetaPost}
  \let\mf\MF
  \newcommand\ConTeXt{C\kern-.0333emon\-\kern-.0667em\TeX\kern-.0333emt}
  \newcommand\MIKTEX{MiK\kern-.025em \TeX}% per www.miktex.org
  % from pictex.tex:
  \ifx\PiC\undefined \def\PiC{P\kern-.12em\lower.5ex\hbox{I}\kern-.075emC} \fi
  \ifx\PiCTeX\undefined \def\PiCTeX{\PiC\kern-.11em\TeX} \fi
\fi
%
% hacking at sections etc., to pay attention to baskerville status
\newcommand{\@condend@multicols}{%
  \ifSingleColumn
  \else
    \def\@tempa{multicols}%
    \ifx\@tempa\@currenvir
      \end{multicols}%
    \fi
  \fi
}
\let\Section\section
\renewcommand{\section}{%
  \@ifstar
    {\Section*}%
    {%
      \@condend@multicols
      \@dblarg\@full@section
    }%
}
\def\@full@section[#1]#2{%
  \Section[#1]{#2}%
  \ifSingleColumn\else\begin{multicols}{2}\fi
}
\let\SubSection\subsection
\renewcommand{\subsection}{%
  \@ifstar{\SubSection*}%
  {%
    \@condend@multicols
    \@dblarg\@full@subsection
  }
}
\def\@full@subsection[#1]#2{%
  \SubSection[#1]{#2}%
  \ifSingleColumn\else\begin{multicols}{2}\fi
}

% Reduce list spacing.
\def\@listI{\leftmargin\leftmargini
 \parsep \z@
 \topsep 2\p@ \@plus 1\p@ \@minus 1\p@
 \itemsep \z@ \@plus .1\p@
}
\let\@listi\@listI
\@listi
\def\@listii{\leftmargin\leftmarginii
 \labelwidth\leftmarginii\advance\labelwidth-\labelsep
 \topsep 2\p@ \@plus 1\p@ \@minus 1\p@
 \parsep \z@
 \itemsep \z@ \@plus .1\p@
}
\def\@listiii{\leftmargin\leftmarginiii
 \labelwidth\leftmarginiii\advance\labelwidth-\labelsep
 \topsep 1\p@ \@plus 1\p@ \@minus 1\p@
 \parsep \z@
 \partopsep \z@
 \itemsep \topsep
}
\def\@listiv{\leftmargin\leftmarginiv
 \labelwidth\leftmarginiv\advance\labelwidth-\labelsep
}
\def\@listv{\leftmargin\leftmarginv
 \labelwidth\leftmarginv\advance\labelwidth-\labelsep
}
\def\@listvi{\leftmargin\leftmarginvi
 \labelwidth\leftmarginvi\advance\labelwidth-\labelsep
}
%
% array package stuff
\def\arraybackslash{\let\\=\@arraycr}
\newcolumntype{P}[1]{>{\raggedright\arraybackslash}p{#1}}
%
% shaded rows (using facilities of colortbl)
%
\definecolor{pale}{gray}{.9}
\newcount\colrow
\gdef\RowColor{pale}
\def\SetRowColor{%
 \rowcolor{\RowColor}%
 \global\advance\colrow by1\relax
 \ifodd\colrow
   \gdef\RowColor{pale}%
 \else
   \gdef\RowColor{white}%
 \fi
}
% redefine to hack up a reference even though we don't need it...
\renewcommand\@bibitem[1]{\if@filesw \immediate\write\@auxout
  {\string\bibcite{#1}{?}}\fi\ignorespaces}
%
% \unknownTeXlive is a dummy texlive entry for the biblio
\newcommand\unknownTeXlive[2][\relax]{\textbf{\textsc{unknown}}%
  \global\@all@unknown\expandafter{\the\@all@unknown{#2}}%
}
\newtoks\@all@unknown
\global\@all@unknown{}
\AtEndDocument{\@message@unknowns}
\def\@message@unknowns{\edef\@tempa{\the\@all@unknown}%
  \ifx\@tempa\@empty
  \else
    \def\@tempa{*** TeX Live package location of }%
    \expandafter\@output@unknowns\the\@all@unknown\@empty
  \fi
}
\def\@output@unknowns#1{\edef\@tempb{#1}%
  \ifx\@tempb\@empty
    \typeout{ unknown}%
  \else
    \message{\@tempa#1,}%
    \def\@tempa{}%
    \expandafter\@output@unknowns
  \fi
}


% Silence font warnings about no bold typewriter in LM.
\def\@font@warning#1{}%

% Silence hyperref warnings about \kern.
\def\HyPsd@Warning#1{}%

\endinput
