Skip to content

verbatim mode in a ltxdoc document prints percentage characters in phase-III, not in phase-II. #1150

@edgarolthof

Description

@edgarolthof

Parts of documents in verbatim mode processed using package ltxdoc print different between phase-II and phase-III (or latest): the percentage characters are present in phase-III. It can be argued that this behaviour is correct since verbatim is verbatim, but in phase-II and without tagging the percentage characters are not printed. I assume, however, that the output should look the same.

I include a minimal working example.

mwe.pdf. The file mwe.dtx is given below.

% \iffalse
%<package>\ProvidesPackage{mwe}
%<package>          [2025/12/2 v0.1 (EHTO)]
%<package>\NeedsTeXFormat{LaTeX2e}
%<*driver>
%\DocumentMetadata{lang=en,testphase={phase-II,firstaid},uncompress}
\DocumentMetadata{lang=en,testphase={phase-III,firstaid},uncompress}
%\DocumentMetadata{lang=en,testphase=latest,uncompress}
\documentclass{ltxdoc}
\usepackage{booktabs}
\EnableCrossrefs
\CodelineIndex
\begin{document}
   \DocInput{mwe.dtx}
\end{document}
%</driver>
%\fi
%\RecordChanges
%Testfile to see the influence of tagging on the |verbatim| environment,
%while using |ltxdoc|.
%\begin{table}[htb]
%\caption{Example Table.} \label{tab:fcraw}
%\begin{tabular}{@{}lrlr@{}}
%\multicolumn4{@{}c@{}}{\bfseries Test table}\\
%\toprule
%$\alpha$ & $\beta$ & $\gamma$ & $\delta$\\
%\midrule
%a &    1 & e &    5 \\
%b &   12 & f &   56 \\
%c &  123 & g &  567 \\
%d & 1234 & h & 5678 \\
%\bottomrule
%\end{tabular}
%\end{table}
%This version was compiled with tagging in phase-III and the percentage characters in 
%the verbatim version of the table are included.  Without tagging they're absent.
%The raw version of Table~\ref{tab:fcraw} is shown in Table~\ref{tab:fcrawverb}.
%\begin{table}[htb]
%\caption{Verbatim version of Example Table~\ref{tab:fcraw}.}
%\label{tab:fcrawverb} \topsep0pt
%\begin{verbatim}
%\begin{table}[htb]
%\caption{Example Table.} \label{tab:fcraw}
%\begin{tabular}{@{}lrlr@{}}
%\multicolumn4{@{}c@{}}{\bfseries Test table}\\
%\toprule
%$\alpha$ & $\beta$ & $\gamma$ & $\delta$\\
%\midrule
%a &    1 & e &    5 \\
%b &   12 & f &   56 \\
%c &  123 & g &  567 \\
%d & 1234 & h & 5678 \\
%\bottomrule
%\end{tabular}
%\end{table}
%\end{verbatim}
%\end{table}
%The expectations for the |verbatim| environment are contradictory when
%acting under |ltxdoc|: the percentage character shouldn't do anything
%when the file is processed as document (because of |ltxdoc|), but a true
%verbatim mode should print them.  Tagging in phase-III apparently changes
%precedence of these behaviours (test it by reverting to phase-II or by 
%completely commenting out the DocumentMetadata line).
%\Finale
\endinput

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions