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.dtx54
1 files changed, 45 insertions, 9 deletions
diff --git a/macros/latex-dev/base/ltxdoc.dtx b/macros/latex-dev/base/ltxdoc.dtx
index 10ddd44828..f68c45ee36 100644
--- a/macros/latex-dev/base/ltxdoc.dtx
+++ b/macros/latex-dev/base/ltxdoc.dtx
@@ -30,7 +30,7 @@
%
%<class>\NeedsTeXFormat{LaTeX2e}
%<class>\ProvidesClass{ltxdoc}
-%<class> [2021/12/07 v2.1d Standard LaTeX documentation class]
+%<class> [2022/06/14 v2.1g Standard LaTeX documentation class]
%
%<*driver>
\documentclass{ltxdoc}
@@ -51,6 +51,8 @@
%
% \fi
%
+% \providecommand\pkg[1]{\texttt{#1}}
+%
%
% \changes{v2.0i}{1994/04/29}{Update the documentation.}
% \changes{v2.0s}{1998/08/17}{(RmS) Documentation fixes.}
@@ -115,10 +117,13 @@
% \AtBeginDocument{\OnlyDescription}
%\end{verbatim}
%
+% If your document relies on using the old \pkg{doc} version, you can
+% request that the class loads \pkg{doc} version~2 by passing the
+% option \texttt{doc2}.
%
% If the full source listing |sources2e.tex| is processed, then an index
-% and change history are produced by default, however indices are not
-% normally produced for individual files.
+% and change history are produced by default, however indexes are normally
+% not produced for individual files.
%
% As an example, consider |ltclass.dtx|, which contains the sources for
% the new class and package interface commands. With no |cfg|
@@ -175,6 +180,13 @@
\DeclareOption{nocfg}{\ltxdoc@load@cfg@false}
% \end{macrocode}
%
+% Support rolling back \pkg{doc} to version 2:
+% \changes{v2.1e}{2022/05/27}{Support rolling back doc to version 2}
+% \begin{macrocode}
+\let\ltxdoc@doc@version\@empty % use current version by default
+\DeclareOption{doc2}{\def\ltxdoc@doc@version{=v2}}
+% \end{macrocode}
+%
% \begin{macrocode}
\DeclareOption*{%
\PassOptionsToClass {\CurrentOption}{article}}
@@ -209,8 +221,13 @@
\LoadClass{article}
% \end{macrocode}
%
+% By default, loadthe current \pkg{doc} version
+% (\cs{ltxdoc@doc@version} is empty). If option
+% \texttt{doc2} is given version 2 is loaded
+% (\cs{ltxdoc@doc@version} contains \texttt{=v2}).
+% \changes{v2.1e}{2022/05/27}{Support rolling back doc to version 2}
% \begin{macrocode}
-\RequirePackage{doc}
+\RequirePackage{doc}[\ltxdoc@doc@version]
% \end{macrocode}
%
% Make \verb+|+ be a `short verb' character, but not in the document
@@ -606,14 +623,33 @@ Bug reports can be opened (category \texttt{#1}) at\\%
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\url}
+%
% \begin{macrocode}
-\providecommand\url{\texttt}
+\def\task#1#2{}
+% \end{macrocode}
+%
+%
+% \changes{v2.1f}{2022/06/03}{define \cs{pkg} and other commands}
+% \changes{v2.1f}{2022/06/03}{allow \_ in macro names}
+% Some feaures from l3doc.cls
+% \changes{v2.1g}{2022/06/14}{define \cs{pkg} but delay until begin document}
+% \begin{macrocode}
+\DeclareRobustCommand\cs[1]{\texttt{\bslash\detokenize{#1}}}%
+\AtBeginDocument{%
+ \renewcommand\PrintMacroName[1]{\MacroFont\detokenize{#1}}%
+% \end{macrocode}
+% We provide those delated in case somebody has loaded \texttt{csquotes}
+% or makes some definitions in the preamble.
+% \begin{macrocode}
+ \providecommand\LuaTeX{Lua\TeX}
+ \providecommand\cls{\textsf}
+ \providecommand\pkg{\textsf}
+ \providecommand\enquote[1]{``#1''}
+ \providecommand\url{\texttt}
+}
% \end{macrocode}
-% \end{macro}
%
% \begin{macrocode}
-\def\task#1#2{}
%</class>
% \end{macrocode}
%
@@ -634,7 +670,7 @@ Bug reports can be opened (category \texttt{#1}) at\\%
%
\ProvidesFile{ltxdoc.cfg}%
- [2021/12/07 v2.0c ltxdoc.cls configuration (LaTeX Project)]
+ [2022/06/14 v2.0d ltxdoc.cls configuration (LaTeX Project)]
\PassOptionsToClass{a4paper}{article}
% hyperref and hypdoc are now loaded late (or by the user) so we have to wait