l3doc in combination with minted

The following question is related:

How to add listings environment to DTX files

I want to use the document class l3doc in combination with minted. However I am not able to get a nice result. If I use ltxdoc it works:

Here a "small" MWE:

% \iffalse meta-comment
% arara: pdflatex: { shell: true}
%<*internal>
\iffalse
%</internal>

%<*internal>
\fi
\def\nameofplainTeX{plain}
\ifx\fmtname\nameofplainTeX\else
\expandafter\begingroup
\fi
%</internal>
%<*install>
\input docstrip.tex
\keepsilent
\askforoverwritefalse
\preamble
----------------------------------------------------------------
demopkg --- description text
----------------------------------------------------------------

\endpreamble
%</install>
%<install>\endbatchfile
%<*internal>
\nopreamble\nopostamble
\ifx\fmtname\nameofplainTeX
\expandafter\endbatchfile
\else
\expandafter\endgroup
\fi
%</internal>
%<*package>
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{demopkg}[2009/10/06 v1.0 description text]
%</package>
%<*driver>
% \documentclass{l3doc}
\documentclass{ltxdoc}
\usepackage{minted}
\usepackage{etoolbox}
\begin{document}
\DocInput{\jobname.dtx}
\end{document}
%</driver>
% \fi
%  Text
%
% \begin{minted}{latex}
%  \begin{document}
%   \DocInput{\jobname.dtx}
%  \end{document}
% \end{minted}
% \iffalse
%<*example>
% \fi
\begin{minted}{latex}
\begin{document}
\DocInput{\jobname.dtx}
\end{document}
\end{minted}
% \iffalse
%</example>
% \fi

%  Text
%
%\Finale


Bonus: I want to use the environment minted without using the trick iffalse

-

1 Answer

Although l3doc is usable (I use it myself in xpeek), it is far from being in a stable state. See, for example, Joseph Wright’s answer to How to document a expl3 macro using dtx, where he describes the class as “currently a rather large collection of hacks […] lacking really comprehensive documentation: as I say, it's not exactly perfect internally!”

Similarly, Frank Mittelbach wrote in this thread on the LaTeX3 mailing list, “[l3doc] is certainly not fit for general use, neither quality-wise not in terms of stability. […] That doesn't mean that developers can't use it, but that they have to be prepared (for now) that sometimes layout may still change, while we experiment or that something breaks on the doc level or ... :-)”

In the long run, I expect l3doc to become a LaTeX3-based class, with modern solutions to indexing and cross-referencing and all that. But this will have to wait until LaTeX3-based classes are actually feasible, which means waiting for work on the output routines, templates, and similar projects—in other words, not for a few years yet.

In the meantime, the class will remain a “collection of hacks” suitable for the LaTeX3 team’s use, and adverse interaction with packages like minted (which seems to significantly change how the output is handled) are to be expected.

(And when the LaTeX3 version is available, I wouldn’t expect it to work smoothly with an intrusive LaTeX2e-based package anyway.)

So your options are these:

(Or, use l3doc and help modernize it.)

-
Thanks. I am writing an expl3 package and so I need some hacks of l3doc ;-) –  Marco Daniel Jun 24 '13 at 19:47