
% -------------------- %
% -- RESOURCES USED -- %
% -------------------- %


\begin{filecontents*}[overwrite]{examples-focus-exa.tex}
Bla, bla, bla...

\begin{tdocexa}
    Ble, ble, ble...
\end{tdocexa}

\begin{tdocexa}[Wonderful]
    Bli, bli, bli...
\end{tdocexa}

\begin{tdocexa}<nonb>
    Blo, blo, blo...
\end{tdocexa}

\begin{tdocexa}<nonb>[Superb]
    Blu, blu, blu...
\end{tdocexa}
\end{filecontents*}


\begin{filecontents*}[overwrite]{examples-focus-exa-leavevmode.tex}
\begin{tdocexa}
    \leavevmode

    \begin{enumerate}
        \item Point 1.

        \item Point 2.
    \end{enumerate}
\end{tdocexa}
\end{filecontents*}


\begin{filecontents*}[overwrite]{examples-focus-rmk.tex}
\begin{tdocrem}
    Just one remark...
\end{tdocrem}

\begin{tdocrem}[Mini title]
    Useful?
\end{tdocrem}
\end{filecontents*}


\begin{filecontents*}[overwrite]{examples-focus-tip.tex}
\begin{tdoctip}
    A tip.
\end{tdoctip}

\begin{tdoctip}[Mini title]
    Useful?
\end{tdoctip}
\end{filecontents*}


\begin{filecontents*}[overwrite]{examples-focus-note.tex}
\begin{tdocnote}
    Something useful to tell you...
\end{tdocnote}

\begin{tdocnote}[Mini title]
    Useful?
\end{tdocnote}
\end{filecontents*}


\begin{filecontents*}[overwrite]{examples-focus-important.tex}
\begin{tdocimportant}
    Important and harmless.
\end{tdocimportant}

\begin{tdocimportant}[Mini title]
    Useful?
\end{tdocimportant}
\end{filecontents*}


\begin{filecontents*}[overwrite]{examples-focus-caution.tex}
\begin{tdoccaution}
    Caution, caution...
\end{tdoccaution}

\begin{tdoccaution}[Mini title]
    Useful?
\end{tdoccaution}
\end{filecontents*}


\begin{filecontents*}[overwrite]{examples-focus-warn.tex}
\begin{tdocwarn}
    Avoid the dangers...
\end{tdocwarn}

\begin{tdocwarn}[Mini title]
    Useful?
\end{tdocwarn}
\end{filecontents*}


\begin{filecontents*}[overwrite]{examples-showcase-default.tex}
\begin{tdocshowcase}
    \bfseries A bit of code \LaTeX.

    \bigskip

    \emph{\large End of the awful demo.}
\end{tdocshowcase}
\end{filecontents*}


\begin{filecontents*}[overwrite]{examples-showcase-customized.tex}
\begin{tdocshowcase}[before = My beginning,
                     after  = My end,
                     color  = red]
    Bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla...
\end{tdocshowcase}
\end{filecontents*}


\begin{filecontents*}[overwrite]{examples-showcase-hook.tex}
\begin{tdocshowcase}
    \string[This works...]
\end{tdocshowcase}
\end{filecontents*}


\begin{filecontents*}[overwrite]{examples-showcase-no-clrstrip.tex}
\begin{tdocshowcase}[nostripe]
    Bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla...
\end{tdocshowcase}
\end{filecontents*}


\begin{filecontents*}[overwrite]{examples-showcase-no-clrstrip-customized.tex}
\begin{tdocshowcase}[nostripe,
                     before = My beginning,
                     after  = My end,
                     color  = green]
    Bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla...
\end{tdocshowcase}
\end{filecontents*}


\begin{filecontents*}[overwrite]{examples-showcase-external.tex}
Blablobli, blablobli, blablobli, blablobli, blablobli, blablobli...
\end{filecontents*}


\begin{filecontents*}[overwrite]{examples-listing-ABC.tex}
\begin{tdoclatex}[sbs]
    $A = B + C$
\end{tdoclatex}
\end{filecontents*}


