diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/tutodoc')
11 files changed, 2658 insertions, 1112 deletions
diff --git a/Master/texmf-dist/tex/latex/tutodoc/tutodoc-bw.css.cls b/Master/texmf-dist/tex/latex/tutodoc/tutodoc-bw.css.cls new file mode 100644 index 00000000000..4dc1296f243 --- /dev/null +++ b/Master/texmf-dist/tex/latex/tutodoc/tutodoc-bw.css.cls @@ -0,0 +1,234 @@ +% ================= % +% == ADMONITIONS == % +% ================= % + +% ------------------------- % +% -- ICONS & ENV. COLORS -- % +% ------------------------- % + +\ExplSyntaxOn + +%%% +% We use two ''prop'' variables to associate each \env to its icon +% and color. +%%% +\prop_new:N \g__tutodoc_focus_color_prop +\prop_new:N \g__tutodoc_focus_icon_prop + +\prop_set_from_keyval:Nn \g__tutodoc_focus_color_prop { + note = DarkGray, + tip = DarkGray, + imp = DarkGray, + caut = DarkGray, + warn = DarkGray, +} + +\prop_set_from_keyval:Nn \g__tutodoc_focus_icon_prop { + note = \faInfoCircle, + tip = \faLightbulb, + imp = \faHighlighter, + caut = \faBiohazard, + warn = \faSkullCrossbones, +} + +\ExplSyntaxOff + + +% ------------------ % +% -- EXTRA COLORS -- % +% ------------------ % + +\NewExpandableDocumentCommand{\tutodoc@build@title@color}{m}{% + white% +} + +\NewExpandableDocumentCommand{\tutodoc@build@upper@color}{m}{% + \tdocdarkcolor[40]{Gray}% +} + +\NewExpandableDocumentCommand{\tutodoc@build@back@color}{m}{% + \tdoclightcolor[10]{Gray}% +} + +\NewExpandableDocumentCommand{\tutodoc@build@frame@color}{m}{% + Gray!75!black!45% +} + +\colorlet{tutodoc@admonition@shadow@color}{Gray!15} + + +% ----------------------- % +% -- VERTICAL SPACINGS -- % +% ----------------------- % + +\newcommand{\tutodoc@admonition@space@above}{\medskipamount} +\newcommand{\tutodoc@admonition@space@below}{\medskipamount} + + + +% ========================= % +% == LISTINGS - AGNOSTIC == % +% ========================= % + +% ----------------- % +% -- INLINE CODE -- % +% ----------------- % + +\newcommand{\tutodoc@code@style}{friendly_grayscale} + +\colorlet{tutodoc@code@back@color}{gray!5} +\colorlet{tutodoc@code@text@color}{black} + + +% -------------------------------- % +% -- FRAMED LISTING (tcolorbox) -- % +% -------------------------------- % + +\colorlet{tutodoc@code@frame@color}{darkgray} + +\newcommand{\tutodoc@code@left@len}{3pt} +\newcommand{\tutodoc@code@right@len}{3pt} +\newcommand{\tutodoc@code@top@len}{1.5pt} +\newcommand{\tutodoc@code@bottom@len}{1.5pt} + +\newcommand{\tutodoc@code@arc@len}{2pt} + +\newcommand{\tutodoc@code@left@rule@len}{1pt} +\newcommand{\tutodoc@code@right@rule@len}{1pt} +\newcommand{\tutodoc@code@top@rule@len}{1pt} +\newcommand{\tutodoc@code@bottom@rule@len}{1pt} + +\colorlet{tutodoc@code@shadow@color}{Gray!25} + +\newcommand{\tutodoc@code@shadow@xshift@len}{.75mm} +\newcommand{\tutodoc@code@shadow@yshift@len}{-.75mm} +\newcommand{\tutodoc@code@shadow@offset@len}{0mm} + +\colorlet{tutodoc@code@segment@color}{gray} + + + +% ====================== % +% == LISTINGS - LATEX == % +% ====================== % + +% ---------------- % +% -- LEXER USED -- % +% ---------------- % + +\newcommand{\tutodoc@latex@lexer}{latex} + + +% ----------------- % +% -- INLINE CODE -- % +% ----------------- % + +\newcommand{\tutodoc@latex@style}{friendly_grayscale} + +\colorlet{tutodoc@latex@back@color}{gray!5} +\colorlet{tutodoc@latex@text@color}{black} + + +% -------------------------------- % +% -- FRAMED LISTING (tcolorbox) -- % +% -------------------------------- % + +\colorlet{tutodoc@latex@frame@color}{darkgray} + +\newcommand{\tutodoc@latex@left@len}{3pt} +\newcommand{\tutodoc@latex@right@len}{3pt} +\newcommand{\tutodoc@latex@top@len}{1.5pt} +\newcommand{\tutodoc@latex@bottom@len}{1.5pt} + +\newcommand{\tutodoc@latex@arc@len}{2pt} + +\newcommand{\tutodoc@latex@left@rule@len}{1pt} +\newcommand{\tutodoc@latex@right@rule@len}{1pt} +\newcommand{\tutodoc@latex@top@rule@len}{1pt} +\newcommand{\tutodoc@latex@bottom@rule@len}{1pt} + +\colorlet{tutodoc@latex@shadow@color}{Gray!25} + +\newcommand{\tutodoc@latex@shadow@xshift@len}{.75mm} +\newcommand{\tutodoc@latex@shadow@yshift@len}{-.75mm} +\newcommand{\tutodoc@latex@shadow@offset@len}{0mm} + +\colorlet{tutodoc@latex@segment@color}{gray} + + + +% ========================== % +% == TEXT AND PAGE COLORS == % +% ========================== % + +\colorlet{tutodoc@page@color}{white} +\colorlet{tutodoc@text@color}{black} + + +% ================= % +% == LINKS COLOR == % +% ================= % + +\definecolor{tutodoc@link@color}{named}{DimGray} + + + +% ============== % +% == SHOWCASE == % +% ============== % + +\NewExpandableDocumentCommand{\tutodoc@showcase@rule@color}{}{% + black% +} + +\NewExpandableDocumentCommand{\tutodoc@showcase@stripe@color}{}{% + darkgray% +} + +\NewExpandableDocumentCommand{\tutodoc@showcase@text@color}{}{% + black% +} + +\NewExpandableDocumentCommand{\tutodoc@showcase@build@rule@color}{m}{% + black% +} + +\NewExpandableDocumentCommand{\tutodoc@showcase@build@back@color}{m}{% + gray!10% +} + + + +% ======================= % +% == VERSION & CHANGES == % +% ======================= % + +% -------------------- % +% -- DATE & VERSION -- % +% -------------------- % + +\NewExpandableDocumentCommand{\tutodoc@changes@when@color}{}{% + gray% +} + + +% --------------------------- % +% -- ENVS FOR CHANGES MADE -- % +% --------------------------- % + +\newcommand{\tutodoc@changes@start@project@icon}{\faAnchor} + +\ExplSyntaxOn + +\prop_new:N \g__tutodoc_topic_change_prop +\prop_set_from_keyval:Nn \g__tutodoc_topic_change_prop { + break = \faCodeBranch, + fix = \faWrench, + new = \faGem, + prob = \faFire*, + tech = \faFlask, + update = \reflectbox{\faHistory}, + todo = \faCompass[regular], +} + +\ExplSyntaxOff diff --git a/Master/texmf-dist/tex/latex/tutodoc/tutodoc-color.css.cls b/Master/texmf-dist/tex/latex/tutodoc/tutodoc-color.css.cls new file mode 100644 index 00000000000..50f46702e7f --- /dev/null +++ b/Master/texmf-dist/tex/latex/tutodoc/tutodoc-color.css.cls @@ -0,0 +1,238 @@ +% ================= % +% == ADMONITIONS == % +% ================= % + +% ------------------------- % +% -- ICONS & ENV. COLORS -- % +% ------------------------- % + +\ExplSyntaxOn + +%%% +% We use two ''prop'' variables to associate each \env to its icon +% and color. +%%% +\prop_new:N \g__tutodoc_focus_color_prop +\prop_new:N \g__tutodoc_focus_icon_prop + +\prop_set_from_keyval:Nn \g__tutodoc_focus_color_prop { + note = cyan, + tip = ForestGreen, + imp = orange, + caut = violet, + warn = red, +} + +\prop_set_from_keyval:Nn \g__tutodoc_focus_icon_prop { + note = \faInfoCircle, + tip = \faLightbulb, + imp = \faHighlighter, + caut = \faBiohazard, + warn = \faSkullCrossbones, +} + +\ExplSyntaxOff + + +% ------------------ % +% -- EXTRA COLORS -- % +% ------------------ % + +\NewExpandableDocumentCommand{\tutodoc@build@title@color}{m}{% + white% +} + +\NewExpandableDocumentCommand{\tutodoc@build@upper@color}{m}{% + \tdocdarkcolor{#1}% +} + +\NewExpandableDocumentCommand{\tutodoc@build@lower@color}{m}{% + \tdocdarkcolor{#1}% +} + +\NewExpandableDocumentCommand{\tutodoc@build@back@color}{m}{% + \tdoclightcolor{#1}% +} + +\NewExpandableDocumentCommand{\tutodoc@build@frame@color}{m}{% + #1!75!black!45% +} + +\colorlet{tutodoc@admonition@shadow@color}{Gray!17} + + +% ----------------------- % +% -- VERTICAL SPACINGS -- % +% ----------------------- % + +\newcommand{\tutodoc@admonition@space@above}{\medskipamount} +\newcommand{\tutodoc@admonition@space@below}{\medskipamount} + + + +% ========================= % +% == LISTINGS - AGNOSTIC == % +% ========================= % + +% ----------------- % +% -- INLINE CODE -- % +% ----------------- % + +\newcommand{\tutodoc@code@style}{pastie} + +\colorlet{tutodoc@code@back@color}{gray!5} +\colorlet{tutodoc@code@text@color}{black} + + +% -------------------------------- % +% -- FRAMED LISTING (tcolorbox) -- % +% -------------------------------- % + +\colorlet{tutodoc@code@frame@color}{darkgray} + +\newcommand{\tutodoc@code@left@len}{3pt} +\newcommand{\tutodoc@code@right@len}{3pt} +\newcommand{\tutodoc@code@top@len}{1.5pt} +\newcommand{\tutodoc@code@bottom@len}{1.5pt} + +\newcommand{\tutodoc@code@arc@len}{2pt} + +\newcommand{\tutodoc@code@left@rule@len}{1pt} +\newcommand{\tutodoc@code@right@rule@len}{1pt} +\newcommand{\tutodoc@code@top@rule@len}{1pt} +\newcommand{\tutodoc@code@bottom@rule@len}{1pt} + +\colorlet{tutodoc@code@shadow@color}{Gray!25} + +\newcommand{\tutodoc@code@shadow@xshift@len}{.75mm} +\newcommand{\tutodoc@code@shadow@yshift@len}{-.75mm} +\newcommand{\tutodoc@code@shadow@offset@len}{0mm} + +\colorlet{tutodoc@code@segment@color}{gray} + + + +% ====================== % +% == LISTINGS - LATEX == % +% ====================== % + +% ---------------- % +% -- LEXER USED -- % +% ---------------- % + +\newcommand{\tutodoc@latex@lexer}{latex} + + +% ----------------- % +% -- INLINE CODE -- % +% ----------------- % + +\newcommand{\tutodoc@latex@style}{pastie} + +\colorlet{tutodoc@latex@back@color}{gray!5} +\colorlet{tutodoc@latex@text@color}{black} + + +% -------------------------------- % +% -- FRAMED LISTING (tcolorbox) -- % +% -------------------------------- % + +\colorlet{tutodoc@latex@frame@color}{darkgray} + +\newcommand{\tutodoc@latex@left@len}{3pt} +\newcommand{\tutodoc@latex@right@len}{3pt} +\newcommand{\tutodoc@latex@top@len}{1.5pt} +\newcommand{\tutodoc@latex@bottom@len}{1.5pt} + +\newcommand{\tutodoc@latex@arc@len}{2pt} + +\newcommand{\tutodoc@latex@left@rule@len}{1pt} +\newcommand{\tutodoc@latex@right@rule@len}{1pt} +\newcommand{\tutodoc@latex@top@rule@len}{1pt} +\newcommand{\tutodoc@latex@bottom@rule@len}{1pt} + +\colorlet{tutodoc@latex@shadow@color}{Gray!25} + +\newcommand{\tutodoc@latex@shadow@xshift@len}{.75mm} +\newcommand{\tutodoc@latex@shadow@yshift@len}{-.75mm} +\newcommand{\tutodoc@latex@shadow@offset@len}{0mm} + +\colorlet{tutodoc@latex@segment@color}{gray} + + + +% ========================== % +% == TEXT AND PAGE COLORS == % +% ========================== % + +\colorlet{tutodoc@page@color}{white} +\colorlet{tutodoc@text@color}{black} + + +% ================= % +% == LINKS COLOR == % +% ================= % + +\colorlet{tutodoc@link@color}{NavyBlue!85!white} + + + +% ============== % +% == SHOWCASE == % +% ============== % + +\NewExpandableDocumentCommand{\tutodoc@showcase@rule@color}{}{% + black% +} + +\NewExpandableDocumentCommand{\tutodoc@showcase@stripe@color}{}{% + cyan% +} + +\NewExpandableDocumentCommand{\tutodoc@showcase@text@color}{}{% + black% +} + +\NewExpandableDocumentCommand{\tutodoc@showcase@build@rule@color}{m}{% + \tdocdarkcolor{#1}% +} + +\NewExpandableDocumentCommand{\tutodoc@showcase@build@back@color}{m}{% + \tdoclightcolor{#1}% +} + + + +% ======================= % +% == VERSION & CHANGES == % +% ======================= % + +% -------------------- % +% -- DATE & VERSION -- % +% -------------------- % + +\NewExpandableDocumentCommand{\tutodoc@changes@when@color}{}{% + \tdoclightcolor[60]{DarkBlue}% +} + + +% --------------------------- % +% -- ENVS FOR CHANGES MADE -- % +% --------------------------- % + +\newcommand{\tutodoc@changes@start@project@icon}{\faAnchor} + +\ExplSyntaxOn + +\prop_new:N \g__tutodoc_topic_change_prop +\prop_set_from_keyval:Nn \g__tutodoc_topic_change_prop { + break = \faCodeBranch, + fix = \faWrench, + new = \faGem, + prob = \faFire*, + tech = \faFlask, + update = \reflectbox{\faHistory}, + todo = \faCompass[regular], +} + +\ExplSyntaxOff diff --git a/Master/texmf-dist/tex/latex/tutodoc/tutodoc-dark.css.cls b/Master/texmf-dist/tex/latex/tutodoc/tutodoc-dark.css.cls new file mode 100644 index 00000000000..867264c1a17 --- /dev/null +++ b/Master/texmf-dist/tex/latex/tutodoc/tutodoc-dark.css.cls @@ -0,0 +1,238 @@ +% ================= % +% == ADMONITIONS == % +% ================= % + +% ------------------------- % +% -- ICONS & ENV. COLORS -- % +% ------------------------- % + +\ExplSyntaxOn + +%%% +% We use two ''prop'' variables to associate each \env to its icon +% and color. +%%% +\prop_new:N \g__tutodoc_focus_color_prop +\prop_new:N \g__tutodoc_focus_icon_prop + +\prop_set_from_keyval:Nn \g__tutodoc_focus_color_prop { + note = cyan, + tip = ForestGreen, + imp = orange, + caut = violet, + warn = red, +} + +\prop_set_from_keyval:Nn \g__tutodoc_focus_icon_prop { + note = \faInfoCircle, + tip = \faLightbulb, + imp = \faHighlighter, + caut = \faBiohazard, + warn = \faSkullCrossbones, +} + +\ExplSyntaxOff + + +% ------------------ % +% -- EXTRA COLORS -- % +% ------------------ % + +\NewExpandableDocumentCommand{\tutodoc@build@title@color}{m}{% + \tdocdarkcolor[95]{white}% +} + +\NewExpandableDocumentCommand{\tutodoc@build@upper@color}{m}{% + \tdocdarkcolor[95]{white}% +} + +\NewExpandableDocumentCommand{\tutodoc@build@lower@color}{m}{% + \tdocdarkcolor[95]{white}% +} + +\NewExpandableDocumentCommand{\tutodoc@build@back@color}{m}{% + #1!75!black!65% +} + +\NewExpandableDocumentCommand{\tutodoc@build@frame@color}{m}{% + \tdocdarkcolor[65]{#1}% +} + +\colorlet{tutodoc@admonition@shadow@color}{black!80} + + +% ----------------------- % +% -- VERTICAL SPACINGS -- % +% ----------------------- % + +\newcommand{\tutodoc@admonition@space@above}{\medskipamount} +\newcommand{\tutodoc@admonition@space@below}{\medskipamount} + + + +% ========================= % +% == LISTINGS - AGNOSTIC == % +% ========================= % + +% ----------------- % +% -- INLINE CODE -- % +% ----------------- % + +\newcommand{\tutodoc@code@style}{github-dark} + +\colorlet{tutodoc@code@back@color}{\tdocdarkcolor[30]{white}} +\colorlet{tutodoc@code@text@color}{\tdocdarkcolor[80]{white}} + + +% -------------------------------- % +% -- FRAMED LISTING (tcolorbox) -- % +% -------------------------------- % + +\colorlet{tutodoc@code@frame@color}{darkgray} + +\newcommand{\tutodoc@code@left@len}{3pt} +\newcommand{\tutodoc@code@right@len}{3pt} +\newcommand{\tutodoc@code@top@len}{1.5pt} +\newcommand{\tutodoc@code@bottom@len}{1.5pt} + +\newcommand{\tutodoc@code@arc@len}{2pt} + +\newcommand{\tutodoc@code@left@rule@len}{1pt} +\newcommand{\tutodoc@code@right@rule@len}{1pt} +\newcommand{\tutodoc@code@top@rule@len}{1pt} +\newcommand{\tutodoc@code@bottom@rule@len}{1pt} + +\colorlet{tutodoc@code@shadow@color}{black!80} + +\newcommand{\tutodoc@code@shadow@xshift@len}{.75mm} +\newcommand{\tutodoc@code@shadow@yshift@len}{-.75mm} +\newcommand{\tutodoc@code@shadow@offset@len}{0mm} + +\colorlet{tutodoc@code@segment@color}{gray} + + + +% ====================== % +% == LISTINGS - LATEX == % +% ====================== % + +% ---------------- % +% -- LEXER USED -- % +% ---------------- % + +\newcommand{\tutodoc@latex@lexer}{latex} + + +% ----------------- % +% -- INLINE CODE -- % +% ----------------- % + +\newcommand{\tutodoc@latex@style}{github-dark} + +\colorlet{tutodoc@latex@back@color}{\tdocdarkcolor[30]{white}} +\colorlet{tutodoc@latex@text@color}{\tdocdarkcolor[80]{white}} + + +% -------------------------------- % +% -- FRAMED LISTING (tcolorbox) -- % +% -------------------------------- % + +\colorlet{tutodoc@latex@frame@color}{darkgray} + +\newcommand{\tutodoc@latex@left@len}{3pt} +\newcommand{\tutodoc@latex@right@len}{3pt} +\newcommand{\tutodoc@latex@top@len}{1.5pt} +\newcommand{\tutodoc@latex@bottom@len}{1.5pt} + +\newcommand{\tutodoc@latex@arc@len}{2pt} + +\newcommand{\tutodoc@latex@left@rule@len}{1pt} +\newcommand{\tutodoc@latex@right@rule@len}{1pt} +\newcommand{\tutodoc@latex@top@rule@len}{1pt} +\newcommand{\tutodoc@latex@bottom@rule@len}{1pt} + +\colorlet{tutodoc@latex@shadow@color}{black!80} + +\newcommand{\tutodoc@latex@shadow@xshift@len}{.75mm} +\newcommand{\tutodoc@latex@shadow@yshift@len}{-.75mm} +\newcommand{\tutodoc@latex@shadow@offset@len}{0mm} + +\colorlet{tutodoc@latex@segment@color}{gray} + + + +% ========================== % +% == TEXT AND PAGE COLORS == % +% ========================== % + +\colorlet{tutodoc@page@color}{black} +\colorlet{tutodoc@text@color}{\tdocdarkcolor[80]{white}} + + +% ================= % +% == LINKS COLOR == % +% ================= % + +\definecolor{tutodoc@link@color}{HTML}{9591A6} + + + +% ============== % +% == SHOWCASE == % +% ============== % + +\NewExpandableDocumentCommand{\tutodoc@showcase@rule@color}{}{% + white% +} + +\NewExpandableDocumentCommand{\tutodoc@showcase@stripe@color}{}{% + white% +} + +\NewExpandableDocumentCommand{\tutodoc@showcase@text@color}{}{% + white% +} + +\NewExpandableDocumentCommand{\tutodoc@showcase@build@rule@color}{m}{% + \tdocdarkcolor[80]{#1}% +} + +\NewExpandableDocumentCommand{\tutodoc@showcase@build@back@color}{m}{% + \tdocdarkcolor[30]{#1}% +} + + + +% ======================= % +% == VERSION & CHANGES == % +% ======================= % + +% -------------------- % +% -- DATE & VERSION -- % +% -------------------- % + +\NewExpandableDocumentCommand{\tutodoc@changes@when@color}{}{% + \tdoclightcolor[60]{cyan}% +} + + +% --------------------------- % +% -- ENVS FOR CHANGES MADE -- % +% --------------------------- % + +\newcommand{\tutodoc@changes@start@project@icon}{\faAnchor} + +\ExplSyntaxOn + +\prop_new:N \g__tutodoc_topic_change_prop +\prop_set_from_keyval:Nn \g__tutodoc_topic_change_prop { + break = \faCodeBranch, + fix = \faWrench, + new = \faGem, + prob = \faFire*, + tech = \faFlask, + update = \reflectbox{\faHistory}, + todo = \faCompass[regular], +} + +\ExplSyntaxOff diff --git a/Master/texmf-dist/tex/latex/tutodoc/tutodoc-draft.css.cls b/Master/texmf-dist/tex/latex/tutodoc/tutodoc-draft.css.cls new file mode 100644 index 00000000000..3798f815be6 --- /dev/null +++ b/Master/texmf-dist/tex/latex/tutodoc/tutodoc-draft.css.cls @@ -0,0 +1,222 @@ +% ================= % +% == ADMONITIONS == % +% ================= % + +% -------------------------------------- % +% -- ONY CLASSICAL THEOREM-LIKE \ENVS -- % +% -------------------------------------- % + +\ExplSyntaxOn + +%%% +% Without icons and colors, we just use a ''seq'' variable to give +% all the suffixes for the environments concerned. +%%% +\seq_new:N \g__tutodoc_focus_color_seq + +\seq_set_from_clist:Nn \g__tutodoc_focus_color_seq { + note, + tip, + imp, + caut, + warn, +} + +\ExplSyntaxOff + + +% ----------------------- % +% -- VERTICAL SPACINGS -- % +% ----------------------- % + +\newcommand{\tutodoc@admonition@space@above}{2pt plus 2pt} +\newcommand{\tutodoc@admonition@space@below}{2pt plus 2pt} + + + +% ========================= % +% == LISTINGS - AGNOSTIC == % +% ========================= % + +% ----------------- % +% -- INLINE CODE -- % +% ----------------- % + +\codenolexertrue +\newcommand{\tutodoc@code@style}{default} + +\colorlet{tutodoc@code@back@color}{white} +\colorlet{tutodoc@code@text@color}{black} + + +% -------------------------------- % +% -- FRAMED LISTING (tcolorbox) -- % +% -------------------------------- % + +\colorlet{tutodoc@code@frame@color}{darkgray} + +\newcommand{\tutodoc@code@left@len}{2pt} +\newcommand{\tutodoc@code@right@len}{2pt} +\newcommand{\tutodoc@code@top@len}{0pt} +\newcommand{\tutodoc@code@bottom@len}{0pt} + +\newcommand{\tutodoc@code@arc@len}{0pt} + +\newcommand{\tutodoc@code@left@rule@len}{1pt} +\newcommand{\tutodoc@code@right@rule@len}{0pt} +\newcommand{\tutodoc@code@top@rule@len}{0pt} +\newcommand{\tutodoc@code@bottom@rule@len}{0pt} + +\colorlet{tutodoc@code@shadow@color}{black} + +\newcommand{\tutodoc@code@shadow@xshift@len}{0mm} +\newcommand{\tutodoc@code@shadow@yshift@len}{0mm} +\newcommand{\tutodoc@code@shadow@offset@len}{0mm} + +\colorlet{tutodoc@code@segment@color}{black} + + + +% ====================== % +% == LISTINGS - LATEX == % +% ====================== % + +% ---------------- % +% -- LEXER USED -- % +% ---------------- % + +\newcommand{\tutodoc@latex@lexer}{text} + + +% ----------------- % +% -- INLINE CODE -- % +% ----------------- % + +\newcommand{\tutodoc@latex@style}{default} + +\colorlet{tutodoc@latex@back@color}{white} +\colorlet{tutodoc@latex@text@color}{black} + + +% -------------------------------- % +% -- FRAMED LISTING (tcolorbox) -- % +% -------------------------------- % + +\colorlet{tutodoc@latex@frame@color}{darkgray} + +\newcommand{\tutodoc@latex@left@len}{2pt} +\newcommand{\tutodoc@latex@right@len}{2pt} +\newcommand{\tutodoc@latex@top@len}{0pt} +\newcommand{\tutodoc@latex@bottom@len}{0pt} + +\newcommand{\tutodoc@latex@arc@len}{0pt} + +\newcommand{\tutodoc@latex@left@rule@len}{1pt} +\newcommand{\tutodoc@latex@right@rule@len}{0pt} +\newcommand{\tutodoc@latex@top@rule@len}{0pt} +\newcommand{\tutodoc@latex@bottom@rule@len}{0pt} + +\colorlet{tutodoc@latex@shadow@color}{black} + +\newcommand{\tutodoc@latex@shadow@xshift@len}{0mm} +\newcommand{\tutodoc@latex@shadow@yshift@len}{0mm} +\newcommand{\tutodoc@latex@shadow@offset@len}{0mm} + +\colorlet{tutodoc@latex@segment@color}{black} + + + +% ========================== % +% == TEXT AND PAGE COLORS == % +% ========================== % + +\colorlet{tutodoc@page@color}{white} +\colorlet{tutodoc@text@color}{black} + + +% ================ % +% == LINK COLOR == % +% ================ % + +\definecolor{tutodoc@link@color}{named}{black} + + +% ======================= % +% == VERTICAL SPACINGS == % +% ======================= % + +\setlength{\parskip}{0.5pt plus 1pt} + +\RedeclareSectionCommands[ + runin = false, + afterindent = false, + beforeskip = .25\baselineskip, + afterskip = 5pt +]{section, subsection, subsubsection} + + + +% ============== % +% == SHOWCASE == % +% ============== % + +\NewExpandableDocumentCommand{\tutodoc@showcase@rule@color}{}{% + black% +} + +\NewExpandableDocumentCommand{\tutodoc@showcase@stripe@color}{}{% + black% +} + +\NewExpandableDocumentCommand{\tutodoc@showcase@text@color}{}{% + black% +} + +\NewExpandableDocumentCommand{\tutodoc@showcase@build@rule@color}{m}{% + black% +} + +\NewExpandableDocumentCommand{\tutodoc@showcase@build@back@color}{m}{% + white% +} + + + +% ======================= % +% == VERSION & CHANGES == % +% ======================= % + +% -------------------- % +% -- DATE & VERSION -- % +% -------------------- % + +\NewExpandableDocumentCommand{\tutodoc@changes@when@color}{}{% + black% +} + + +% --------------------------- % +% -- ENVS FOR CHANGES MADE -- % +% --------------------------- % + +%%% +% The draft theme doesn't use any icon. +%%% + +% \newcommand{\tutodoc@changes@start@project@icon}{} + +\ExplSyntaxOn + +\seq_new:N \g__tutodoc_topic_change_seq + +\seq_set_from_clist:Nn \g__tutodoc_topic_change_seq { + break , + fix , + new , + prob , + tech , + update, + todo , +} + +\ExplSyntaxOff diff --git a/Master/texmf-dist/tex/latex/tutodoc/tutodoc-en.loc.cls b/Master/texmf-dist/tex/latex/tutodoc/tutodoc-en.loc.cls new file mode 100644 index 00000000000..5e0a31294f6 --- /dev/null +++ b/Master/texmf-dist/tex/latex/tutodoc/tutodoc-en.loc.cls @@ -0,0 +1,19 @@ +\NewDocumentCommand{\tutodoc@trans@date}{mmm}{#1-#2-#3} +\NewDocumentCommand{\tutodoc@trans@in@EN}{m}{#1 in English} +\NewDocumentCommand{\tutodoc@trans@this@gives}{m}{This gives #1} +\NewDocumentCommand{\tutodoc@trans@latex@show@start}{}{Start of the real output} +\NewDocumentCommand{\tutodoc@trans@latex@show@end}{}{End of the real output} +\NewDocumentCommand{\tutodoc@trans@exa@title}{}{Example} +\NewDocumentCommand{\tutodoc@trans@rem@title}{}{Remark} +\NewDocumentCommand{\tutodoc@trans@note@title}{}{Note} +\NewDocumentCommand{\tutodoc@trans@tip@title}{}{Tip} +\NewDocumentCommand{\tutodoc@trans@imp@title}{}{Important} +\NewDocumentCommand{\tutodoc@trans@caut@title}{}{Caution} +\NewDocumentCommand{\tutodoc@trans@warn@title}{}{Warning} +\NewDocumentCommand{\tutodoc@trans@chges@tech}{}{Technical information} +\NewDocumentCommand{\tutodoc@trans@chges@todo}{}{Todo} +\NewDocumentCommand{\tutodoc@trans@chges@prob}{}{Problem} +\NewDocumentCommand{\tutodoc@trans@chges@break}{}{Break} +\NewDocumentCommand{\tutodoc@trans@chges@fix}{}{Fix} +\NewDocumentCommand{\tutodoc@trans@chges@new}{}{New} +\NewDocumentCommand{\tutodoc@trans@chges@update}{}{Update}
\ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/tutodoc/tutodoc-es.loc.cls b/Master/texmf-dist/tex/latex/tutodoc/tutodoc-es.loc.cls new file mode 100644 index 00000000000..a9f95cce729 --- /dev/null +++ b/Master/texmf-dist/tex/latex/tutodoc/tutodoc-es.loc.cls @@ -0,0 +1,19 @@ +\NewDocumentCommand{\tutodoc@trans@date}{mmm}{#1/#2/#3} +\NewDocumentCommand{\tutodoc@trans@in@EN}{m}{#1 en inglés} +\NewDocumentCommand{\tutodoc@trans@this@gives}{m}{Esto da #1} +\NewDocumentCommand{\tutodoc@trans@latex@show@start}{}{Inicio de la representación real} +\NewDocumentCommand{\tutodoc@trans@latex@show@end}{}{Fin de la representación real} +\NewDocumentCommand{\tutodoc@trans@exa@title}{}{Ejemplo} +\NewDocumentCommand{\tutodoc@trans@rem@title}{}{Observación} +\NewDocumentCommand{\tutodoc@trans@note@title}{}{Nota} +\NewDocumentCommand{\tutodoc@trans@tip@title}{}{Astucia} +\NewDocumentCommand{\tutodoc@trans@imp@title}{}{Importante} +\NewDocumentCommand{\tutodoc@trans@caut@title}{}{Recomendación} +\NewDocumentCommand{\tutodoc@trans@warn@title}{}{Advertencia} +\NewDocumentCommand{\tutodoc@trans@chges@tech}{}{Información técnica} +\NewDocumentCommand{\tutodoc@trans@chges@todo}{}{A hacer} +\NewDocumentCommand{\tutodoc@trans@chges@prob}{}{Problema} +\NewDocumentCommand{\tutodoc@trans@chges@break}{}{Bifurcación} +\NewDocumentCommand{\tutodoc@trans@chges@fix}{}{Reparación} +\NewDocumentCommand{\tutodoc@trans@chges@new}{}{Nuevo} +\NewDocumentCommand{\tutodoc@trans@chges@update}{}{Actualización}
\ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/tutodoc/tutodoc-fr.loc.cls b/Master/texmf-dist/tex/latex/tutodoc/tutodoc-fr.loc.cls new file mode 100644 index 00000000000..4944b096654 --- /dev/null +++ b/Master/texmf-dist/tex/latex/tutodoc/tutodoc-fr.loc.cls @@ -0,0 +1,19 @@ +\NewDocumentCommand{\tutodoc@trans@date}{mmm}{#3/#2/#1} +\NewDocumentCommand{\tutodoc@trans@in@EN}{m}{#1 en anglais} +\NewDocumentCommand{\tutodoc@trans@this@gives}{m}{Ceci donne #1} +\NewDocumentCommand{\tutodoc@trans@latex@show@start}{}{Début du rendu réel} +\NewDocumentCommand{\tutodoc@trans@latex@show@end}{}{Fin du rendu réel} +\NewDocumentCommand{\tutodoc@trans@exa@title}{}{Exemple} +\NewDocumentCommand{\tutodoc@trans@rem@title}{}{Remarque} +\NewDocumentCommand{\tutodoc@trans@note@title}{}{Note} +\NewDocumentCommand{\tutodoc@trans@tip@title}{}{Astuce} +\NewDocumentCommand{\tutodoc@trans@imp@title}{}{Important} +\NewDocumentCommand{\tutodoc@trans@caut@title}{}{Mise en garde} +\NewDocumentCommand{\tutodoc@trans@warn@title}{}{Avertissement} +\NewDocumentCommand{\tutodoc@trans@chges@tech}{}{Information technique} +\NewDocumentCommand{\tutodoc@trans@chges@todo}{}{À faire} +\NewDocumentCommand{\tutodoc@trans@chges@prob}{}{Problème} +\NewDocumentCommand{\tutodoc@trans@chges@break}{}{Bifurcation} +\NewDocumentCommand{\tutodoc@trans@chges@fix}{}{Réparation} +\NewDocumentCommand{\tutodoc@trans@chges@new}{}{Nouveau} +\NewDocumentCommand{\tutodoc@trans@chges@update}{}{Mise à jour}
\ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/tutodoc/tutodoc-locale-main-english.cfg.sty b/Master/texmf-dist/tex/latex/tutodoc/tutodoc-locale-main-english.cfg.sty deleted file mode 100644 index 339f10240c6..00000000000 --- a/Master/texmf-dist/tex/latex/tutodoc/tutodoc-locale-main-english.cfg.sty +++ /dev/null @@ -1,17 +0,0 @@ -\NewDocumentCommand{\tutodoc@trans@date}{mmm}{#1-#2-#3} -\NewDocumentCommand{\tutodoc@trans@in@EN}{m}{#1 ~ in ~ english} -\NewDocumentCommand{\tutodoc@trans@this@gives}{m}{This ~ gives ~ #1} -\NewDocumentCommand{\tutodoc@trans@latex@show@start}{}{Start ~ of ~ the ~ real ~ output} -\NewDocumentCommand{\tutodoc@trans@latex@show@end}{}{End ~ of ~ the ~ real ~ output} -\NewDocumentCommand{\tutodoc@trans@exa@title}{}{Example} -\NewDocumentCommand{\tutodoc@trans@rmk@title}{}{Remark} -\NewDocumentCommand{\tutodoc@trans@note@title}{}{Note} -\NewDocumentCommand{\tutodoc@trans@tip@title}{}{Tip} -\NewDocumentCommand{\tutodoc@trans@important@title}{}{Important} -\NewDocumentCommand{\tutodoc@trans@caution@title}{}{Caution} -\NewDocumentCommand{\tutodoc@trans@warn@title}{}{Warning} -\NewDocumentCommand{\tutodoc@trans@chges@pb}{}{Problem} -\NewDocumentCommand{\tutodoc@trans@chges@break}{}{Break} -\NewDocumentCommand{\tutodoc@trans@chges@fix}{}{Fix} -\NewDocumentCommand{\tutodoc@trans@chges@new}{}{New} -\NewDocumentCommand{\tutodoc@trans@chges@update}{}{Update}
\ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/tutodoc/tutodoc-locale-main-french.cfg.sty b/Master/texmf-dist/tex/latex/tutodoc/tutodoc-locale-main-french.cfg.sty deleted file mode 100644 index 5c97cb2f180..00000000000 --- a/Master/texmf-dist/tex/latex/tutodoc/tutodoc-locale-main-french.cfg.sty +++ /dev/null @@ -1,17 +0,0 @@ -\NewDocumentCommand{\tutodoc@trans@date}{mmm}{#3/#2/#1} -\NewDocumentCommand{\tutodoc@trans@in@EN}{m}{#1 ~ en ~ anglais} -\NewDocumentCommand{\tutodoc@trans@this@gives}{m}{Ceci ~ donne ~ #1} -\NewDocumentCommand{\tutodoc@trans@latex@show@start}{}{Début ~ du ~ rendu ~ réel} -\NewDocumentCommand{\tutodoc@trans@latex@show@end}{}{Fin ~ du ~ rendu ~ réel} -\NewDocumentCommand{\tutodoc@trans@exa@title}{}{Exemple} -\NewDocumentCommand{\tutodoc@trans@rmk@title}{}{Remarque} -\NewDocumentCommand{\tutodoc@trans@note@title}{}{Note} -\NewDocumentCommand{\tutodoc@trans@tip@title}{}{Astuce} -\NewDocumentCommand{\tutodoc@trans@important@title}{}{Important} -\NewDocumentCommand{\tutodoc@trans@caution@title}{}{Mise ~ en ~ garde} -\NewDocumentCommand{\tutodoc@trans@warn@title}{}{Avertissement} -\NewDocumentCommand{\tutodoc@trans@chges@pb}{}{Problème} -\NewDocumentCommand{\tutodoc@trans@chges@break}{}{Bifurcation} -\NewDocumentCommand{\tutodoc@trans@chges@fix}{}{Réparation} -\NewDocumentCommand{\tutodoc@trans@chges@new}{}{Nouveau} -\NewDocumentCommand{\tutodoc@trans@chges@update}{}{Mise ~ à ~ jour}
\ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/tutodoc/tutodoc.cls b/Master/texmf-dist/tex/latex/tutodoc/tutodoc.cls new file mode 100644 index 00000000000..fe1f0b52e42 --- /dev/null +++ b/Master/texmf-dist/tex/latex/tutodoc/tutodoc.cls @@ -0,0 +1,1669 @@ +% ********************************************************* % +% ** This is file `tutodoc.cls' generated automatically. ** % +% ** ** % +% ** Copyright (C) 2023-2024 by Christophe, BAL ** % +% ** ** % +% ** This file may be distributed and/or modified under ** % +% ** the conditions of the GNU 3 License. ** % +% ********************************************************* % + +\ProvidesExplClass + {tutodoc} + {2024-12-18} % Creation: 2023-11-29 + {1.7.1} + {This package proposes tools for writing "human friendly" documentations of LaTeX packages.} + + +% ================== % +% == \CLS OPTIONS == % +% ================== % + +%%% +% refs:: +% + https://tex.stackexchange.com/a/729929/6880 +% + https://tex.stackexchange.com/a/729913/6880 +%%% + +\ExplSyntaxOn + +\msg_set:nnnn { tutodoc ~ (main) } + { main : scrartcl-illegal-option } + { The ~ option ~ << ~ #1 ~ >> ~ is ~ not ~ allowed. } + { \msg_see_documentation_text:n { tutodoc } } + + +%%% +% The theme is identified by the following macro that can be changed +% when the class is loaded. +%%% +\newcommand{\tutodoc@theme}{color} + + +%%% +% prototype:: +% theme : the theme to format the document. +% fontsize : this key is one of those of the '''scrartcl'' class. +% As \tutodoc imposes the value of this key, we must +% forbid its use. +% DIV : similar to the preceding key but here we just want +% to avoid any use of special ''DIV'' value. +%%% +\keys_define:nn { tutodoc / main / class / options } { + theme .choices:nn = { + bw, + color, + dark, + draft + } { + \exp_args:NNV \renewcommand \tutodoc@theme \l_keys_choice_tl + }, + fontsize .code:n = { + \msg_error:nnn { tutodoc ~ (main) } + { main : scrartcl-illegal-option } + { fontsize } + }, + DIV .code:n = { + \msg_error:nnn { tutodoc ~ (main) } + { main : scrartcl-illegal-option } + { DIV } + }, +} + +\PassOptionsToClass{ fontsize = 10pt }{ scrartcl } + +\DeclareUnknownKeyHandler[ tutodoc / main / class / options ]{ + \PassOptionsToClass{ \CurrentOption }{ scrartcl } +} + +\ProcessKeyOptions[ tutodoc / main / class / options ] + +\LoadClass{ scrartcl } + +\ExplSyntaxOff + + +% =============================================== % +% == OPTIONS FOR \PACKS IMPORTED BY OTHER ONES == % +% =============================================== % + +% ''xcolor'' will be loaded by ''minted'' and ''tcolorbox'' below. +\PassOptionsToPackage{svgnames}{xcolor} + + +% ============= % +% == IMPORTS == % +% ============= % + +\RequirePackage{geometry} + +\RequirePackage{marginnote} +\RequirePackage{fontawesome5} +\RequirePackage{keytheorems} + +\RequirePackage{clrstrip} + +% Special settings for ''minted'' need to be done before the loading +% of the ''tcolorbox'' library ''minted''. +\RequirePackage[highlightmode = immediate] + {minted} + +\RequirePackage{tcolorbox} +\tcbuselibrary{ + minted, + breakable, + skins +} + +\RequirePackage{hyperref} + + +%%% +% We delegate the management of quoting to the ''csquotes'' package, +% which takes care of the locale settings. +% +% warning:: +% We must load ''inputenc'' before ''csquotes'' +%%% +\RequirePackage[utf8] + {inputenc} + +\RequirePackage{csquotes} + + +% ===================== % +% == LOCALE SETTINGS == % +% ===================== % + +\ExplSyntaxOn + +\msg_set:nnnn { tutodoc ~ (main) } + { main : unsupported-lang } + { + unsupported ~ language ~ << ~ #1 ~ >>. % + ~ % + We ~ will ~ use ~ << ~ en ~ >>. + } + { \msg_see_documentation_text:n { tutodoc } } + + +% Babel requires colon management for our translations. +\newcommand{\tutodoc@colon}{:} + +\AtBeginDocument{ +%%% +% Settings if ''babel'' \pack is used. +%%% + \@ifpackageloaded{babel}{ +% We must take care of spacings with colons. + \iflanguage{french}{ + \renewcommand{\tutodoc@colon}{\babelshorthand{:}} + }{} + }{} + +%%% +% Settings if ''polyglossia'' \pack is used. +%%% + \@ifpackageloaded{polyglossia}{ +% If ''polyglossia'' is used, we must load english if necessary +% (see the ''\tutodoc@use@english'' macro below). + \iflanguageloaded{english}{}{ + \setotherlanguage{english} + } + }{}% + +% Standard way to find the \lang to use. + \newcommand{\tdoclang}{\BCPdata{language}} + +% We must take care of English rules for English contents. + \newcommand\tutodoc@use@english{% + \foreignlanguage{english}% + } + +% If the \lang is not supported, we emit a warning and just use +% the english language. + \makeatletter + + \InputIfFileExists{tutodoc-\tdoclang.loc.cls}{}{ + \input{tutodoc-en.loc.cls} + + \msg_critical:nnx { tutodoc ~ (main) } + { main : unsupported-lang } + { \tdoclang } + } + + \makeatother +} + +\ExplSyntaxOff + + +% =================== % +% == PAGE GEOMETRY == % +% =================== % + +\geometry{ + top = 1.9cm, + bottom = 1.9cm, + left = 2.25cm, + right = 2.25cm, + marginparwidth = 2cm, + marginparsep = 2pt, + heightrounded +} + +\setlength{\parindent}{0cm} + + +% ================== % +% == TITLES & TOC == % +% ================== % + +\renewcommand{\thesection}{\Roman{section}} +\renewcommand{\thesubsection}{\arabic{subsection}} +\renewcommand{\thesubsubsection}{\alph{subsubsection}} + +% 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 +} + + +% =========================== % +% == COLOR TRANSFORMATIONS == % +% =========================== % + +%%% +% prototype:: +% #1 : (black-rate) +% the amount of color relative to black. +% #2 : (color) +% one color following the ''color'' format. +% +% :return: a "darker" version of the color ''#1''. +%%% +\NewExpandableDocumentCommand{\tdocdarkcolor}{ O{50} m }{#2!#1!black} + + +%%% +% prototype:: +% #1 : (transparency) +% the transparency rate. +% #2 : (color) +% one color following the ''color'' format. +% +% :return: a "transparent" version of the color `#1`. +%%% +\NewExpandableDocumentCommand{\tdoclightcolor}{ O{5} m }{#2!#1} + + +% =========== % +% == ICONS == % +% =========== % + +%%% +% prototype:: +% #1 : (aws-icon) +% one material that expects to be an icon command from the +% ''fontawsome5'' \pack. +% +% :return: the icon followed by a small insecable space. +%%% +\NewDocumentCommand{\tdocicon}{ m }{% + #1\kern.45em% +} + + +% ============== % +% == LISTINGS == % +% ============== % + +%%% +% We use a \std \latex boolean to switch on or off lexers for listings +% (this allows the ''draft'' mode to display listings in verbatim). +%%% +\newif\ifcodenolexer +\codenolexerfalse + + +\ExplSyntaxOn + +%%% +% prototype:: +% #1 : (style-abbrev) +% a shortcut for a \tcolorbox styling command. +% @ #1 in [code, sbs, std] +% +% In the following easy-to-understand macro, we use one fictive \tcolorbox +% style such as to indicate an unknown ''tutodoc'' shortcut style. For example, +% this will give the following message if the user type ''MISTYPED-STYLE''. +% +% term:: +% Package pgfkeys Error: I do not know the key '/tcb/[[tutodoc : tdoclatex +% bad option "MISTYPED-STYLE"]]' and I am going to ignore it. Perhaps you +% misspelled it. +% +% See the pgfkeys package documentation for explanation. +%%% + +\NewExpandableDocumentCommand{\tdoctcb}{ m }{ + \str_case:nnF { #1 } { + { sbs } { listing ~ side ~ text } + { code } { listing ~ only } + { std } { listing ~ and ~ text } + } { + [[tutodoc ~ : ~ LaTeX ~ listing ~ illegal ~ style ~ "#1"]] + } +} + +\ExplSyntaxOff + + +% ============================== % +% == THEME - GENERAL SETTINGS == % +% ============================== % + +\input{tutodoc-\tutodoc@theme.css.cls} + +\pagecolor{tutodoc@page@color} +\color{tutodoc@text@color} + +\hypersetup{ + colorlinks, + citecolor = tutodoc@link@color, + filecolor = tutodoc@link@color, + linkcolor = tutodoc@link@color, + urlcolor = tutodoc@link@color +} + + + +% ============= % +% == QUOTING == % +% ============= % + +%%% +% prototype:: +% #1 : (text) +% a text to quote. +% +% For example, ''\tdocquote{Something}'' prints **"Something"**. +%%% +\NewDocumentCommand{\tdocquote}{ m }{% + \enquote{\emph{#1}}% +} + + +% ============================== % +% == EXPLAINING ENGLISH WORDS == % +% ============================== % + +%%% +% prototype:: +% #1 : (EN-text) +% an english text that will be explained in another \lang. +% +% :extra: this macro has a star version. +% +% For example, if the language chosen is ''french'', we have +% the following outputs. +% +% 1) ''\tdocinEN{Something}'' prints +% **"Something" en anglais**. +% +% 2) ''\tdocinEN*{Something}'' just prints +% **"Something"**. +% +% 3) ''\tdocinEN*{Something} et \tdocinEN{Another thing}'' +% gives +% **"Something" et "Another thing" en anglais**. +%%% +\NewDocumentCommand{\tdocinEN}{ s m }{% + \IfBooleanTF{#1}{}{\tutodoc@trans@in@EN}% +% We must activate the English typesetting rules. + {% + \tdocquote{\tutodoc@use@english{#2}}% + }% +} + + + +% =========================== % +% == HIGHLIGHTING CONTENTS == % +% =========================== % + +% ---------------------- % +% -- EXAMPLE & REMARK -- % +% ---------------------- % + +\ExplSyntaxOn + +%%% +% We use a ''seq'' variable to factorize the code just after. +%%% +\seq_new:N \g__tutodoc_focus_std_seq +\seq_set_from_clist:Nn \g__tutodoc_focus_std_seq { + exa, + rem +} + + +%%% +% Themes define specific vertical spacings. +%%% +\newkeytheoremstyle{tutodoc@admonition@exa@style}{ + spaceabove = \tutodoc@admonition@space@below, + spacebelow = \tutodoc@admonition@space@below +} + +%%% +% prototype:: +% :action: looping over ''\g__tutodoc_focus_std_seq'' to build new +% numbered theorems sharing the same section level counter. +% To achieve that, we use the ''\newkeytheorem'' macro from +% the ''keytheorems'' \pack. +%%% +\seq_map_inline:Nn \g__tutodoc_focus_std_seq { + \str_if_eq:nnTF { #1 } { exa } { + \newkeytheorem{tdoc#1}[ + name = \use:c { tutodoc@trans@#1@title }, + within = section, + style = tutodoc@admonition@exa@style + ] + } { + \newkeytheorem{tdoc#1}[ + name = \use:c { tutodoc@trans@#1@title }, + numberlike = tdocexa, + style = tutodoc@admonition@exa@style + ] + } + + \cs_set:cpn { the tdoc #1 } { \thesection.\arabic{tdoc#1} } +} + +\ExplSyntaxOff + + +% ----------------- % +% -- ADMONITIONS -- % +% ----------------- % + +%%% +% note:: +% We provide two ways to define admonitions. +% +% 1) ''\g__tutodoc_focus_color_prop'' and ''g__tutodoc_focus_icon_prop'' +% are for iconised and colored frames. +% +% 1) ''\g__tutodoc_focus_color_seq'' is to use a dedicated basic theorem +% (this should be only useful for the draft theme). +% +% +% warning:: +% The variables should be defined inside the themes! +% +% +% refs:: +% + https://tex.stackexchange.com/a/727022/6880 +% + https://tex.stackexchange.com/a/682332/6880 +% + https://tex.stackexchange.com/a/623232/6880 +%%% +\ifcsundef{g__tutodoc_focus_color_seq}{ + \tcbset{ + tutodoc-focus-color-style/.style = { +% General. + use color stack, % Must be before breakable! + breakable, + enhanced, +% Colors. + coltitle = \tutodoc@build@title@color{#1}, + colupper = \tutodoc@build@upper@color{#1}, + colback = \tutodoc@build@back@color{#1}, + colframe = \tutodoc@build@frame@color{#1}, +% We want to use the same color for the footnotes in the frame. + before upper = {\let\default@color\current@color}, +% Padding. + left = 3pt, + right = 3pt, + arc = 2pt, +% Frame. + shadow = {.75mm}{-.75mm}{0mm}{tutodoc@admonition@shadow@color}, + } + } +}{} + +\ExplSyntaxOn + +\ifcsundef{g__tutodoc_focus_color_seq}{ +%%% +% prototype:: +% :action: ''key/value'' iteration over ''\g__tutodoc_focus_color_prop'' +% to build new colorful unumbered theorems. To achieve that, +% we use a \tcolorbox style given to the ''\newkeytheorem'' +% macro from the ''keytheorems'' \pack, and icons from the +% ''fontawesome5'' \pack. +%%% + \prop_map_inline:Nn \g__tutodoc_focus_color_prop { + \newkeytheorem{tdoc#1}[ + numbered = false, +% tcolorbox-no-titlebar can be used. + tcolorbox = {tutodoc-focus-color-style=#2}, + name = { + \tdocicon{ \prop_item:Nn \g__tutodoc_focus_icon_prop { #1 } } + \use:c { tutodoc@trans@#1@title } + } + ] + } +} { +%%% +% prototype:: +% :action: looping over ''\g__tutodoc_focus_color_seq'' to build new +% numbered theorems sharing the same section level counter. +% To achieve that, we use the ''\newkeytheorem'' macro from +% the ''keytheorems'' \pack. +%%% + \seq_map_inline:Nn \g__tutodoc_focus_color_seq { + \newkeytheorem{tdoc#1}[ + name = \use:c { tutodoc@trans@#1@title }, + numberlike = tdocexa,, + style = tutodoc@admonition@exa@style, +% Some hooks... + preheadhook = \small, + postheadhook = \leavevmode, + postfoothook = \normalsize + ] + } +} + +\ExplSyntaxOff + + + +% ========================================= % +% == \PACKS, \CLSS, MACROS & \ENVS NAMES == % +% ========================================= % + +%%% +% prototype:: +% #1 : (cls-name) +% the name of a class +% +% :action: ''\tdoccls{myclass}'' prints verb::''myclass''. +%%% +\NewDocumentCommand{\tdoccls}{ m }{% + \texttt{#1}% +} + + +%%% +% prototype:: +% #1 : (pck-name) +% the name of a package +% +% :action:''\tdocpack{mypack}'' prints verb::''mypack''. +%%% +\NewDocumentCommand{\tdocpack}{ m }{% + \texttt{#1}% +} + + +%%% +% prototype:: +% #1 : (cmd-name) +% the name of a macro +% +% :action: ''\tdocmacro{mymacro}'' prints verb::''\mymacro''. +%%% +\NewDocumentCommand{\tdocmacro}{ m }{% + \texttt{\textbackslash{}#1}% +} + + +%%% +% prototype:: +% #1 : (env-name) +% the name of an environment +% +% :extra: this macro has a star version. +% +% Here are the different outputs available. +% +% 1) ''\tdocenv{myenv}'' prints +% verb::''\begin{myenv} ... \end{myenv}''. +% +% 2) ''\tdocenv*{myenv}'' prints +% verb::''myenv''. +%%% +\NewDocumentCommand{\tdocenv}{ s m }{% + \IfBooleanTF{#1}{% + \texttt{#2}% + }{% +% Source: https://tex.stackexchange.com/a/703379/6880 . + \texttt{\string\begin\string{#2\string} % + \!\!...\@\!\!\! % + \string\end\string{#2\string}}% + }% +} + + +% ========================= % +% == EXPLAINING PREFIXES == % +% ========================= % + +\ExplSyntaxOn + +\msg_set:nnnn { tutodoc ~ (macroenv) } + { macroenv : prefix-why-bad-format } + { Bad ~ format, ~ something ~ like ~ ''pre.fix'' ~ expected. } + { You ~ must ~ use ~ one ~ single ~ point. } + + +% -------------------- % +% -- PREFIX FROM... -- % +% -------------------- % + +\seq_new:N \l__tutodoc_prewhy_parts_seq +\int_new:N \l__tutodoc_prewhy_nbparts_int +\tl_new:N \l__tutodoc_pretext_tl +\tl_new:N \l__tutodoc_posttext_tl + + +%%% +% prototype:: +% #1 : (pre.fix) +% a prefix and a suffix separated by one colon. +% +% :action: ''\tdocprewhy{pre.fix}'' prints verb::''pre''.fix. +%%% +\NewDocumentCommand{\tdocprewhy}{ m }{% +% Do we have 2 parts? + \seq_set_split:Nnn \l__tutodoc_prewhy_parts_seq { . } { #1 } + + \int_set:Nn \l__tutodoc_prewhy_nbparts_int + {\int_eval:n {\seq_count:N \l__tutodoc_prewhy_parts_seq}} + + \if_int_compare:w \l__tutodoc_prewhy_nbparts_int = 2 + \else: + \msg_error:nn { tutodoc ~ (macroenv) } + { macroenv : prefix-why-bad-format } + \fi: + +% Let's go. + \seq_pop:NN \l__tutodoc_prewhy_parts_seq \l__tutodoc_pretext_tl + \seq_pop:NN \l__tutodoc_prewhy_parts_seq \l__tutodoc_posttext_tl + + \textbf{ + \tdocpre{\tl_use:N \l__tutodoc_pretext_tl} + \kern.5pt + \textperiodcentered + \kern.5pt + {\tl_use:N \l__tutodoc_posttext_tl} + } +} + +\ExplSyntaxOff + + +% --------------------- % +% -- JUST ONE PREFIX -- % +% --------------------- % + +%%% +% prototype:: +% #1 : (pre) +% just a prefix +% +% :action: ''\tdocpre{pre}'' only prints verb::''pre''. +% This can be useful in a case like +% ''\tdocpre{pre} comes from \tdocprewhy{pre}{fix}'' +% which prints: +% verb::''pre'' comes from verb::''pre''-fix. +%%% +\NewDocumentCommand{\tdocpre}{ m }{% + \texttt{#1}% +} + + + +% ======================== % +% == TEXT BETWEEN RULES == % +% ======================== % + +\ExplSyntaxOn + +\box_new:N \l__tutodoc_content_box +\dim_new:N \l__tutodoc_content_dim + + +%%% +% prototype:: +% #1 : (color) +% the color for the rule and the text +% #2 : (text) +% the text surrounded by two horizontal rules +% +% :action: this macro adds two horizontal lines on either side of the text. +% The final output is centered. +% +% note:: +% The code used comes from +% cf::''this post ; +% https://tex.stackexchange.com/a/604708/6880''. +%%% +\NewDocumentCommand{\tdocruler}{ + O{\tutodoc@showcase@rule@color} + m +}{ + \par + { + \centering + \scriptsize + \itshape + \bfseries + \color{#1} + + \hbox_set:Nn \l__tutodoc_content_box { \,\, #2 \,\, } + \dim_set:Nn \l__tutodoc_content_dim { + .35 \linewidth - .5 \box_wd:N \l__tutodoc_content_box + } + + \rule[.75pt] { \dim_use:N \l__tutodoc_content_dim } + { 2.5pt } + \box_use:N \l__tutodoc_content_box + \rule[.75pt] { \dim_use:N \l__tutodoc_content_dim } + { 2.5pt } + \par + } +} + +\ExplSyntaxOff + + +% ============== % +% == SHOWCASE == % +% ============== % + +% --------------------------- % +% -- INTERNAL ENVIRONMENTS -- % +% --------------------------- % + +%%% +% prototype:: +% #1 : (up-text) +% the descriptive text before the real output +% #2 : (down-text) +% the descriptive text after the real output +% #3 : (color) +% one color used to set the one for the decorated texts printed +% corresponding to the two first arguments. +% #4 : (rule color builder) +% the macro used to build the color from the user's rule color +% +% :action: this environment just adds its content processed by \latex +% between centered materials produced by the macro ''\tdocruler'' +% such as to stress the start and the end of the content. +%%% +\NewDocumentEnvironment{tutodoc@showcase@rules}{ m m m m }{% + \tdocruler[#4{#3}]{#1}% + \nopagebreak\medskip\nopagebreak% +}{% + \nopagebreak\medskip\nopagebreak% + \tdocruler[#4{#3}]{#2}% +} + + +%%% +% prototype:: +% #1 .. #4 : :see: env.tutodoc@showcase@rules +% #5 : (back color builder) +% the macro used to build the color from the user's back color +% +% :action: this environment adds a page-width colored stripe in the +% background of the environment content processed by \latex. +% This stripe is preceded and followed by centered materials +% produced by the macro ''\tdocruler'' such as to stress the +% start and the end of the content. +%%% +\NewDocumentEnvironment{tutodoc@showcase@colorstrip}{ m m m m m }{ + \begin{colorstrip}{#5{#3}}% + \begin{tutodoc@showcase@rules}{#1}{#2}{#3}{#4}% +}{% + \end{tutodoc@showcase@rules}% + \end{colorstrip} +} + + +\ExplSyntaxOn + +% ----------------------- % +% -- SETTING SOME KEYS -- % +% ----------------------- % + +\tl_new:N \g_tutodoc_showcase_style_tl +\tl_new:N \l_tutodoc_showcase_before_tl +\tl_new:N \l_tutodoc_showcase_after_tl +\tl_new:N \l_tutodoc_showcase_stripe_color_tl +\tl_new:N \l_tutodoc_showcase_text_color_tl + + +%%% +% prototype:: +% col-stripe : the color of the stripe +% col-text : the color of the descriptive texts +% nostripe : a boolean flag to avoid the use of a stripe +% before : the descriptive text before the real output +% after : the descriptive text after the real output +%%% +\keys_define:nn { tutodoc / showcase } { +% Style? + style .choices:nn = { + minimal, + rule, + stripe + } { + \tl_gset:Nx \g_tutodoc_showcase_style_tl {#1} + }, +% Colors. + col-stripe .tl_set:N = \l_tutodoc_showcase_stripe_color_tl, + col-stripe .initial:n = \tutodoc@showcase@stripe@color, + col-text .tl_set:N = \l_tutodoc_showcase_text_color_tl, + col-text .initial:n = \tutodoc@showcase@text@color, +% Texts. + before .tl_set:N = \l_tutodoc_showcase_before_tl, + before .initial:n = \tutodoc@trans@latex@show@start, + after .tl_set:N = \l_tutodoc_showcase_after_tl, + after .initial:n = \tutodoc@trans@latex@show@end, +} + + +% ------------------------------ % +% -- SHOWCASE FROM TYPED CODE -- % +% ------------------------------ % + +% prototype:: +% #1 : (key-val options) +% :see: l3keys(tutodoc / showcase) +% +% :action: this \env formats \latex code, given as an argument, +% by framing it with texts decorated by ''\tdocruler'', +% in order to clearly identify a rendering used as an +% example. +% It is also possible to have a coloured strip of the width +% of the page in the background of the content. +% +% :see: env.tutodoc@showcase@rules , +% env.tutodoc@showcase@colorstrip +%%% +\NewDocumentEnvironment{tdocshowcase}{ O{} }{ + \group_begin: + \tl_gset:Nn \g_tutodoc_showcase_style_tl {minimal} + \keys_set:nn { tutodoc / showcase } { #1 } + + \str_case:Nn { \g_tutodoc_showcase_style_tl } { + { minimal } { + \smallskip\par + } + { rule } { + \smallskip + \begin{tutodoc@showcase@rules} + { \tl_use:N \l_tutodoc_showcase_before_tl } + { \tl_use:N \l_tutodoc_showcase_after_tl } + { \tl_use:N \l_tutodoc_showcase_stripe_color_tl } + { \tutodoc@showcase@build@rule@color } + } + { stripe } { + \begin{tutodoc@showcase@colorstrip} + { \tl_use:N \l_tutodoc_showcase_before_tl } + { \tl_use:N \l_tutodoc_showcase_after_tl } + { \tl_use:N \l_tutodoc_showcase_stripe_color_tl } + { \tutodoc@showcase@build@rule@color } + { \tutodoc@showcase@build@back@color } + } + } + + \color{ \tl_use:N \l_tutodoc_showcase_text_color_tl } +}{ + \str_case:Nn { \g_tutodoc_showcase_style_tl } { + { rule } { + \end{tutodoc@showcase@rules} + } + { stripe } { + \end{tutodoc@showcase@colorstrip} + } + } + \group_end: +} + + +% ------------------------ % +% -- SHOWCASE FROM FILE -- % +% ------------------------ % + +\tl_new:N \l__tutodoc_showcase_options_tl + + +%%% +% prototype:: +% #1 : (key-val options) +% :see: env.tdocshowcase +% #2 : (file path) +% the path of a file +%%% +\NewDocumentCommand{\tdocshowcaseinput}{ O{} m }{ + \begin{tdocshowcase}[#1] + \input{#2} + \end{tdocshowcase} +} + +\ExplSyntaxOff + + + +% ==================== % +% == LATEX EXAMPLES == % +% ==================== % + +% ----------------------------- % +% -- INLINE LATEX CODE MACRO -- % +% ----------------------------- % + +%%% +% See the \doc of the macro ''\newmintinline'' from the package \minted +% to have \infos about the macro ''tdoclatexin''. +%%% +\newmintinline[tdoclatexin]{\tutodoc@latex@lexer}{ + bgcolor = tutodoc@latex@back@color, + style/.expand once = \tutodoc@latex@style +} + + +% ------------------------------------------------ % +% -- MINTED/TCOLORBOX LATEX LISTING ENVIRONMENT -- % +% ------------------------------------------------ % + +%%% +% prototype:: +% #1 : (minted-like-options) +% a list of legal \minted options. +% #2 : (tcolorbox-styling-commands) +% you can override the default \tcolorbox settings with the help +% of the macro ''\tdoctcb''. +% +% :see: macro.tdoctcb +% +% refs:: +% + https://tex.stackexchange.com/a/604821/6880 +% + https://tex.stackexchange.com/a/327983/6880 +%%% +\tcbset{ + tutodoc-latex-listing-style/.style 2 args = { +% General. + minted language/.expand once = \tutodoc@latex@lexer, + minted style/.expand once = \tutodoc@latex@style, + breakable, + enhanced, +% Colors. + colframe = tutodoc@latex@frame@color, + colback = tutodoc@latex@back@color, + colupper = tutodoc@latex@text@color, + collower = tutodoc@latex@text@color, +% Padding. + boxsep = 0pt, + left = \tutodoc@latex@left@len, + right = \tutodoc@latex@right@len, + bottom = \tutodoc@latex@bottom@len, + top = \tutodoc@latex@top@len, +% Frame. + shadow = {\tutodoc@latex@shadow@xshift@len}% + {\tutodoc@latex@shadow@yshift@len}% + {\tutodoc@latex@shadow@offset@len}% + {tutodoc@latex@shadow@color}, + arc = \tutodoc@latex@arc@len, + leftrule = \tutodoc@latex@left@rule@len, + rightrule = \tutodoc@latex@right@rule@len, + bottomrule = \tutodoc@latex@bottom@rule@len, + toprule = \tutodoc@latex@top@rule@len, +% Separating line. + segmentation style = { + tutodoc@latex@segment@color, + dash pattern = {on 5pt off 2.5pt}, + line width = .75pt + }, +% Extra minted otpions. + minted options = {#1}, +% Extra tcolorbox styles. + #2 + }, +} + + +%%% +% prototype:: +% #1 : (minted-like-options) +% :see: tcbset(tutodoc-latex-listing-style) +% #2 : (tcolorbox-styling-commands) +% :see: tcbset(tutodoc-latex-listing-style) +% +% note:: +% See the \doc of the macro ''\newtcblisting'' from the package +% \tcolorbox to have \infos about the environment ''tdoclatex''. +%%% +\NewTCBListing{tdoclatex}{ O{} D<>{} }{% + tutodoc-latex-listing-style = {#1}{#2} +} + + +% -------------------------------------- % +% -- TCOLORBOX IMPORTED LISTING MACRO -- % +% -------------------------------------- % + +%%% +% prototype:: +% #1 : (minted-like-options) +% :see: tcbset(tutodoc-latex-listing-style) +% #2 : (tcolorbox-styling-commands) +% :see: tcbset(tutodoc-latex-listing-style) +% #3 : (file path) +% the path of the file to input and format. +% +% note:: +% See the \doc of the macro ''\newtcbinputlisting'' from the package +% \tcolorbox to have more \infos about the macro ''\tdoclatexinput''. +%%% +\NewTCBInputListing{\tdoclatexinput}{ O{} D<>{} m }{ + listing file = {#3}, + tutodoc-latex-listing-style = {#1}{#2} +} + + +% ===================== % +% == LATEX USE CASES == % +% ===================== % + +\ExplSyntaxOn + +% --------------------- % +% -- SETTING THE KEY -- % +% --------------------- % + +\tl_new:N \l_tutodoc_listing_explain_tl + + +%%% +% prototype:: +% explain : the text between the code and its highlighted output. +% +% note:: +% This key can be used in addition to those of the ''tdocshowcase'' +% \env, +%%% +\keys_define:nn { tutodoc / listing / latexshow } { + explain .tl_set:N = \l_tutodoc_listing_explain_tl, + explain .initial:n = { \tutodoc@trans@this@gives \tutodoc@colon }, +} + + +% --------------------- % +% -- LATEXSHOW MACRO -- % +% --------------------- % + +\tl_new:N \l__tutodoc_showcase_options_passed_tl + + +%%% +% prototype:: +% #1 : (key-val options) +% :see: l3keys(tutodoc / listing / latexshow) , +% l3keys(tutodoc / showcase) +% #2 : (file path) +% the path of a file +% +% :see: env.tdocshowcase , +% macro.tdoclatexinput +%%% +\NewDocumentCommand{\tdoclatexshow}{ O{} m} { + \group_begin: + \keys_set_known:nnN { tutodoc / listing / latexshow } + { #1 } + \l__tutodoc_showcase_options_passed_tl + + \tdoclatexinput<\tdoctcb{code}>{#2} + + \tl_use:N \l_tutodoc_listing_explain_tl + +% Source: https://tex.stackexchange.com/a/696700/6880 + \exp_last_unbraced:NNV \tdocshowcaseinput [\l__tutodoc_showcase_options_passed_tl] {#2} + \group_end: +} + +\ExplSyntaxOff + + + +% ========================= % +% == LISTINGS - AGNOSTIC == % +% ========================= % + +% ---------------------------------- % +% -- DOES THE THEME AVOID LEXERS? -- % +% ---------------------------------- % + +\NewExpandableDocumentCommand{\tutodoc@code@lexer}{ m }{% + \ifcodenolexer text\else #1\fi% +} + + +% ---------------------------------- % +% -- INLINE GENERALIST CODE MACRO -- % +% ---------------------------------- % + +%%% +% prototype:: +% #1 : (minted-like-options) +% a list of legal \minted options. +% #2 : (coding-lang) +% the name of the \minted lexer corresponding to the coding langage +% for the formating. +% +% warning:: +% There are only two arguments, because the \mintinline macro will eat +% the bit of inline code to be colored. +%%% +\NewDocumentCommand{\tdoccodein}{ O{} m }{% + \mintinline[ + bgcolor = tutodoc@code@back@color, + style/.expand once = \tutodoc@code@style, + #1 + ]{\tutodoc@code@lexer{#2}}% +} + + +% ----------------------------------------------------- % +% -- MINTED/TCOLORBOX GENERALIST LISTING ENVIRONMENT -- % +% ----------------------------------------------------- % + +%%% +% prototype:: +% #1 : (minted-like-options) +% :see: macro.tdoccodein +% #2 : (tcolorbox-styling-commands) +% you can override the default \tcolorbox settings with the help +% of the macro ''\tdoctcb''. +% #3 : (coding-lang) +% :see: macro.tdoccodein +% +% :see: macro.tdoctcb +% +% refs:: +% + https://tex.stackexchange.com/a/604821/6880 +% + https://tex.stackexchange.com/a/327983/6880 +%%% +\tcbset{ + tutodoc-full-listing-style/.style n args = {3}{ +% General. + minted style/.expand once = \tutodoc@code@style, + minted language/.expand once = \tutodoc@code@lexer{#3}, + breakable, + enhanced, +% Colors. + colframe = tutodoc@code@frame@color, + colback = tutodoc@code@back@color, + colupper = tutodoc@code@text@color, + collower = tutodoc@code@text@color, +% Padding. + boxsep = 0pt, + left = \tutodoc@code@left@len, + right = \tutodoc@code@right@len, + bottom = \tutodoc@code@bottom@len, + top = \tutodoc@code@top@len, +% Frame. + shadow = {\tutodoc@code@shadow@xshift@len}% + {\tutodoc@code@shadow@yshift@len}% + {\tutodoc@code@shadow@offset@len}% + {tutodoc@code@shadow@color}, + arc = \tutodoc@code@arc@len, + leftrule = \tutodoc@code@left@rule@len, + rightrule = \tutodoc@code@right@rule@len, + bottomrule = \tutodoc@code@bottom@rule@len, + toprule = \tutodoc@code@top@rule@len, +% Separating line. + segmentation style = { + tutodoc@code@segment@color, + dash pattern = {on 5pt off 2.5pt}, + line width = .75pt + }, + listing only, +% Extra minted otpions. + minted options = {#1}, +% Extra tcolorbox styles. + #2 + }, +} + + +%%% +% prototype:: +% #1 : (minted-like-options) +% :see: macro.tdoccodein +% #2 : (tcolorbox-styling-commands) +% :see: \tcbset{tutodoc-full-listing-style} +% #3 : (coding-lang) +% :see: macro.tdoccodein +% +% note:: +% See the \doc of the macro ''\NewTCBListing'' from the package +% \tcolorbox to have \infos about the environment ''tdoccode''. +%%% +\NewTCBListing{tdoccode}{ O{} D<>{} m }{% + tutodoc-full-listing-style = {#1}{#2}{#3} +} + + +% -------------------------------------- % +% -- TCOLORBOX IMPORTED LISTING MACRO -- % +% -------------------------------------- % + +%%% +% prototype:: +% #1 : (minted-like-options) +% :see: macro.tdoccodein +% #2 : (tcolorbox-styling-commands) +% :see: \tcbset{tutodoc-full-listing-style} +% #3 : (coding-lang) +% :see: macro.tdoccodein +% #4 : (file path) +% the path of the file to input and format. +% +% note:: +% See the \doc of the macro ''\NewTCBInputListing'' from the package +% \tcolorbox to have more \infos about the macro ''\tdoccodeinput''. +%%% +\NewTCBInputListing{\tdoccodeinput}{ O{} D<>{} m m }{ + listing file = {#4}, + tutodoc-full-listing-style = {#1}{#2}{#3} +} + + + +% == CHANGES - WHEN? --% + +\ExplSyntaxOn + +\msg_set:nnnn { tutodoc ~ (version-n-change) } + { version-n-change : date-bad-format } + { Bad ~ format ~ for ~ a ~ date. } + { Use ~ YYYY-MM-DD. } + + +% ----------------- % +% -- MARGIN NOTE -- % +% ----------------- % + +\reversemarginpar{} + +%%% +% prototype:: +% #1 : (color) +% the color of the margin note +% #2 : (up-text) +% the first material (a version number or nothing) +% #3 : (down-text) +% the second material (a date or nothing) +% #4 : (spacing) +% the last negative vertical spacing for the 2nd rule +% #5 : (vertical offset) +% algebraic distance to move vertically the material +% +% :action: this macro factorizes the printing of the changes +% in the left margin. +% +% :see: \__tutodoc_translate_date:n +%%% +\NewDocumentCommand{\tutodoc@new@change@margin}{ m m m m m }{ + \marginnote{ + \color{#1} + \scriptsize + \normalfont + \centering + + \vspace{0pt} + \rule{1.65cm}{.95pt} + \vspace{-2.9pt} + + \IfBlankTF{#2}{}{ + \par + #2\vphantom{Mp} + \par + } + + \IfBlankTF{#3}{}{ + \IfBlankTF{#2}{}{ + \vspace{1pt} + } + + \par + \__tutodoc_translate_date:n { #3 } + \vphantom{Mp} + \par + } + + \vspace{#4} + \rule{1.65cm}{.95pt} + }[#5] +} + + +%%% +% prototype:: +% #1 : (EN-num-date) +% a content that should have the numerical English date +% format ''YYYY-MM-DD''. +% +% :action: this function checks if we have something like +% ''YYYY-MM-DD'', and then it calls the function +% ''\__tutodoc_translate_date_process:w'' to +% activate the transformation to the locale format. +% +% :see: \__tutodoc_translate_date_process:w +%%% +\cs_new:Nn \__tutodoc_translate_date:n { + \regex_match:nnTF { \A \d{1,4} \- \d{2} \- \d{2} \Z } { #1 }{ + \__tutodoc_translate_date_process:w #1 \q_stop + }{ + \msg_error:nn { tutodoc ~ (version-n-change) } + { version-n-change : date-bad-format } + } +} + + +%%% +% prototype:: +% #1 : (year-extracted) +% a 1 to 4 digits integer +% #2 : (month-extracted) +% a 2 digits integer +% #3 : (day-extracted) +% a 2 digits integer +% +% :action: this function extracts year, month and day in something +% like ''YYYY-MM-DD'' and then it calls ''\tutodoc@trans@date'' +% to use the format expected for a "localised" date. +%%% +\cs_new:Npn \__tutodoc_translate_date_process:w #1 - #2 - #3 \q_stop { + \tutodoc@trans@date{#1}{#2}{#3} +} + +\ExplSyntaxOff + + +% ---------------------- % +% -- VERSION AND DATE -- % +% ---------------------- % + +\newlength{\tutodoc@version@date@vertical@sep@len} +\setlength{\tutodoc@version@date@vertical@sep@len}{-4.25pt} + +\newlength{\tutodoc@version@date@vertical@offset@len} +\setlength{\tutodoc@version@date@vertical@offset@len}{-8pt} + + +%%% +% prototype:: +% #1 : (color) +% the color of the margin note +% #2 : (version) +% a version number +% #3 : (date) +% a date ''YYYY-MM-DD'' +% #4 : (vertical offset) +% algebraic distance to move vertically the material +% +% :action: this macro prints a margin note showing a version number +% below a date, and the optional argument is used to colorize +% all this text. +% +% warning:: +% The date must use an english formatting like ''2021-07-14''. This allows +% to parse the date such as to display it following the standard convention +% of the language chosen when loading the package. +%%% +\NewDocumentCommand{\tdocversion}{ % + O{\tutodoc@changes@when@color} % + m % + O{} % + D<>{\tutodoc@version@date@vertical@offset@len}% +}{ + \tutodoc@new@change@margin% + {#1} % Color + {#2} % Version + {#3} % Date + {\tutodoc@version@date@vertical@sep@len} % Last negative vertical spacing + {#4} % Vertical offset +} + + +% ---------- % +% -- DATE -- % +% ---------- % + +%%% +% prototype:: +% #1 : (color) +% the color of the margin note +% #2 : (date) +% a date ''YYYY-MM-DD'' +% #3 : (vertical offset) +% algebraic distance to move vertically the material +% +% :action: this macro is similar to ''\tdocversion'' except that it just +% prints a date. +%%% +\NewDocumentCommand{\tdocdate}{ + O{\tutodoc@changes@when@color} + m + D<>{\tutodoc@version@date@vertical@offset@len} +}{ + \tutodoc@new@change@margin% + {#1} % Color + {} % Version + {#2} % Date + {\tutodoc@version@date@vertical@sep@len} % Last negative spacing + {#3} % Vertical offset +} + + +% ===================== % +% == CHANGES - WHAT? == % +% ===================== % + +\ExplSyntaxOn + +\msg_set:nnnn { tutodoc ~ (version-n-change) } + { version-n-change : topic-missing-title } + { Missing ~ title. } + { One ~ single ~ title ~ must ~ be ~ indicated. } + + +% ------------------- % +% -- GENERIC TOPIC -- % +% ------------------- % + +\tl_new:N \l_tutodoc_topic_what_color_tl +\tl_new:N \l_tutodoc_topic_when_color_tl +\tl_new:N \l_tutodoc_topic_date_tl +\tl_new:N \l_tutodoc_topic_version_tl + + +%%% +% prototype:: +% col : the color of the full content of a topic \env +% col-chges : the color of the material for changes for a topic \env +% date : the date of the changes a topic \env +% version : the number version of the changes a topic \env +%%% +\keys_define:nn { tutodoc / version-n-change / topic / options } { +% Colors. + col .tl_set:N = \l_tutodoc_topic_what_color_tl, + col .initial:n = tutodoc@text@color, + col-chges .tl_set:N = \l_tutodoc_topic_when_color_tl, + col-chges .initial:n = \tutodoc@changes@when@color, +% Date. + date .tl_set:N = \l_tutodoc_topic_date_tl, + date .initial:n = \c_empty_tl, +% Version. + version .tl_set:N = \l_tutodoc_topic_version_tl, + version .initial:n = \c_empty_tl, +} + +\tl_new:N \l__tutodoc_topic_all_user_options_tl + + +%%% +% For themes using icons, we need a specific paragraph with less vertical +% space consuming. +%%% +\ifcsundef{g__tutodoc_topic_change_seq}{ + \newcommand{\tutodoc@what@change@paragraph}{% + \@startsection{paragraph} % + {4} % Level 4 (after section and co) + {\z@} % No indentation before the title + {1.25ex \@plus 1ex \@minus .2ex} % Vertical space before: + % 2ex with flexibility (+1ex / -0.2ex) + {-1em} % Negative spacing after + % ==> Title slightly aligned to the left. + {\normalfont\normalsize % Title style + \bfseries\sffamily} % + } +}{} + + +%%% +% prototype:: +% #1 : (title) +% a title that will be followed by a colon. +% #2 : (aws-icon) +% one material that expects to be an icon command from the +% ''fontawsome5'' \pack +% #3 : (key-val options) +% :see: l3keys(tutodoc / version-n-change / topic / options) +% +% :action: this environment prints some \infos about specific changes +% achieved in a new version (no special formatting is applied). +% Key-val options allow to add a date \andor a \nbver with +% a specific color if needed. +%%% +\NewDocumentEnvironment{tdoctopic}{ m D<>{} O{} }{ + \IfBlankT{#1}{ + \msg_fatal:nn { tutodoc ~ (version-n-change) } + { version-n-change : topic-missing-title } + } + + \keys_set:nn { tutodoc / version-n-change / topic / options } { #3 } + + \tl_clear:N \l__tutodoc_topic_all_user_options_tl + \tl_set_eq:NN \l__tutodoc_topic_all_user_options_tl \l_tutodoc_topic_version_tl + \tl_put_right:Nn \l__tutodoc_topic_all_user_options_tl { \l_tutodoc_topic_date_tl } + + \group_begin: + \color{\tl_use:N \l_tutodoc_topic_what_color_tl} + + \ifcsundef{g__tutodoc_topic_change_seq}{{} +% Icon used by the theme. + \tutodoc@what@change@paragraph{ + \color{\tl_use:N \l_tutodoc_topic_what_color_tl} + \IfBlankF{#2}{\tdocicon{#2}} + \textsc{#1.} + } + }{ +% No icon used by the theme. + \smallskip + { + \normalfont\normalsize\bfseries\sffamily + \textsc{#1.} + } + } + +% A date and/or a version. + \exp_args:Ne \IfBlankF{\l__tutodoc_topic_all_user_options_tl}{ + \exp_args:NNee \tutodoc@new@change@margin + {\l_tutodoc_topic_when_color_tl} + {\l_tutodoc_topic_version_tl} + {\l_tutodoc_topic_date_tl} + {\tutodoc@version@date@vertical@sep@len} + {\tutodoc@version@date@vertical@offset@len} + } + + \begin{itemize} +}{ + \end{itemize} + \group_end: +} + + +% ---------------------- % +% -- CLASSICAL TOPICS -- % +% ---------------------- % + +%%% +% prototype:: +% :see: env.tdoctopic +% +% :action: ''key/value'' iteration over ''\g__tutodoc_topic_change_prop'' +% to build topic-like \envs using the \env ''tdoctopic'' +% (the title respects the locale settings). +%%% +\ifcsundef{g__tutodoc_topic_change_seq}{ + \prop_map_inline:Nn \g__tutodoc_topic_change_prop { + \NewDocumentEnvironment{ tdoc#1 } { O{} } { + \begin{tdoctopic}{ \use:c { tutodoc@trans@chges@#1 } } < #2 > [##1] + }{ + \end{tdoctopic} + } + } +}{ + \seq_map_inline:Nn \g__tutodoc_topic_change_seq { + \NewDocumentEnvironment{ tdoc#1 } { O{} } { + \begin{tdoctopic}{ \use:c { tutodoc@trans@chges@#1 } } [##1] + }{ + \end{tdoctopic} + } + } +} + + +%%% +% prototype:: +% #1 : (color-content) +% the color of the full content +% #2 : (short-desc) +% a short text expected to indicate the very first version of a project. +% +% :action: the short text printed will be preceded by a pretty anchor icon. +%%% +\NewDocumentCommand{ \tdocstartproj }{ + O{tutodoc@text@color} + m +} { + \group_begin: + \color{#1} + \ifcsundef{g__tutodoc_topic_change_seq}{ +% Icon used. + \tdocicon{\tutodoc@changes@start@project@icon} + }{ +% No icon used. + \raisebox{4pt}{\normalfont\tiny\bfseries\sffamily[Init]}\kern2pt + } + + #2 + \group_end: +} + +\ExplSyntaxOff + + + +% ================ % +% == DECORATION == % +% ================ % + +% refs:: +% + https://tex.stackexchange.com/a/130529/6880 +% (for the leaders trick) +% + https://tex.stackexchange.com/a/269887/6880 +% (for the \hrule width) +% + https://tex.stackexchange.com/a/729710/6880 +% (centering the \hrule) + +\newlength{\tutodoc@vertical@space@deco@len} +\setlength{\tutodoc@vertical@space@deco@len}{\dimeval{2\medskipamount+1.25pt}} + + +%%% +% prototype:: +% :action: this macro draws a centered horizontal rule with a height +% of qty::''0.75 pt'', and a width equal to half of the current +% text width, and extra vertical spaces are added above and +% below the rule. +% +% :see: len.tutodoc@vertical@space@deco@len +%%% +\newcommand{\tdocsep}{ + \par + \cleaders + \vbox to \tutodoc@vertical@space@deco@len{ + \vfill\centerline{\vrule width 0.5\hsize height 0.75pt}\vfill + }\vskip\tutodoc@vertical@space@deco@len +} diff --git a/Master/texmf-dist/tex/latex/tutodoc/tutodoc.sty b/Master/texmf-dist/tex/latex/tutodoc/tutodoc.sty deleted file mode 100644 index a1e0acdd130..00000000000 --- a/Master/texmf-dist/tex/latex/tutodoc/tutodoc.sty +++ /dev/null @@ -1,1078 +0,0 @@ -% ------------------------------------------------------- % -% - This is file `tutodoc.sty' generated automatically. - % -% - - % -% - Copyright (C) 2023-2024 by Christophe BAL - % -% - - % -% - This file may be distributed and/or modified under - % -% - the conditions of the GNU 3 License. - % -% ------------------------------------------------------- % - -\ProvidesExplPackage - {tutodoc} - {2024-08-23} % Creation: 2023-11-29 - {1.2.0-a} - {This package proposes tools for writing "human friendly" documentations of LaTeX packages.} - -\RequirePackage[ - top = 2.5cm, - bottom = 2.5cm, - left = 2.5cm, - right = 2.5cm, - marginparwidth = 2cm, - marginparsep = 2mm, - heightrounded -]{geometry}% - [2020-01-02] - -\RequirePackage[raggedright]% - {titlesec}% - [2021/07/05] - -\RequirePackage{tocbasic} - -\RequirePackage{xcolor}% - [2022/06/12] - -\RequirePackage{hyperref}% - [2023-02-07] - - -% We delegate the management of quoting to the `csquotes' package, -% which takes care of the linguistic parameters. -\RequirePackage{csquotes}% - [2022-09-14] - - -\RequirePackage{amsthm}% - [2017/09] - - -\RequirePackage{clrstrip}% - [2021-08-28] - - -\RequirePackage{tcolorbox}[2023/06/19] -\tcbuselibrary{minted, breakable, skins} - - -\RequirePackage{marginnote}% - [2023-09-07] - - -% -- LOCALE LANG -- % - -\ExplSyntaxOn - -% :: SOME MESSAGES :: % - -\msg_set:nnnn { tdoc } { package-option-lang-unknown } - { Unknown ~ language. } - { See ~ the ~ documentation ~ for ~ the ~ supported ~ languages. } - - -% :: SETTING SOME KEYS :: % - -\str_new:N \l_tdoc_opt_lang_str - -%%% -% We define the key-val options that will be exposed by the package. -%%% -\keys_define:nn { tdoc } { - lang .choices:nn = - { french, english } - { - \tl_set:Nn \l_tdoc_opt_lang_str - { \tl_use:N \l_keys_choice_tl } - }, - lang .initial:n = english, - lang / unknown .code:n = - \msg_error:nnxxx { tdoc } { package-option-lang-unknown } - { lang } % Name of choice key - { french, english } % Valid choices - { \exp_not:n {#1} } % Invalid choice given -} - -\ProcessKeyOptions[tdoc] - -\ExplSyntaxOff - - -% -- LOCALE SETTINGS -- % - -\NewDocumentCommand{\tutodoc@colon}{}{:} - -% We must take care of the colons, babel and spacing. -\@ifpackageloaded{babel}{ - \iflanguage{french}{ - \RenewDocumentCommand{\tutodoc@colon}{}{\babelshorthand{:}} - }{} -}{} - -\ExplSyntaxOn - -\input{tutodoc-locale-main-\l_tdoc_opt_lang_str.cfg.sty} - -\ExplSyntaxOff - - -% -- GENERAL SETTINGS -- % - -\setlength{\parindent}{0cm} - - -% -- LINKS -- % - -\hypersetup{ - colorlinks, - citecolor = orange!75!black, - filecolor = orange!75!black, - linkcolor = orange!75!black, - urlcolor = orange!75!black -} - - -% -- TOC & Co. -- % - -\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} - - -% -- QUOTING -- % - -%%% -% prototype:: -% #1 : a text to quote. -% -% For example, ''\tdocquote{Something}'' prints something like **"Something"**. -%%% -\NewDocumentCommand{\tdocquote}{m}{% - \enquote{\emph{#1}}% -} - - -% -- EXPLAINING ENGLISH NAMES -- % - -%%% -% prototype:: -% #1 : an english text to explain in another language. -% -% :extra: this macro has a star version. -% -% For example, if the language chosen is ''french'', we have -% the following outputs. -% -% 1) ''\tdocinEN{Something}'' prints -% **"Something" en anglais**. -% -% 2) ''\tdocinEN*{Something}'' just prints -% **"Something"**. -% This can be useful in a case like -% ''\tdocinEN*{Something} et \tdocinEN{Another thing}'' -% which gives -% **"Something" et "Another thing" en anglais**. -%%% -\NewDocumentCommand{\tdocinEN}{s m}{% - \tdocquote{#2}% - \IfBooleanF{#1}{% No star used. - \ \tutodoc@trans@in@EN{}% - }% -} - - -% -- FOCUS ON SOME CONTENT -- % - -% :: EXAMPLE - HIDDEN VERSIONS :: % - -%%% -% See the \doc of the macro ''\newtheorem'' from the package ''amsthm'' -% to have \infos about the environment ''@@tdocexa@nb''. -%%% -\newtheorem{@@tdocexa@nb}{\tutodoc@trans@exa@title}% - [subsubsection] - -%%% -% We redefine the counter associated to the environment ''@@tdocexa@nb'' -% to obtain only one single arabic number. -%%% -\renewcommand{\the@@tdocexa@nb}{\arabic{@@tdocexa@nb}} - - -%%% -% See the \doc of the macro ''\newtheorem*'' from the package ''amsthm'' -% to have \infos about the environment ''@@tdocexa@no@nb''. -%%% -\newtheorem*{@@tdocexa@no@nb}{\tutodoc@trans@exa@title} - - -% :: EXAMPLE - PUBLIC VERSION :: % - -\ExplSyntaxOn - -\msg_set:nnnn { tdoc } { env-tdocexa-unknown-option } - { Unknown ~ rafters ~ option. } - { See ~ the ~ documentation ~ for ~ the ~ supported ~ options. } - -\NewDocumentEnvironment{tdocexa}{D<>{nb} O{}}{ - \str_case:nnF { #1 } { - { nb } { - \begin{@@tdocexa@nb}[#2] - } - { nonb } { - \begin{@@tdocexa@no@nb}[#2] - } - }{ - \msg_error:nn { tdoc } { env-tdocexa-unknown-option } - } -}{ - \str_case:nnF { #1 } { - { nb } { - \end{@@tdocexa@nb} - } - { nonb } { - \end{@@tdocexa@no@nb} - } - }{} -} - -\ExplSyntaxOff - - -% :: REMARK :: % - -%%% -% See the \doc of the macro ''\newtheorem*'' from the package ''amsthm'' -% to have \infos about the environment ''tdocrem''. -%%% -\newtheorem*{tdocrem}{\tutodoc@trans@rmk@title} - - -% :: IMPORTANT :: % - -%%% -% See the \doc of the macro ''\newtheorem*'' from the package ''amsthm'' -% to have \infos about the environment ''tdocimportant''. -%%% -\newtheorem*{tdocimportant}{\tutodoc@trans@important@title} - - -% :: NOTE :: % - -%%% -% See the \doc of the macro ''\newtheorem*'' from the package ''amsthm'' -% to have \infos about the environment ''tdocnote''. -%%% -\newtheorem*{tdocnote}{\tutodoc@trans@note@title} - - -% :: TIP :: % - -%%% -% See the \doc of the macro ''\newtheorem*'' from the package ''amsthm'' -% to have \infos about the environment ''tdoctip''. -%%% -\newtheorem*{tdoctip}{\tutodoc@trans@tip@title} - - -% :: CUATION :: % - -%%% -% See the \doc of the macro ''\newtheorem*'' from the package ''amsthm'' -% to have \infos about the environment ''tdoccaution''. -%%% -\newtheorem*{tdoccaution}{\tutodoc@trans@caution@title} - - -% :: WARNING :: % - -%%% -% See the \doc of the macro ''\newtheorem*'' from the package ''amsthm'' -% to have \infos about the environment ''tdocwarn''. -%%% -\newtheorem*{tdocwarn}{\tutodoc@trans@warn@title} - - -% -- NAMES OF PACKAGES, MACROS & ENVIRONMENTS -- % - -%%% -% prototype:: -% #1 : the name of a class -% -% :action: ''\tdoccls{myclass}'' prints verb::''myclass''. -%%% -\NewDocumentCommand{\tdoccls}{m}{% - \texttt{#1}% -} - - -%%% -% prototype:: -% #1 : the name of a package -% -% :action:''\tdocpack{mypack}'' prints verb::''mypack''. -%%% -\NewDocumentCommand{\tdocpack}{m}{% - \texttt{#1}% -} - - -%%% -% prototype:: -% #1 : the name of a macro -% -% :action: ''\tdocmacro{mymacro}'' prints verb::''\mymacro''. -%%% -\NewDocumentCommand{\tdocmacro}{m}{% - \texttt{\textbackslash{}#1}% -} - - -%%% -% prototype:: -% #1 : hard typed options with the good delimiters -% #2 : the name of an environment -% -% :action: ''\tdocenv{myenv}'' prints verb::''\begin{myenv} ... \end{myenv}'' -% or something like verb::''\begin{myenv}<opt1> ... \end{myenv}'', -% the spaces being secable. -%%% -% -% Cleaner code from https://tex.stackexchange.com/a/703379/6880 . -\NewDocumentCommand{\tdocenv}{O{}m}{% - \texttt{\string\begin\string{#2\string}#1 % - \!\!...\@\!\!\! % - \string\end\string{#2\string}}% -} - - -% -- EXPLAINING PREFIXES -- % - -\ExplSyntaxOn - -% :: MESSAGES :: % - -\msg_set:nnnn { bdoc } { prefixwhy-bad-format } -{ Bad ~ format, ~ something ~ like ~ ''pre.fix'' ~ expected. } -{ You ~ must ~ use ~ one ~ single ~ point. } - - -% :: PREFIX FROM... :: % - -%%% -% prototype:: -% #1 : a prefix and a suffix separated by one colon. -% -% :action: ''\tdocprewhy{pre.fix}'' prints verb::''pre''.fix. -%%% -\NewDocumentCommand{\tdocprewhy}{m}{% -% Do we have 2 parts? - \seq_set_split:Nnn \l_tmpa_seq { . } { #1 } - - \int_set:Nn \l_tmpa_int - {\int_eval:n {\seq_count:N \l_tmpa_seq}} - - \if_int_compare:w \l_tmpa_int = 2 - \else: - \msg_error:nn { bdoc } { prefixwhy-bad-format } - \fi: - -% Let's go. - \seq_pop:NN \l_tmpa_seq \l_tmpa_tl - \seq_pop:NN \l_tmpa_seq \l_tmpb_tl - - \textbf{\tdocpre{\tl_use:N \l_tmpa_tl}\kern.5pt\textperiodcentered\kern.5pt{\tl_use:N \l_tmpb_tl}} -} - -\ExplSyntaxOff - - -% :: JUST ONE PREFIX :: % - -%%% -% prototype:: -% #1 : just a prefix -% -% :action: ''\tdocpre{pre}'' only prints verb::''pre''. -% This can be useful in a case like -% ''\tdocpre{pre} comes from \tdocprewhy{pre}{fix}'' -% which prints: -% verb::''pre'' comes from verb::''pre''-fix. -%%% -\NewDocumentCommand{\tdocpre}{m}{% - \texttt{#1}% -} - - -% -- GENERAL FORMATTING -- % - -% :: TEXT INSIDE A RULE :: % - -\ExplSyntaxOn - -%%% -% prototype:: -% #1 : a text -% #2 : a color -% -% :action: this macro adds two horizontal lines on either side of the text. -% The final output is centered. -% -% note:: -% The code used comes from -% cf::''this post ; -% https://tex.stackexchange.com/a/604708/6880''. -%%% -\NewDocumentCommand{\tdocruler}{m m}{ - \par - { - \centering - \scriptsize - \itshape - \bfseries - \color{#2} - - \hbox_set:Nn \l_tmpa_box { \,\, #1 \,\, } - \dim_set:Nn \l_tmpa_dim { - .35 \linewidth - .5 \box_wd:N \l_tmpa_box - } - - \rule[.75pt] { \dim_use:N \l_tmpa_dim } - { 2.5pt } - \box_use:N \l_tmpa_box - \rule[.75pt] { \dim_use:N \l_tmpa_dim } - { 2.5pt } - \par - } -} - -\ExplSyntaxOff - - -% :: COLOR TRANSFORMATIONS :: % - -%%% -% prototype:: -% #1 : one color following the ''xcolor'' format. -% -% :return: a "darker" version of the color ''#1''. -%%% -\NewExpandableDocumentCommand{\tdocdarkcolor}{m}{% - #1!50!black% -} - - -%%% -% prototype:: -% #1 : one color following the ''xcolor'' format. -% -% :return: a "transparent" version of the color `#1`. -%%% -\NewExpandableDocumentCommand{\tdoclightcolor}{m}{% - #1!5% -} - - -% :: INTERNAL ENVIRONMENTS :: % - -%%% -% prototype:: -% #1 : the text before the real output -% #2 : the text after the real output -% #3 : one color following the ''xcolor'' format. -% This color is used to set the one for the decorated texts printed -% corresponding to the two first arguments. -% -% :action: this environment just adds its content processed by \latex -% between centered materials produced by the macro ''\tdocruler'' -% such as to stress the start and the end of the content. -%%% -\NewDocumentEnvironment{tdoc@showcase@basic}{m m m}{ - \tdocruler{#1}{\tdocdarkcolor{#3}} - \nopagebreak\medskip\nopagebreak -}{ - \nopagebreak\medskip\nopagebreak - \tdocruler{#2}{\tdocdarkcolor{#3}} -} - - -%%% -% prototype:: -% #1 : the text before the real output -% #2 : the text after the real output -% #3 : the color following the ''xcolor'' format. -% This color is used to set the ones of the stripe and the decorated -% texts printed (see the two first arguments). -% -% :action: this environment adds a page-width colored stripe in the -% background of the environment content processed by \latex. -% This stripe is preceded and followed by centered materials -% produced by the macro ''\tdocruler'' such as to stress the -% start and the end of the content. -%%% - -\NewDocumentEnvironment{tdoc@showcase@colorstrip}{m m m}{ - \begin{colorstrip}{\tdoclightcolor{#3}} - \begin{tdoc@showcase@basic}{#1}{#2}{#3} -}{ - \end{tdoc@showcase@basic} - \end{colorstrip} -} - - -\ExplSyntaxOn - -% :: SETTING SOME KEYS :: % - -\tl_new:N \l_tdoc_showcase_before_tl -\tl_new:N \l_tdoc_showcase_after_tl -\tl_new:N \l_tdoc_showcase_color_tl -\bool_new:N \l_tdoc_showcase_nostripe_bool - - -%%% -% prototype:: -% :see: env.tdocshowcase -% -% We define the key-val options that will be exposed by the \env -% ''tdocshowcase''. -%%% -\keys_define:nn { tdoc/showcase } { -% Texts. - before .tl_set:N = \l_tdoc_showcase_before_tl, - before .initial:n = \tutodoc@trans@latex@show@start, - after .tl_set:N = \l_tdoc_showcase_after_tl, - after .initial:n = \tutodoc@trans@latex@show@end, -% Decorations. - color .tl_set:N = \l_tdoc_showcase_color_tl, - color .initial:n = cyan, - nostripe .bool_set:N = \l_tdoc_showcase_nostripe_bool, - nostripe .initial:n = false, -} - - -% :: SHOWCASE FROM TYPED CODE :: % - -% prototype:: -% #1 : the key-value options. -% -% :action: this \env formats \latex code, given as an argument, -% by framing it with texts decorated by ''\tdocruler'', -% in order to clearly identify a rendering used as an -% example. -% It is also possible to have a coloured strip of the width -% of the page in the background of the content. -% -% :see: env.tdoc@showcase@basic , -% env.tdoc@showcase@colorstrip -%%% -\NewDocumentEnvironment{tdocshowcase}{ O{} }{ - \group_begin: - \keys_set:nn { tdoc/showcase } { #1 } - - \bool_if:NTF \l_tdoc_showcase_nostripe_bool { - \begin{tdoc@showcase@basic}% - { \tl_use:N \l_tdoc_showcase_before_tl }% - { \tl_use:N \l_tdoc_showcase_after_tl }% - { \tl_use:N \l_tdoc_showcase_color_tl } - }{ - \begin{tdoc@showcase@colorstrip}% - { \tl_use:N \l_tdoc_showcase_before_tl }% - { \tl_use:N \l_tdoc_showcase_after_tl }% - { \tl_use:N \l_tdoc_showcase_color_tl } - } -}{ - \bool_if:NTF \l_tdoc_showcase_nostripe_bool { - \end{tdoc@showcase@basic} - }{ - \end{tdoc@showcase@colorstrip} - } - \group_end: -} - - -% :: SHOWCASE FROM FILE :: % - -%%% -% prototype:: -% #1 : the key-value options supported by the ''tdocshowcase'' \env. -% #2 : the path of a file -% -% :see: env.tdocshowcase -%%% -\NewDocumentCommand{\tdocshowcaseinput}{O{} m}{ - \group_begin: - \keys_set_known:nnN { tdoc/latexshow } { #1 } \l_tmpa_tl - - \exp_last_unbraced:NNV \tdocshowcase [\l_tmpa_tl] - \input{#2} - \endtdocshowcase - \group_end: -} - -\ExplSyntaxOff - - -% -- LATEX EXAMPLES -- % - -% :: INLINE SHORT LATEX CODE :: % - -%%% -% See the \doc of the macro ''\newmintinline'' from the package ''minted'' -% to have \infos about the macro ''tdocinlatex''. -%%% -\newmintinline[tdocinlatex]{latex}{bgcolor = yellow!4} - - -% :: SHORTCUTS FOR TCOLORBOX LISTING FORMATING :: % - -\ExplSyntaxOn - -%%% -% In the following easy-to-understand macro, we use one fictive ''tcolorbox'' -% style such as to indicate an unknown ''tdoc'' style to the user. -% For example, this can give one message similar to the following one. -% -% term:: -% Package pgfkeys Error: I do not know the key '/tcb/tdoclatex bad option -% "NOT-A-STYLE"' and I am going to ignore it. Perhaps you misspelled it. -% -% See the pgfkeys package documentation for explanation. -%%% -\NewExpandableDocumentCommand{\tutodoc@latex@listing@formating}{ m }{ - \str_case:nnF { #1 } { - { sbs } { listing ~ side ~ text } - { code } { listing ~ only } - { std } { listing ~ and ~ text } - } { tdoclatex ~ bad ~ option ~ "#1" } -} - -\ExplSyntaxOff - - -% :: THE TCOLORBOX LISTING STYLE :: % - -%%% -% note:: -% The settings used come from the following sources. -% * https://tex.stackexchange.com/a/604821/6880 -% * https://tex.stackexchange.com/a/327983/6880 -%%% -\tcbset{ - tdoclatex_tcbstyle/.style = { - minted language = latex, - breakable, -% Code and output - colback = yellow!5, -% Frame - colframe = darkgray, - shadow = {.75mm}{-.75mm}{0mm}{black!30}, - arc = .75mm, - left = 1mm, right = 1mm, - bottom = 1mm, top = 1mm, -% We can use ''sharp corners'' to obtain an "old school" style. -% -% Separating line - enhanced, - segmentation style = { - gray, - dash pattern = {on 5pt off 2.5pt}, - line width = 1.25pt - }, - #1 - }, -} - - -% :: TCOLORBOX LISTING ENVIRONMENT :: % - -%%% -% prototype:: -% #1 : the style to be used (code only, code and output side by side, -% or the standard style corresponding to the code followed by -% its output) -% @ #1 in [code, sbs, std] -% -% note:: -% See the \doc of the macro ''\newtcblisting'' from the package -% ''tcolorbox'' to have \infos about the environment ''tdoclatex''. -%%% -\newtcblisting{tdoclatex}[1][std]{% - tdoclatex_tcbstyle = \tutodoc@latex@listing@formating{#1} -} - - -% :: TCOLORBOX IMPORTED LISTING MACRO :: % - -%%% -% prototype:: -% #1 : :see: \newtcblisting{tdoclatex}. -% #2 : the path of the file to input and format. -% -% note:: -% See the \doc of the macro ''\newtcbinputlisting'' from the package -% ''tcolorbox'' to have more \infos about the macro ''\tdoclatexinput''. -%%% -\newtcbinputlisting{\tdoclatexinput}[2][std]{ - listing file = {#2}, - tdoclatex_tcbstyle = \tutodoc@latex@listing@formating{#1} -} - - -% -- LATEX REAL USE CASES -- % - -\ExplSyntaxOn - -% :: SETTING SOME KEYS :: % - -\tl_new:N \l_tdoc_listing_explain_tl - -%%% -% prototype:: -% :see: macro.tdoclatexshow -% -% We define the key-val options that will be exposed by ''\tdoclatexshow''. -%%% -\keys_define:nn { tdoc/latexshow } { - explain .tl_set:N = \l_tdoc_listing_explain_tl, - explain .initial:n = { \tutodoc@trans@this@gives \tutodoc@colon }, -} - - -% :: LATEXSHOW MACRO :: % - -%%% -% prototype:: -% #1 : the key-value options supported by the ''tdocshowcase'' \env, -% plus one allowing you to change the description of a line -% printed between the code and its focused output. -% #2 : the path of a file -% -% :see: env.tdocshowcase , -% macro.tdoclatexinput -%%% -\NewDocumentCommand{\tdoclatexshow}{O{} m}{ - \group_begin: - \keys_set_known:nnN { tdoc/latexshow } { #1 } \l_tmpa_tl - - \tdoclatexinput[code]{#2} - - \tl_use:N \l_tdoc_listing_explain_tl - -% Source: https://tex.stackexchange.com/a/696700/6880 - \exp_last_unbraced:NNV \tdocshowcaseinput [\l_tmpa_tl] {#2} - \group_end: -} - -\ExplSyntaxOff - - -% -- CHANGES - WHEN? --% - -\ExplSyntaxOn - -% :: MESSAGES :: % - -\msg_set:nnnn { tdoc } { date-bad-format } - { Bad ~ format ~ for ~ a ~ date. } - { Use ~ YYYY-MM-DD. } - - -% :: MARGIN NOTE :: % - -\reversemarginpar{} - -%%% -% prototype:: -% #1 : the color of the margin note -% #2 : the first material (a version number or nothing) -% #3 : the second material (a date or nothing) -% #4 : the last negative vertical spacing for the 2nd rule -% -% :action: this macro factorizes the printing of the changes -% in the left margin. -% -% :see: \__tdoc_translate_date:n -%%% -\NewDocumentCommand{\tutodoc@new@change@margin}{m m m m}{ - \marginnote{ - \color{#1} - \scriptsize - \centering - - \vspace{0pt} - \rule{1.65cm}{.95pt} - \vspace{-2.9pt} - - \IfBlankTF{#2}{}{ - \par - #2 - \par - } - - \IfBlankTF{#3}{}{ - \IfBlankTF{#2}{}{ - \vspace{1pt} - } - - \par - \__tdoc_translate_date:n { #3 } - \par - } - - \vspace{#4} - \rule{1.65cm}{.95pt} - }[-.345cm] -} - - -%%% -% prototype:: -% :action: this function checks if we have something like -% ''YYYY-MM-DD'' and then it calls the function -% ''\__tdoc_translate_date_process:w'' to finish -% the job. -% -% :see: \__tdoc_translate_date_process:w -%%% -\cs_new:Nn \__tdoc_translate_date:n { - \regex_match:nnTF { \A \d{1,4} \- \d{2} \- \d{2} \Z } { #1 }{ - \__tdoc_translate_date_process:w #1 \q_stop - }{ - \msg_error:nn { tdoc } { date-bad-format } - } -} - - -%%% -% prototype:: -% :action: this function extracts year, month and day in something -% like ''YYYY-MM-DD'' and then it calls ''\tutodoc@trans@date'' -% to use the format expected for a "localised" date. -%%% -\cs_new:Npn \__tdoc_translate_date_process:w #1 - #2 - #3 \q_stop { - \tutodoc@trans@date{#1} - {#2} - {#3} -} - - -% :: VERSION AND DATE :: % - -%%% -% prototype:: -% #1 : the color of the margin note -% #2 : a version number -% #3 : a date ''YYYY-MM-DD'' -% -% :action: this macro prints a margin note showing a version number -% below a date, and the optional argument is used to colorize -% all this text. -% -% warning:: -% The date must use an english formatting like ''2021-07-14''. This allows -% to parse the date such as to display it following the standard convention -% of the language chosen when loading the package. -%%% -\NewDocumentCommand{\tdocversion}{O{blue} m O{}}{ - \tutodoc@new@change@margin{#1} % Color - {#2} % Version - {#3} % Date - {-4.25pt} % Last negative vertical spacing -} - - -% :: DATE :: % - -%%% -% prototype:: -% #1 : the color of the margin note -% #2 : a date ''YYYY-MM-DD'' -% -% :action: this macro is similar to ''\tdocversion'' except that it just -% prints a date. -%%% -\NewDocumentCommand{\tdocdate}{O{blue} m}{ - \tutodoc@new@change@margin{#1} % Color - {#2} % Date - {} % Version - {-5.35pt} % Last negative spacing -} - - -% -- CHANGES - WHAT? -- % - -% :: MESSAGES :: % - -\msg_set:nnnn { tdoc } { changes-topic-missing-title } - { Missing ~ title. } - { One ~ single ~ title ~ must ~ be ~ indicated. } - - -% :: CHANGES - TOPIC :: % - -%%% -% prototype:: -% #1 : a title that will be followed by a colon. -% -% :action: this environment prints some ¨infos about specific changes -% achieved in a new version (no special formatting is applied). -%%% -\NewDocumentEnvironment{tdoctopic}{ m }{ - \IfBlankT{#1}{ - \msg_fatal:nn { tdoc } { changes-topic-missing-title } - } - - \textbf{ - \textsc{#1.} - } - - \begin{itemize} -}{ - \end{itemize} -} - - -% :: CHANGES - NEW THINGS :: % - -%%% -% prototype:: -% :see: env.tdoctopic -% -% :action: similar to the \env ''tdoctopic'' with the title "New" -% translated into the good language. -%%% -\NewDocumentEnvironment{tdocnew}{}{ - \begin{tdoctopic}{\tutodoc@trans@chges@new} -}{ - \end{tdoctopic} -} - - -% :: CHANGES - UPDATE :: % - -%%% -% prototype:: -% :see: env.tdoctopic -% -% :action: similar to the \env ''tdoctopic'' with the title "Update" -% translated into the good language. -%%% -\NewDocumentEnvironment{tdocupdate}{}{ - \begin{tdoctopic}{\tutodoc@trans@chges@update} -}{ - \end{tdoctopic} -} - - -% :: CHANGES - BREAK :: % - -%%% -% prototype:: -% :see: env.tdoctopic -% -% :action: similar to the \env ''tdoctopic'' with the title "Break" -% translated into the good language. -%%% -\NewDocumentEnvironment{tdocbreak}{}{ - \begin{tdoctopic}{\tutodoc@trans@chges@break} -}{ - \end{tdoctopic} -} - - -% :: CHANGES - PROBLEM :: % - -%%% -% prototype:: -% :see: env.tdoctopic -% -% :action: similar to the \env ''tdoctopic'' with the title "Problem" -% translated into the good language. -%%% -\NewDocumentEnvironment{tdocprob}{}{ - \begin{tdoctopic}{\tutodoc@trans@chges@pb} -}{ - \end{tdoctopic} -} - - -% :: CHANGES - FIX :: % - -%%% -% prototype:: -% :see: env.tdoctopic -% -% :action: similar to the \env ''tdoctopic'' with the title "Fix" -% translated into the good language. -%%% -\NewDocumentEnvironment{tdocfix}{}{ - \begin{tdoctopic}{\tutodoc@trans@chges@fix} -}{ - \end{tdoctopic} -} - -\ExplSyntaxOff - - -% -- DECORATIONS -- % - -% Source for \addvspace{\medskipamount} instead of \medskip. -% * https://tex.stackexchange.com/a/705938/6880 - -%%% -% prototype:: -% :action: this macro draws a centered horizontal rule with a height -% of qty::''0.75 pt'', and a width equal to half of the current -% text width. -% Extra vertical spaces are added above and below the rule. -%%% -\NewDocumentCommand{\tdocsep}{}{ - \par\addvspace{\medskipamount} - \hfill\rule{0.5\textwidth}{0.75pt}\hfill\null - \medskip - \smallskip -} - - -%%% -% prototype:: -% :action: this macro adds a tiny vertical spacing. -%%% -\NewDocumentCommand{\tdocxspace}{}{ - \vspace{0.25em} -} |