% $Id: tex-live.sty 37109 2015-04-28 23:46:19Z karl $
% TeX Live documentation style.  Written by many people over many years.
% Public domain.
%
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesPackage{tex-live}[2015/04/28 TeX Live Guide style]
%
% colortbl and other packages otherwise make the default be letter, it seems.
\RequirePackage[a4paper,hscale=0.75,lines=60,vmarginratio=10:8]{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}
%
% No lmodern for Russian; LM doesn't have cyrillic.
\ifx\tldocrussion\undefined \RequirePackage{lmodern}\fi
%
\usepackage{textcomp}% including \textbullet
\def\p.{p.\,}

% for a proper \acro command.
\RequirePackage{relsize}
%\DeclareRobustCommand{\acro}[1]{\textscale{.9}{#1}\@}
\def\acro#1{\texorpdfstring{\textscale{.9}{#1}}{#1}\@}
%
\RequirePackage{fancyvrb}
\DefineVerbatimEnvironment{verbatim}{Verbatim}{fontsize=\normalsize}
\DefineVerbatimEnvironment{fverbatim}{Verbatim}{fontsize=\footnotesize}
\DefineVerbatimEnvironment{sverbatim}{Verbatim}{fontsize=\small}
\DefineVerbatimEnvironment{boxedverbatim}
 {Verbatim}{fontsize=\footnotesize,frame=single}
\DefineVerbatimEnvironment{Verbatim}{Verbatim}{fontsize=\normalsize}
\def\verbatiminput#1{\VerbatimInput[fontsize=\scriptsize]{#1}}
\def\boxedverbatiminput#1{\VerbatimInput[frame=single,fontsize=\scriptsize]{#1}}
\def\listinginput#1#2{\VerbatimInput[fontsize=\scriptsize,firstnumber=#1,numbers=left]{#2}}
\MakeShortVerb\|
%
%
% Done with packages.
%
% emacs-page page layout.
% 
%ltr \advance\textwidth by 1.1in
%ltr \advance\oddsidemargin by -.55in
%ltr \advance\evensidemargin by -.55in
%ltr %
%ltr \advance\textheight by 1in
%ltr \advance\topmargin by -.5in
%ltr \advance\footskip by -.5in
%ltr %
\message{dimens: textwidth=\the\textwidth\space
         oddsidemargin=\the\oddsidemargin\space
         evensidemargin=\the\evensidemargin\space
         textheight=\the\textheight\space
         topmargin=\the\topmargin\space
         footskip=\the\footskip}
% 
% with settings above, and without a4 (hence letter):
% textwidth=424.49744pt  oddsidemargin=22.25128pt evensidemargin=22.25128pt
% textheight=622.26999pt topmargin=-20.135pt      footskip=-6.135pt
% 
% with default a4paper geometry settings (not enough height):
% textwidth=418.25368pt oddsidemargin=17.3571pt evensidemargin=17.3571pt 
% textheight=591.5302pt topmargin=-7.86334pt    footskip=30.0pt
%
% with geometry settings [a4paper,hscale=0.75,lines=60,vmarginratio=10:8]:
% textwidth=448.1309pt oddsidemargin=2.41849pt  evensidemargin=2.41849pt
% textheight=718.0pt   topmargin=-38.68848pt    footskip=30.0pt

% 
\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{\texorpdfstring{\acro{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}{\acro{CD}\xspace}
\providecommand*{\CTAN}{\acro{CTAN}\xspace}
\providecommand*{\DVD}{\texorpdfstring{\acro{DVD}}{DVD}\xspace}
\providecommand*{\GNU}{\acro{GNU}\xspace}
\providecommand*{\HTML}{\acro{HTML}\xspace}
\providecommand*{\ISO}{\texorpdfstring{\acro{ISO}}{ISO}\xspace}
\providecommand*{\MacOSX}{\texorpdfstring{Mac\,\acro{OS\,X}}{MacOSX}\xspace}
\providecommand*{\PS}{Post\-Script\xspace}
\providecommand*{\TDS}{\acro{TDS}\xspace}
\providecommand*{\USB}{\texorpdfstring{\acro{USB}}{USB}\xspace}
\providecommand*{\dvi}{\acro{DVI}\xspace}
\providecommand*{\web}{\texttt{WEB}\xspace}

% Include an image.
% #1 - name of image (pictures/#1.jpg, always .jpg please)
% #2 - bb for html
% #3 - width for TeX
%
\def\tlimage#1#2#3{%
  \ifnum \Status=2 % html, want relative path in output
    \includegraphics[#2]{../../general/texlive-common/pictures/#1.jpg}
  \else % not html, handled by TEXINPUTS in Makefile
    \includegraphics[width=#3]{pictures/#1.jpg}
  \fi
  \\[5mm]
}

\def\tlpng#1#2{%
  \ifnum \Status=2 % html, want relative path in output
    \includegraphics[bb=0 0 1 1]{#1.png}%
  \else % not html, handled by TEXINPUTS in Makefile
    \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.
\newenvironment{itemize*}%
  {\begin{itemize}%
    \setlength{\itemsep}{0pt}%
    \setlength{\parskip}{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]{}{}
  % read our config file, live4ht.cfg; q.v., for more definitions.
  % hyperref load must come after the tex4ht load.
  \RequirePackage[live4ht]{tex4ht}
  \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
}

% calm things down a bit if we're in a multiple-column version
\ifSingleColumn
\else
    \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
    }
\fi
%
% 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
