summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/tutodoc/doc/tutodoc-en.tex
blob: 8d628d7b4a8917e1d2c3a0a193abb6e73f925d07 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117

% -------------------- %
% -- 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-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-fix.tex}
\begin{tdocfix}
    \item Info 1...
    \item Info 2...
\end{tdocfix}
\end{filecontents*}


\begin{filecontents*}[overwrite]{examples-version-n-change-topic.tex}
\begin{tdoctopic}{Unclassifiable changes}
% 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}
%\frenchsetup{StandardItemLabels=true}

\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{Le package \texttt{tutodoc} - Documentation de type tutoriel}
\author{Christophe BAL}
\date{8th Dec. 2023 - Version 1.0.1}

\maketitle

\begin{abstract}
\noindent
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.

\medskip

\noindent
Two important points to note.
\begin{itemize}
    \item This package imposes a formatting style. In the not-too-distant future, \tdocpack{tutodoc} will probably be split into a class and a package.

    \item This documentation is also available in French.
\end{itemize}
\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 \verb#<...># can take the values \verb#nb# to number, which is the default setting, and \verb#nonb# to not number.

    \item The \ordinalnum{2} argument in square brackets \verb#[...]# 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. 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 the bottom of this page
    \footnote{
        \tdocinlatex+$minted = TOP$+ was typed \tdocinlatex|\tdocinlatex+$minted = TOP$+| in this footnote.
    }.
\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}
\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, is used in the same way as the \tdocenv{tdoclatex} environment except that the path to a file is supplied.


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


\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 can be obtained via \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.

    \newpage
%    \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 fixes]
    \leavevmode

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


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


\begin{tdocexa}[Chosen topics]
    \leavevmode

    \tdoclatexinput[sbs]{examples-version-n-change-topic.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.

Ble, ble, ble...

Bli, bli, bli...

\tdocxspace % Subtle space
            % but useful.

Blo, blo, blo...

Blu, blu, blu...

\end{tdoclatex}



\newpage
\section{History}

\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]}]{showcase}: page breaks around the rulers are no longer possible.\end{tdocfix}

\tdocsep

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

First public version of the project.

\end{document}