summaryrefslogtreecommitdiff
path: root/macros/latex-dev/base/ltxdoc.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex-dev/base/ltxdoc.dtx')
-rw-r--r--macros/latex-dev/base/ltxdoc.dtx93
1 files changed, 80 insertions, 13 deletions
diff --git a/macros/latex-dev/base/ltxdoc.dtx b/macros/latex-dev/base/ltxdoc.dtx
index 7a21f7d871..10ddd44828 100644
--- a/macros/latex-dev/base/ltxdoc.dtx
+++ b/macros/latex-dev/base/ltxdoc.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-% Copyright (C) 1993-2021
+% Copyright (C) 1993-2022
% The LaTeX Project and any individual authors listed elsewhere
% in this file.
%
@@ -30,7 +30,7 @@
%
%<class>\NeedsTeXFormat{LaTeX2e}
%<class>\ProvidesClass{ltxdoc}
-%<class> [2020/12/05 v2.1b Standard LaTeX documentation class]
+%<class> [2021/12/07 v2.1d Standard LaTeX documentation class]
%
%<*driver>
\documentclass{ltxdoc}
@@ -102,7 +102,7 @@
% \PassOptionsToClass{a4paper}{article}
%\end{verbatim}
%
-% All the source files are in two parts, separated by |\StopEventually|.
+% All the source files are in two parts, separated by |\MaybeStop|.
% The first part (should) contain `user' documentation. The second part
% is a full documented listing of the source code. The |doc| package
% provides the command |\OnlyDescription| which suppresses the code
@@ -156,39 +156,53 @@
% \includeonly{ltvers,ltboxes}
%\end{verbatim}
%
-% \StopEventually{}
+% \MaybeStop{}
%
%
% \section{Options}
%
% \begin{macrocode}
%<*class>
+% \end{macrocode}
+%
+% \begin{macrocode}
\DeclareOption{a5paper}{\@latexerr{Option not supported}%
{}}
% \end{macrocode}
+% Prevent loading of a config file.
+% \begin{macrocode}
+\newif\ifltxdoc@load@cfg@ \ltxdoc@load@cfg@true
+\DeclareOption{nocfg}{\ltxdoc@load@cfg@false}
+% \end{macrocode}
%
% \begin{macrocode}
\DeclareOption*{%
\PassOptionsToClass {\CurrentOption}{article}}
% \end{macrocode}
%
-% \section{Configuration}
+% \section{Option Processing}
+%
+% \begin{macrocode}
+\ProcessOptions
+% \end{macrocode}
+%
+% \section{Local configuration}
% Input a local configuration file, if it exists.
% \begin{macrocode}
+\ifltxdoc@load@cfg@
\InputIfFileExists{ltxdoc.cfg}
{\typeout{*************************************^^J%
* Local config file ltxdoc.cfg used^^J%
*************************************}}
{}
+\else
+ \typeout{*************************************^^J%
+ * Local config file ignored^^J%
+ *************************************}
+\fi
% \end{macrocode}
%
%
-% \section{Option Processing}
-%
-% \begin{macrocode}
-\ProcessOptions
-% \end{macrocode}
-%
% \section{Loading article and doc}
%
% \begin{macrocode}
@@ -256,7 +270,7 @@
% arguments. It can \emph{not} be use to record commands that are defined as
% ``|\outer|'' nor is it possible to use it on conditionals such as
% |\iftrue| or defined by |\newif|.
-% |\cs{foo}| also prints |\foo|, for those who prefer that
+% |\cs{foo}| already available with the \texttt{doc} package also prints |\foo|, for those who prefer that
% syntax. (This second form can be used to record all types of command so the
% above restrictions do not apply.
% \begin{macro}{\cmd}
@@ -266,7 +280,7 @@
% \begin{macrocode}
\def\cmd#1{\cs{\expandafter\cmd@to@cs\string#1}}
\def\cmd@to@cs#1#2{\char\number`#2\relax}
-\DeclareRobustCommand\cs[1]{\texttt{\char`\\#1}}
+%\DeclareRobustCommand\cs[1]{\texttt{\char`\\#1}} % already part of doc.sty
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -602,5 +616,58 @@ Bug reports can be opened (category \texttt{#1}) at\\%
\def\task#1#2{}
%</class>
% \end{macrocode}
+%
+%
+%
+% \section{Configuration file}
+%
+%
+% \begin{macrocode}
+%<*cfg>
+%
+% This is the ltxdoc configuration file we use to format the LaTeX
+% kernel sources.
+%
+%
+% Copyright 2006, 2007, 2011 Heiko Oberdiek
+% Copyright 2014-2021 The LaTeX Project
+%
+
+\ProvidesFile{ltxdoc.cfg}%
+ [2021/12/07 v2.0c ltxdoc.cls configuration (LaTeX Project)]
+\PassOptionsToClass{a4paper}{article}
+
+% hyperref and hypdoc are now loaded late (or by the user) so we have to wait
+% with any adjustments until that has happened
+
+\AddToHook{package/hyperref/after}{%
+%% \RequirePackage{hypdoc}% % this is now triggered by doc
+ \RequirePackage{pdftexcmds}\relax
+ \ifnum\pdf@strcmp{\jobname}{inputenc}=0 %
+ \hypersetup{pdfencoding=auto}%
+ \pdfstringdefDisableCommands{%
+ \def\meta#1{% inputenc.dtx
+ \9060\010#1\9060\011%
+ }%
+ }%
+ \else
+ \fi
+ \pdfstringdefDisableCommands{%
+ \let\env\relax % longtable.dtx
+ \let\mytt\relax % tabularx.dtx
+ }%
+}
+
+% This should work well for documentation of packages outside the
+% LaTeX kernel, but if not, you can prevent the loading with the
+% option "nocfg", i.e.,
+%
+% \documentclass[nocfg]{ltxdoc]
+%
+% or by providing your own config file
+
+\endinput
+%</cfg>
+% \end{macrocode}
% \Finale
%