diff options
author | Karl Berry <karl@freefriends.org> | 2022-11-10 20:22:21 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2022-11-10 20:22:21 +0000 |
commit | 7f94dd88b995283814387ca983c4cbd435772707 (patch) | |
tree | 000b726f869eb1214b42c6cc262d4842912a132e /Master/texmf-dist/source/latex/docshots/docshots.dtx | |
parent | 7cb25d7fe89465ed8e77165b04740601f1437449 (diff) |
docshots (10nov22)
git-svn-id: svn://tug.org/texlive/trunk@64986 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/docshots/docshots.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/docshots/docshots.dtx | 55 |
1 files changed, 46 insertions, 9 deletions
diff --git a/Master/texmf-dist/source/latex/docshots/docshots.dtx b/Master/texmf-dist/source/latex/docshots/docshots.dtx index 0a559d7edf8..0ba48b98de9 100644 --- a/Master/texmf-dist/source/latex/docshots/docshots.dtx +++ b/Master/texmf-dist/source/latex/docshots/docshots.dtx @@ -50,12 +50,13 @@ %<package>\NeedsTeXFormat{LaTeX2e} %<package>\ProvidesPackage{docshots} %<*package> -[2022-10-26 0.2.0 TeX Samples Next to Their PDF Snapshots in DTX] +[2022-11-10 0.3.0 TeX Samples Next to Their PDF Snapshots in DTX] %</package> %<*driver> \documentclass{ltxdoc} \usepackage[tt=false, type1=true]{libertine} \usepackage{microtype} +\AddToHook{env/verbatim/begin}{\microtypesetup{protrusion=false}} \usepackage[dtx]{docshots} \usepackage{href-ul} \usepackage{xcolor} @@ -96,11 +97,11 @@ % To \href{https://tex.stackexchange.com/questions/661027}{my best} % knowledge, there were no packages that would allow % you do exactly this. That's why I created this simple package. + % For example, this code: -% -%\iffalse -%<*verb> -%\fi +%\iffalse% +%<*verb>% +%\fi% \begin{verbatim} \begin{docshot} \documentclass{article} @@ -155,7 +156,7 @@ % \begin{docshot} % \documentclass{article} % \usepackage[paperwidth=2in, -% paperheight=2.2in]{geometry} +% paperheight=2.3in]{geometry} % \begin{document} % ``There is no sadder thing than % a young pessimist, except an old @@ -365,6 +366,26 @@ Hello, world! %</verb> %\fi +% \section{Fine-uning Options} + +% \DescribeMacro{\docshotOptions} +% By default, we render the verbatim text using |\VerbatimInput| command with +% no options. You can add your options using |\docshotOptions| command: +%\iffalse +%<*verb> +%\fi +\begin{verbatim} +\docshotOptions{firstline=4} +\begin{docshot} +... +\end{docshot} +\end{verbatim} +%\iffalse +%</verb> +%\fi + +% The options will be cleaned up by the first render of a docshot. + % \section{Prerequisites} % \DescribeMacro{\docshotPrerequisite} @@ -623,17 +644,21 @@ Hello, world! \begin{minipage}[t]{\docshots@right}% \vspace{0pt}% \ifdefined\docshots@lstinputlisting% - \lstinputlisting{\docshots@tmpdir/\jobname/\hash.tex}% + \expandafter\lstinputlisting\expandafter[\docshots@opts] + {\docshots@tmpdir/\jobname/\hash.tex}% \else\ifdefined\docshots@inputminted% - \inputminted{\docshots@inputminted} + \expandafter\inputminted\expandafter[\docshots@opts] + {\docshots@inputminted} {\docshots@tmpdir/\jobname/\hash.tex}% \else% - \VerbatimInput{\docshots@tmpdir/\jobname/\hash.tex}% + \expandafter\VerbatimInput\expandafter[\docshots@opts] + {\docshots@tmpdir/\jobname/\hash.tex}% \fi\fi% \vspace{0pt}% \end{minipage}% \par% \endgroup% + \docshotOptions{}% }\makeatother % \end{macrocode} % \end{macro} @@ -661,6 +686,18 @@ Hello, world! % \end{macrocode} % \end{macro} +% \begin{macro}{\docshotOptions} +% Finally, we define |\docshotOptions| command: +% \changes{0.3.0}{2022/11/10}{New command introduced to help specify custom options for verbatim environments.} +% \begin{macrocode} +\makeatletter +\gdef\docshots@opts{} +\newcommand\docshotOptions[1]{% + \gdef\docshots@opts{#1}% +}\makeatother +% \end{macrocode} +% \end{macro} + % \Finale %\clearpage |