\begin{filecontents*}[overwrite]{examples-listing-strange.tex}
\begin{tdoclatex}[std]
    [Strange... Or not!]
\end{tdoclatex}
\end{filecontents*}


\begin{filecontents*}[overwrite]{examples-listing-strange-bis.tex}
\begin{tdoclatex}
    \string[Strange... Or not!]
\end{tdoclatex}
\end{filecontents*}


\begin{filecontents*}[overwrite]{examples-listing-xyz.tex}
% Just one demo.
$x y z = 1$
\end{filecontents*}


\begin{filecontents*}[overwrite]{examples-listing-latexshow-options.tex}
\tdoclatexshow[explain = What comes next is colourful...,
               before  = Rendering below.,
               after   = Finished rendering.,
               color   = orange]
               {examples-listing-xyz.tex}
\end{filecontents*}


\begin{filecontents*}[overwrite]{examples-version-n-change-dating.tex}
Bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla...

\medskip % CAUTION! This prevents overlapping.

\tdocdate{2023-09-24}

Ble, ble, ble, ble, ble, ble, ble, ble, ble, ble, ble, ble, ble...

\medskip % CAUTION! This prevents overlapping.

\tdocdate[gray]{2020-05-08}

Bli, bli, bli, bli, bli, bli, bli, bli, bli, bli, bli, bli, bli...

Blo, blo, blo, blo, blo, blo, blo, blo, blo, blo, blo, blo, blo...

Blu, blu, blu, blu, blu, blu, blu, blu, blu, blu, blu, blu, blu...
\end{filecontents*}


\begin{filecontents*}[overwrite]{examples-version-n-change-versioning.tex}
\tdocversion[red]{10.2.0-beta}[2023-12-01]

Bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla...

\bigskip % CAUTION! This prevents overlapping.

\tdocversion{10.2.0-alpha}

Ble, ble, ble, ble, ble, ble, ble, ble, ble, ble, ble, ble, ble,
ble, ble, ble, ble, ble, ble, ble, ble, ble, ble, ble, ble, ble,
ble, ble, ble, ble, ble, ble, ble, ble, ble, ble, ble, ble, ble,
ble, ble, ble, ble, ble, ble, ble, ble, ble, ble, ble, ble...
\end{filecontents*}


\begin{filecontents*}[overwrite]{examples-version-n-change-new.tex}
\begin{tdocnew}
    \item Info 1...
    \item Info 2...
\end{tdocnew}
\end{filecontents*}


\begin{filecontents*}[overwrite]{examples-version-n-change-update.tex}
\begin{tdocupdate}
    \item Info 1...
    \item Info 2...
\end{tdocupdate}
\end{filecontents*}


\begin{filecontents*}[overwrite]{examples-version-n-change-break.tex}
\begin{tdocbreak}
    \item Info 1...
    \item Info 2...
\end{tdocbreak}
\end{filecontents*}


\begin{filecontents*}[overwrite]{examples-version-n-change-pb.tex}
\begin{tdocprob}
    \item Info 1...
    \item Info 2...
\end{tdocprob}
\end{filecontents*}


\begin{filecontents*}[overwrite]{examples-version-n-change-fix.tex}
\begin{tdocfix}
    \item Info 1...
    \item Info 2...
\end{tdocfix}
\end{filecontents*}


