diff options
author | Norbert Preining <norbert@preining.info> | 2022-10-19 03:01:25 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2022-10-19 03:01:25 +0000 |
commit | 7b6cdf4c23e6ed232601dabc70f5553a8dee9c9b (patch) | |
tree | 608a2d05e7d0ffa5cde10be67db643ae542dc280 /macros/latex/contrib/docshots | |
parent | 0b311348359e1406b173d9c0de4974af3e90f836 (diff) |
CTAN sync 202210190301
Diffstat (limited to 'macros/latex/contrib/docshots')
-rw-r--r-- | macros/latex/contrib/docshots/DEPENDS.txt | 2 | ||||
-rw-r--r-- | macros/latex/contrib/docshots/docshots.dtx | 93 | ||||
-rw-r--r-- | macros/latex/contrib/docshots/docshots.pdf | bin | 334497 -> 336674 bytes |
3 files changed, 78 insertions, 17 deletions
diff --git a/macros/latex/contrib/docshots/DEPENDS.txt b/macros/latex/contrib/docshots/DEPENDS.txt index 194336badc..da7d048685 100644 --- a/macros/latex/contrib/docshots/DEPENDS.txt +++ b/macros/latex/contrib/docshots/DEPENDS.txt @@ -4,3 +4,5 @@ hard pdfcrop hard pgf hard pgf-blur hard pgfopts +hard listings +hard minted
\ No newline at end of file diff --git a/macros/latex/contrib/docshots/docshots.dtx b/macros/latex/contrib/docshots/docshots.dtx index 18f9b6356a..8dfd11cf52 100644 --- a/macros/latex/contrib/docshots/docshots.dtx +++ b/macros/latex/contrib/docshots/docshots.dtx @@ -50,7 +50,7 @@ %<package>\NeedsTeXFormat{LaTeX2e} %<package>\ProvidesPackage{docshots} %<*package> -[2022-10-17 0.0.3 TeX Samples Next to Their PDF Snapshots in DTX] +[2022-10-18 0.0.4 TeX Samples Next to Their PDF Snapshots in DTX] %</package> %<*driver> \documentclass{ltxdoc} @@ -306,6 +306,52 @@ Hello, world! %</verb> %\fi +% \DescribeMacro{log} +% With |log| option you can make us print all possible logs to the main \TeX{} log. +% By default, we don't do this and you won't see the output of |pdflatex| compilation, for example. +% Just use it like this: +%\iffalse +%<*verb> +%\fi +\begin{verbatim} +\usepackage[log]{docshot} +\end{verbatim} +%\iffalse +%</verb> +%\fi + +% \DescribeMacro{inputminted} +% By default, we render the verbatim text using |\VerbatimInput| command. You +% can change that and make us use |\inputminted| +% from \href{https://ctan.org/pkg/minted}{minted} package instead, for example: +%\iffalse +%<*verb> +%\fi +\begin{verbatim} +\usepackage{minted} +\setminted[java]{frame=lines,framesep=2mm} +\usepackage[inputminted=java]{docshot} +\end{verbatim} +%\iffalse +%</verb> +%\fi + +% \DescribeMacro{lstinputlisting} +% By default, we render the verbatim text using |\VerbatimInput| command. You +% can change that and make us use |\lstinputlisting| from +% \href{https://ctan.org/pkg/listings}{listings} package instead, for example: +%\iffalse +%<*verb> +%\fi +\begin{verbatim} +\usepackage{listings} +\lstset{basicstyle=\small} +\usepackage[lstinputlisting]{docshot} +\end{verbatim} +%\iffalse +%</verb> +%\fi + % \section{Prerequisites} % \DescribeMacro{\docshotPrerequisite} @@ -402,6 +448,10 @@ Hello, world! \pgfkeys{ /docshots/.cd, dtx/.store in=\docshots@dtx, + log/.store in=\docshots@log, + log/.default=, + lstinputlisting/.store in=\docshots@lstinputlisting, + inputminted/.store in=\docshots@inputminted, tmpdir/.store in=\docshots@tmpdir, tmpdir/.default=_docshots, small/.store in=\docshots@small, @@ -422,24 +472,24 @@ Hello, world! left/.default=.3\linewidth, right/.store in=\docshots@right, right/.default=.55\linewidth, - tmpdir,pdflatex,gs,pdfcrop,margin,hspace,left,right,runs + tmpdir,pdflatex,gs,pdfcrop,margin,hspace,left,right,runs,log } \ProcessPgfOptions{/docshots} % \end{macrocode} % Then, we print the version of |pdflatex| to \TeX{} log: % \begin{macrocode} -\iexec[log,quiet]{\docshots@pdflatex\space --version}% +\iexec[\docshots@log,quiet]{\docshots@pdflatex\space --version}% % \end{macrocode} % Then, we print the version of \href{https://ctan.org/pkg/pdfcrop}{pdfcrop} to \TeX{} log: % \begin{macrocode} -\iexec[log,quiet]{\docshots@pdfcrop\space --version}% +\iexec[\docshots@log,quiet]{\docshots@pdfcrop\space --version}% % \end{macrocode} % Then, we print the version of |ghostscript| to \TeX{} log: % \begin{macrocode} -\iexec[log,quiet]{\docshots@gs\space --version}% +\iexec[\docshots@log,quiet]{\docshots@gs\space --version}% % \end{macrocode} % Then, we make a directory where all temporary files will be kept: @@ -464,7 +514,8 @@ Hello, world! % \end{macrocode} % We calculate MD5 hashsum of the file content: % \begin{macrocode} - \def\hash{\pdfmdfivesum file {\docshots@tmpdir/\jobname/verbatim.tex}}% + \def\hash{\pdfmdfivesum file + {\docshots@tmpdir/\jobname/verbatim.tex}}% % \end{macrocode} % If the PDF with the required name already exists, we ignore this step. % Otherwise, we copy |verbatim.tex| into new file and run |pdflatex|: @@ -472,10 +523,10 @@ Hello, world! \IfFileExists{\docshots@tmpdir/\jobname/\hash.pdf} {\message{docshots: won't render, the PDF already exists (\docshots@tmpdir/\jobname/\hash.pdf)^^J}} - {\iexec[log,quiet]{cp \docshots@tmpdir/\jobname/verbatim.tex + {\iexec[\docshots@log,quiet]{cp \docshots@tmpdir/\jobname/verbatim.tex \docshots@tmpdir/\jobname/\hash.tex}% \foreach \n in {1,...,\docshots@runs}{ - \iexec[log,quiet]{cd \docshots@tmpdir/\jobname; + \iexec[\docshots@log,quiet]{cd \docshots@tmpdir/\jobname; \docshots@pdflatex\space -interaction=errorstopmode -halt-on-error @@ -483,16 +534,16 @@ Hello, world! \hash.tex} \message{docshots: pdflatex run no.\n^^J} \IfFileExists{\docshots@tmpdir/\jobname/after.sh} - {\iexec[log,quiet]{chmod a+x + {\iexec[\docshots@log,quiet]{chmod a+x \docshots@tmpdir/\jobname/after.sh} - \iexec[log,quiet]{cd \docshots@tmpdir/\jobname; + \iexec[\docshots@log,quiet]{cd \docshots@tmpdir/\jobname; ./after.sh \n\space \hash\space \hash.tex}} {}}}% % \end{macrocode} % Here we delete |after.sh| which may exist here after the last % compilation of |pdflatex|: % \begin{macrocode} - \iexec[log,quiet]{rm -f \docshots@tmpdir/\jobname/after.sh} + \iexec[\docshots@log,quiet]{rm -f \docshots@tmpdir/\jobname/after.sh} % \end{macrocode} % If a cropped version of the PDF with the required name already exists, we ignore this step. % Otherwise, we ask |pdfcrop| to crop the PDF: @@ -500,7 +551,7 @@ Hello, world! \IfFileExists{\docshots@tmpdir/\jobname/\hash.crop.pdf} {\message{docshots: on't pdfcrop, the PDF already exists (\docshots@tmpdir/\jobname/\hash.crop.pdf)^^J}} - {\iexec[log,quiet]{\docshots@pdfcrop\space + {\iexec[\docshots@log,quiet]{\docshots@pdfcrop\space --margins \docshots@margin\space \docshots@tmpdir/\jobname/\hash.pdf \docshots@tmpdir/\jobname/\hash.crop.pdf}}% @@ -509,7 +560,7 @@ Hello, world! % \begin{macrocode} \fvset{numbers=left,numbersep=3pt}% \fvset{frame=leftline,framerule=.4pt,rulecolor=\color{gray}}% - \fvset{samepage=true,baselinestretch=1}% + \fvset{samepage=true}% \fvset{baselinestretch=1}% \ifdefined\docshots@small% \fvset{fontsize=\small}% @@ -529,7 +580,14 @@ Hello, world! \hspace{\docshots@hspace}% \begin{minipage}[t]{\docshots@right}% \vspace{0pt}% - \VerbatimInput{\docshots@tmpdir/\jobname/\hash.tex}% + \ifdefined\docshots@lstinputlisting% + \lstinputlisting{\docshots@tmpdir/\jobname/\hash.tex}% + \else\ifdefined\docshots@inputminted% + \inputminted{\docshots@inputminted} + {\docshots@tmpdir/\jobname/\hash.tex}% + \else% + \VerbatimInput{\docshots@tmpdir/\jobname/\hash.tex}% + \fi\fi% \vspace{0pt}% \end{minipage}% \par% @@ -542,7 +600,7 @@ Hello, world! % Then, we define |\docshotPrerequisite| command: % \begin{macrocode} \newcommand\docshotPrerequisite[1]{ - \iexec[log,quiet]{cp #1 \docshots@tmpdir/\jobname}% + \iexec[\docshots@log,quiet]{cp #1 \docshots@tmpdir/\jobname}% \message{docshots: file #1 copied to \docshots@tmpdir/\jobname/#1^^J}% } @@ -553,9 +611,10 @@ Hello, world! % Finally, we define |\docshotAfter| command: % \begin{macrocode} \newcommand\docshotAfter[1]{ - \iexec[log,quiet]{/bin/echo -n '\detokenize{#1}' + \iexec[\docshots@log,quiet]{/bin/echo -n '\detokenize{#1}' > \docshots@tmpdir/\jobname/after.sh}% - \message{docshots: file \docshots@tmpdir/\jobname/after.sh created^^J}% + \message{docshots: file + \docshots@tmpdir/\jobname/after.sh created^^J}% } % \end{macrocode} % \end{macro} diff --git a/macros/latex/contrib/docshots/docshots.pdf b/macros/latex/contrib/docshots/docshots.pdf Binary files differindex b4a800febd..fbec067a70 100644 --- a/macros/latex/contrib/docshots/docshots.pdf +++ b/macros/latex/contrib/docshots/docshots.pdf |