\begin{filecontents*}[overwrite]{examples-version-n-change-user-choice.tex}
\begin{tdoctopic}{It's my choice}
% This is where the point needs to be put.
    \item Info 1...
    \item Info 2...
\end{tdoctopic}
\end{filecontents*}


% ------------------------ %
% -- SOURCE FOR THE DOC -- %
% ------------------------ %

\documentclass[10pt, a4paper]{article}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage[english]{babel, varioref}

\usepackage{enumitem}

\usepackage{tabularray}
\usepackage{fmtcount}

\setlength{\parindent}{0em}

% Package documented.
\usepackage[lang = english]{tutodoc}


% Source.
%    * https://tex.stackexchange.com/a/604698/6880

\NewDocumentCommand{ \tdocdocbasicinput }{ m }{%
    Consider the following code.

    \tdoclatexinput[code]{#1}

    This will produce the following.

    \input{#1}
}


% Source.
%    * https://tex.stackexchange.com/a/604698/6880

\NewDocumentCommand{ \tdocdocextraruler }{ m }{%
    \par
    {
        \centering
        \color{green!50!black}%
        \leavevmode
        \kern.075\linewidth
        \leaders\hrule height3.25pt\hfill\kern0pt
        \footnotesize\itshape\bfseries\space\ignorespaces#1\unskip\space
        \leaders\hrule height3.25pt\hfill\kern0pt
        \kern.075\linewidth
        \par
    }
}

\NewDocumentEnvironment{ tdoc-doc-showcase }
                       { O{ Start of the rendering in this doc. }
                         O{ End of rendering in this doc. } }{
        \tdocdocextraruler{#1}
        \nopagebreak\smallskip\nopagebreak
}{
        \nopagebreak\smallskip\nopagebreak
        \tdocdocextraruler{#2}
}



\begin{document}

\title{The \texttt{tutodoc} package - Tutorial-type documentation}
\author{Christophe BAL}
\date{23 Aug. 2024 - Version 1.2.0-a}

\maketitle

\begin{abstract}
The \tdocpack{tutodoc} package
\footnote{
    The name comes from \tdocquote{\tdocprewhy{tuto.rial-type} \tdocprewhy{doc.umentation}}.
}
is used by its author to semantically produce documentation of \LaTeX\ packages and classes in a tutorial style
\footnote{
    The idea is to produce an efficient \texttt{PDF} file that can be browsed for one-off needs. This is generally what is expected of coding documentation.
},
and with a sober rendering for reading on screen.


\begin{tdocnote}
    This package imposes a formatting style. In the not-too-distant future, \tdocpack{tutodoc} will probably be split into a class and a package.
\end{tdocnote}
\end{abstract}


\newpage
\tableofcontents
\newpage
\section{General formatting imposed}

\subsection{Page geometry}

The \tdocpack{geometry} package is loaded with the following settings.


\begin{tdoclatex}[code]
\RequirePackage[
  top            = 2.5cm,
  bottom         = 2.5cm,
  left           = 2.5cm,
  right          = 2.5cm,
  marginparwidth = 2cm,
  marginparsep   = 2mm,
  heightrounded
]{geometry}
\end{tdoclatex}


\subsection{Title and table of contents}

The \tdocpack{titlesec} and \tdocpack{tocbasic} packages are set as follows.


\begin{tdoclatex}[code]
\RequirePackage[raggedright]{titlesec}

% ...
\ifcsundef{chapter}%
          {}%
          {\renewcommand\thechapter{\Alph{chapter}.}}

\renewcommand\thesection{\Roman{section}.}
\renewcommand\thesubsection{\arabic{subsection}.}
\renewcommand\thesubsubsection{\roman{subsubsection}.}

\titleformat{\paragraph}[hang]%
            {\normalfont\normalsize\bfseries}%
            {\theparagraph}{1em}%
            {}

\titlespacing*{\paragraph}%
              {0pt}%
              {3.25ex plus 1ex minus .2ex}%
              {0.5em}

% Source
%    * https://tex.stackexchange.com/a/558025/6880
\DeclareTOCStyleEntries[
  raggedentrytext,
  linefill = \hfill,
  indent   = 0pt,
  dynindent,
  numwidth = 0pt,
  numsep   = 1ex,
  dynnumwidth
]{tocline}{
  chapter,
  section,
  subsection,
  subsubsection,
  paragraph,
  subparagraph
}

\DeclareTOCStyleEntry[indentfollows = chapter]{tocline}{section}
\end{tdoclatex}


\subsection{Dynamic links}

The \tdocpack{hyperref} package is imported behind the scenes with the settings below.


\begin{tdoclatex}[code]
\hypersetup{
  colorlinks,
  citecolor = orange!75!black,
  filecolor = orange!75!black,
  linkcolor = orange!75!black,
  urlcolor  = orange!75!black
}
\end{tdoclatex}


\section{Select language when loading package}

By default, \tdocpack{tutodoc} is set for English, but it is possible to change the language: for example, a French documentation will use \tdocinlatex|\usepackage[lang = french]{tutodoc}| .
For the moment, we only have the following two choices.

\begin{enumerate}
    \item \tdocinlatex|english| is the default value.

    \item \tdocinlatex|french|
\end{enumerate}


\begin{tdocnote}
    Language names are those suggested by the \tdocpack{babel} package.
\end{tdocnote}


\section{What does that mean in \tdocquote{English}?}

The macro \tdocmacro{tdocinEN} and its starred version are useless for English speakers because they have the following effects.


\begin{tdoclatex}
Cool and top stand for \tdocinEN*{cool} and \tdocinEN{top}.
\end{tdoclatex}


The macro \tdocmacro{tdocinEN} and its starred version are based on \tdocmacro{tdocquote} : for example, \tdocquote{semantic} is obtained via \tdocinlatex|tdocquote{semantic}| .


\begin{tdocnote}
    As the text \tdocquote{in English} is translated into the language indicated when \tdocpack{tutodoc} is imported, the macro \tdocmacro{tdocinEN} and its starred version become useful for non-English speakers.
\end{tdocnote}


\section{Highlighting content}

\begin{tdocnote}
    The environments presented in this section
    \footnote{
        The formatting comes from the \tdocpack{amsthm} package.
    }
    add a short title indicating the type of information provided.
    This short text will always be translated into the language indicated when the \tdocpack{tutodoc} package is loaded.
\end{tdocnote}


% ------------------ %


\subsection{Examples}

Numbered or unnumbered examples can be indicated using the \tdocenv{tdocexa} environment, which offers two optional arguments.

\begin{enumerate}
    \item The \ordinalnum{1} argument between brackets \tdocinlatex#<...># can take the values \tdocinlatex#nb# to number, which is the default setting, and \tdocinlatex#nonb# to not number.

    \item The \ordinalnum{2} argument in square brackets \tdocinlatex#[...]# is used to add a mini-title..
\end{enumerate}


Here are some possible uses.

\tdoclatexinput[sbs]{examples-focus-exa.tex}


% ------------------ %


\begin{tdocimportant}
    The numbering of the examples is reset to zero as soon as a section with a level at least equal to a \tdocinlatex|\subsubsection| is opened.
\end{tdocimportant}


% ------------------ %


\begin{tdoctip}
    It can sometimes be useful to return to the line at the start of the content. Here's how to do it (this trick remains valid for the environments presented in the following sub-sections). Note in passing that the numbering follows that of the previous example as desired.

    \tdoclatexinput[sbs]{examples-focus-exa-leavevmode.tex}
\end{tdoctip}


\subsection{Some remarks}

Everything happens via the \tdocenv{tdocrem} environment, as in the following example.

\tdoclatexinput[sbs]{examples-focus-rmk.tex}


\subsection{A tip}

The \tdocenv{tdoctip} environment is used to give tips. Here's how to use it.

\tdoclatexinput[sbs]{examples-focus-tip.tex}


\subsection{Informative note}

The \tdocenv{tdocnote} environment is used to highlight useful information. Here's how to use it.

\tdoclatexinput[sbs]{examples-focus-note.tex}


\subsection{Something important}

The \tdocenv{tdocimportant} environment is used to indicate something important but harmless.

\tdoclatexinput[sbs]{examples-focus-important.tex}


\subsection{Caution about a delicate point}

The \tdocenv{tdoccaution} environment is used to indicate a delicate point to the user. Here's how to use it.

\tdoclatexinput[sbs]{examples-focus-caution.tex}


\subsection{Warning of danger}

The \tdocenv{tdocwarn} environment is used to warn the user of a trap to avoid. Here's how to use it.

\tdoclatexinput[sbs]{examples-focus-warn.tex}


\section{Specify packages, classes, macros or environments}

Here's what you can type semantically.


\begin{tdoclatex}[sbs]
\tdoccls{myclass} is for...

\tdocpack{mypackage} is for...

\tdocmacro{onemacro} is for...

\tdocenv{env} produces...

We also have :

\tdocenv[{[opt1]<opt2>}]{env}
\end{tdoclatex}


\begin{tdocrem}
    The advantage of the previous macros over the use of \tdocmacro{tdocinlatex}, see the section \ref{tdoc-listing-inline} page \pageref{tdoc-listing-inline}, is the absence of colouring.
    Furthermore, the \tdocmacro{tdocenv} macro simply asks you to type the name of the environment
    \footnote{
        In addition, \tdocinlatex{\tdocenv{monenv}} produces \tdocenv{monenv} with spaces to allow line breaks if necessary.
    }
    with any options by typing the correct delimiters
    \footnote{
        Remember that almost anything is possible from now on.
    }
    by hand.
\end{tdocrem}


\begin{tdocwarn}
    The optional argument to the \tdocmacro{tdocenv} macro is copied and pasted during rendering. This can sometimes require the use of protective braces, as in the previous example.
\end{tdocwarn}


% -------------------- %


\section{Origin of a prefix or suffix}

To explain the names chosen, there is nothing like indicating and explaining the short prefixes and suffixes used. This is easily done as follows.


\begin{tdoclatex}[sbs]
\tdocpre{sup} relates to...

\tdocprewhy{sup.erbe} means...

\emph{\tdocprewhy{sup.er} for...}
\end{tdoclatex}


\begin{tdocrem}
    The choice of a full stop to split a word allows words with a hyphen to be used, as in \tdocinlatex+\tdocprewhy{bric.k-breaker}+ which gives \tdocprewhy{bric.k-breaker}.
\end{tdocrem}


\section{A real-life rendering} \label{tdoc-showcase}

It is sometimes useful to render code directly in the documentation. This type of rendering must be dissociable from the explanatory text.


% ------------------ %


\subsection{With a coloured stripe}

\begin{tdocexa} [With default text]
    It can be useful to show a real rendering directly in a document
    \footnote{
        Typically when making a demo.
    }.
    This is done via \tdocenv{tdocshowcase} as follows.

    \tdoclatexinput[code]{examples-showcase-default.tex}

    The result is the following rendering
    \footnote{
        Behind the scenes, the strip is created effortlessly using the \tdocpack{clrstrip} package.
    }.

    \medskip

    \input{examples-showcase-default.tex}
\end{tdocexa}


\begin{tdocrem}
    See the section \ref{tdoc-latexshow} on page \pageref{tdoc-latexshow} to easily obtain code followed by its actual rendering as in the previous example.
\end{tdocrem}


\begin{tdocnote}
    The explanatory texts adapt to the language chosen when \tdocpack{tutodoc} is loaded.
\end{tdocnote}


% ------------------ %


\begin{tdocexa}[Change the default colour and/or text]
    \leavevmode

    \tdoclatexinput[code]{examples-showcase-customized.tex}

    This will produce the following.

    \medskip

    \input{examples-showcase-customized.tex}
\end{tdocexa}


\begin{tdocnote}
    You will have noticed that we don't obtain a pure red: behind the scenes, the expandable macros \tdocmacro{tdocbackcolor} and \tdocmacro{tdocdarkcolor} are used to create the background and title colours respectively from the ones proposed in \tdocenv{tdocshowcase}.
    These macros have a single argument, the chosen colour, and accept the following codes.

    \begin{tdoclatex}[code]
\NewExpandableDocumentCommand{\tdocbackcolor}{m}{#1!5}
\NewExpandableDocumentCommand{\tdocdarkcolor}{m}{#1!50!black}
    \end{tdoclatex}
\end{tdocnote}


% ------------------ %


\begin{tdocwarn}
    With the default settings, if the code to be formatted begins with an opening bracket, use \tdocmacro{string} as in the following example.

    \tdoclatexinput[code]{examples-showcase-hook.tex}

    This will produce the following.

    \medskip

    \input{examples-showcase-hook.tex}
\end{tdocwarn}


\begin{tdocnote}
    Behind the scenes, the \tdocmacro{tdocruler} macro is used.

    \begin{tdoclatex}[std]
        \tdocruler{Un pseudo-titre décoré}{red}
    \end{tdoclatex}
\end{tdocnote}


\subsection{Without a colour strip}

The rendering of \tdocenv{tdocshowcase} with a coloured strip may not be suitable, or sometimes may not be acceptable despite the work done by \tdocpack{clrstrip}.
It is possible not to use a coloured strip, as we will see straight away.


\begin{tdocexa}
    The use of \tdocenv[{[nostripe]}]{tdocshowcase} indicate to not use \tdocpack{clrstrip}.
    Here is an example.

    \tdoclatexinput[code]{examples-showcase-no-clrstrip.tex}

    This will produce the following.

    \medskip

    \input{examples-showcase-no-clrstrip.tex}
\end{tdocexa}


% ------------------ %


\begin{tdocexa}[Change the default colour and/or text]
    \leavevmode

    \tdoclatexinput[code]{examples-showcase-no-clrstrip-customized.tex}

    This will produce the following.

    \medskip

    \input{examples-showcase-no-clrstrip-customized.tex}
\end{tdocexa}


\subsection{By importing the \LaTeX\ code}

To obtain renderings by importing the code from an external file, instead of typing it, simply use the \tdocmacro{tdocshowcaseinput} macro whose option uses the syntax of that of \tdocenv{tdocshowcase} and the mandatory argument corresponds to the path of the file.


\begin{tdocexa}<nonb>
    The following was obtained via \tdocinlatex+\tdocshowcaseinput{external.tex}+.

    \medskip

    \tdocshowcaseinput{examples-showcase-external.tex}

    \medskip

    As for \tdocinlatex+\tdocshowcaseinput[color = orange]{external.tex}+\,, this will produce the colour change shown below.

    \medskip

    \tdocshowcaseinput[color = orange]{examples-showcase-external.tex}
\end{tdocexa}


\section{Use cases in \LaTeX}

Documenting a package or a class is done efficiently using use cases showing both the code and the corresponding result.


% ------------------ %


\subsection{\tdocquote{Inline} codes} \label{tdoc-listing-inline}

The \tdocmacro{tdocinlatex} macro
\footnote{
    The name of the macro \tdocmacro{tdocinlatex} comes from \tdocquote{\tdocprewhy{in.line} \LaTeX}.
}
can be used to type inline code in a similar way to \tdocmacro{verb}.
Here are some examples.


\begin{tdoclatex}[sbs]
    1: \tdocinlatex|$a^b = c$|

    2: \tdocinlatex+\tdocinlatex|$a^b = c$|+
\end{tdoclatex}


\begin{tdocnote}
    The \tdocmacro{tdocinlatex} macro can be used in a footnote: see below.
    \footnote{
        \tdocinlatex+$minted = TOP$+ has been typed \tdocinlatex|\tdocinlatex+$minted = TOP$+| in this footnote...
    }.
    In addition, a background color is deliberately used to subtly highlight the codes \tdocinlatex#\LaTeX#\,.
\end{tdocnote}


% ------------------ %


\subsection{Directly typed codes}

\begin{tdocexa}[Side by side]
    Using \tdocenv[{[sbs]}]{tdoclatex}, we can display a code and its rendering side by side.
    \tdocdocbasicinput{examples-listing-ABC.tex}
\end{tdocexa}


% ------------------ %


\begin{tdocexa}[Following]
    \tdocenv{tdoclatex} produces the following result, which corresponds to the default option \tdocinlatex#std#
    \footnote{
        \tdocinlatex{std} refers to the \tdocquote{standard} behaviour of \tdocpack{tcolorbox} in relation to the \tdocpack{minted} library.
    }.

    \begin{tdoclatex}
        $A = B + C$
    \end{tdoclatex}
\end{tdocexa}


% ------------------ %


\begin{tdocexa}[Just the code]
    Via \tdocenv[{[code]}]{tdoclatex}, we'll just get the code as shown below.

    \begin{tdoclatex}[code]
        $A = B + C$
    \end{tdoclatex}
\end{tdocexa}


% ------------------ %


\begin{tdocwarn}
    With default formatting, if the code begins with an opening bracket, the default option must be explicitly indicated.
    \tdocdocbasicinput{examples-listing-strange.tex}

    \smallskip

    Another method is to use the \tdocmacro{string} primitive.
    \tdocdocbasicinput{examples-listing-strange-bis.tex}
\end{tdocwarn}


\subsection{Imported codes}

For the following codes, consider a file with the relative path \verb+examples-listing-xyz.tex+, and with the following contents.

\tdoclatexinput[code]{examples-listing-xyz.tex}

\medskip

The \tdocmacro{tdoclatexinput} macro, shown below, expects the path of a file and offers the same options as the \tdocenv{tdoclatex} environment.


% ------------------ %


\begin{tdocexa}[Side by side]
    \leavevmode

    \begin{tdoclatex}[code]
\tdoclatexinput[sbs]{examples-listing-xyz.tex}
    \end{tdoclatex}

    This produces the following layout.

    \tdoclatexinput[sbs]{examples-listing-xyz.tex}
\end{tdocexa}


% ------------------ %


\begin{tdocexa}[Following]
    \leavevmode

    \begin{tdoclatex}[code]
\tdoclatexinput{examples-listing-xyz.tex}
    \end{tdoclatex}

    This produces the following formatting where the default option is \tdocinlatex#std#.

    \tdoclatexinput{examples-listing-xyz.tex}
\end{tdocexa}


% ------------------ %


\begin{tdocexa}[Just the code]
    \leavevmode

    \begin{tdoclatex}[code]
\tdoclatexinput[code]{examples-listing-xyz.tex}
    \end{tdoclatex}

    This produces the following layout.

    \tdoclatexinput[code]{examples-listing-xyz.tex}
\end{tdocexa}


% ------------------ %


\subsection{Imported codes put into practice} \label{tdoc-latexshow}

\begin{tdocexa}[Showcase]
    The following comes from \tdocinlatex+\tdoclatexshow{examples-listing-xyz.tex}+.

    \medskip

    \begin{tdoc-doc-showcase}
        \tdoclatexshow{examples-listing-xyz.tex}
    \end{tdoc-doc-showcase}
\end{tdocexa}


\begin{tdocnote}
    The default texts take into account the language chosen when loading the package \tdocpack{tutodoc}.
\end{tdocnote}


% ------------------ %


\begin{tdocexa}[Changing the explanatory text]
    Using the key \tdocinlatex|explain|, you can use custom text. Thus, \tdocinlatex|tdoclatexshow[explain = Here is the actual rendering.]{examples-listing-xyz.tex}| will produce the following.

    \medskip

    \begin{tdoc-doc-showcase}
        \tdoclatexshow[explain = Here is the actual rendering.]{examples-listing-xyz.tex}
    \end{tdoc-doc-showcase}
\end{tdocexa}


% ------------------ %


\begin{tdocexa}[The options available]
    In addition to the explanatory text, it is also possible to use all the options of \tdocenv{tdocshowcase}, see \ref{tdoc-showcase} page \pageref{tdoc-showcase}.
    Here is an example to illustrate this.

    \medskip

    \tdoclatexinput[code]{examples-listing-latexshow-options.tex}

    \medskip

    This will produce the following.

    \medskip

    \begin{tdoc-doc-showcase}
        \input{examples-listing-latexshow-options.tex}
    \end{tdoc-doc-showcase}
\end{tdocexa}


\section{Indicate changes}

To make it easier to monitor a package, it is essential to provide a history indicating the changes made when a new version is published.


% ------------------ %


\subsection{When?}

You can either date something, or version it, in which case the version number can be dated.


% ------------------ %


\begin{tdocexa}[Dating new products]
    The \tdocmacro{tdocdate} macro is used to indicate a date in the margin, as in the following example.

    \tdoclatexshow{examples-version-n-change-dating.tex}
\end{tdocexa}


% ------------------ %


\begin{tdocexa}[Versioning new features, possibly with a date]
    Associating a version number with a new feature is done using the \tdocmacro{tdocversion} macro, with the colour and date being optional arguments.

    \tdoclatexshow{examples-version-n-change-versioning.tex}
\end{tdocexa}


\begin{tdocimportant}
    \leavevmode

    \begin{enumerate}
        \item The \tdocmacro{tdocdate} and \tdocmacro{tdocversion} macros require two compilations.

        \item The final rendering of the dates takes into account the language specified when loading the package \tdocpack{tutodoc}: for example, if French is selected, the dates will be displayed in the format \texttt{DD/MM/YYYY}.
    \end{enumerate}
\end{tdocimportant}


\begin{tdocwarn}
    Only the use of the digital format \tdocinlatex+YYYY-MM-DD+ is verified.
    \footnote{
        Technically, checking the validity of a date using \LaTeX3 presents no difficulty.
    },
    and this is a choice! Why? Quite simply because dating and versioning explanations should be done semi-automatically to avoid any human bugs.
\end{tdocwarn}


\subsection{What's new?}

\tdocpack{tutodoc} offers different environments to indicate quickly and clearly what has been done
\footnote{
    The user doesn't need all the technical details.
}
during the latest changes.


\begin{tdocexa}[For new features]
    \leavevmode

    \tdoclatexinput[sbs]{examples-version-n-change-new.tex}
\end{tdocexa}


% ------------------ %


\begin{tdocexa}[For updates]
    \leavevmode

    \tdoclatexinput[sbs]{examples-version-n-change-update.tex}
\end{tdocexa}


% ------------------ %


\begin{tdocexa}[For breaks]
    \leavevmode

    \tdoclatexinput[sbs]{examples-version-n-change-break.tex}
\end{tdocexa}


% ------------------ %


\begin{tdocexa}[For problems]
    \leavevmode

    \tdoclatexinput[sbs]{examples-version-n-change-pb.tex}
\end{tdocexa}


% ------------------ %


\begin{tdocexa}[For fixes]
    \leavevmode

    \tdoclatexinput[sbs]{examples-version-n-change-fix.tex}
\end{tdocexa}


% ------------------ %


\begin{tdocexa}[Chosen topics]
    \leavevmode

    \tdoclatexinput[sbs]{examples-version-n-change-user-choice.tex}
\end{tdocexa}


\section{Ornaments}

Let's finish this documentation with a few small formatting tools that can be very useful.


\begin{tdoclatex}[sbs]
Bla, bla, bla...

\tdocsep % Practical for demarcation.

This works with enumerations.

\begin{itemize}
    \item Underline.

    \item Something else useful.
\end{itemize}

\tdocsep % Uniform behaviour.

Ble, ble, ble...

Bli, bli, bli...

\tdocxspace % Subtle space
            % but useful.

Blo, blo, blo...

Blu, blu, blu...

\end{tdoclatex}
\section{History}

\tdocversion{1.2.0-a}[2024-08-23]

\begin{tdocupdate}
	\item \tdocmacro{tdocversion}
    \begin{enumerate}
		\item The version number is above the date.

		\item The spacing is better managed when the date is absent.
    \end{enumerate}
\end{tdocupdate}


\begin{tdocfix}
	\item Content highlighting: the French translations of \tdocinEN*{caution} and \tdocinEN*{danger} were incorrect.
\end{tdocfix}

\tdocsep

\tdocversion{1.1.0}[2024-01-06]

\begin{tdocnew}
	\item Change log : two new environments.
    \begin{enumerate}
        \item \tdocenv{tdocbreak} for breaking changes which are not backward compatible.

        \item \tdocenv{tdocprob} for identified problems.
    \end{enumerate}

	\item \tdocmacro{tdocinlatex}: a light yellow is used as the background color.
\end{tdocnew}

\tdocsep

\tdocversion{1.0.1}[2023-12-08]

\begin{tdocfix}
	\item \tdocmacro{tdocenv}: spacing is now correct, even if the \tdocpack{babel} package is not loaded with the French language.

	\item \tdocenv[{[nostripe]}]{tdocshowcase}: page breaks around \tdocquote{framing} lines should be rare from now on.
\end{tdocfix}

\tdocsep

\tdocversion{1.0.0}[2023-11-29]

First public version of the project.


\end{document}
