diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/docshots/docshots.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/docshots/docshots.sty | 50 |
1 files changed, 33 insertions, 17 deletions
diff --git a/Master/texmf-dist/tex/latex/docshots/docshots.sty b/Master/texmf-dist/tex/latex/docshots/docshots.sty index 4725e69c2db..f9f9c6225e5 100644 --- a/Master/texmf-dist/tex/latex/docshots/docshots.sty +++ b/Master/texmf-dist/tex/latex/docshots/docshots.sty @@ -31,7 +31,10 @@ \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{docshots} -[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] + + + @@ -67,6 +70,10 @@ \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, @@ -87,15 +94,15 @@ 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} -\iexec[log,quiet]{\docshots@pdflatex\space --version}% +\iexec[\docshots@log,quiet]{\docshots@pdflatex\space --version}% -\iexec[log,quiet]{\docshots@pdfcrop\space --version}% +\iexec[\docshots@log,quiet]{\docshots@pdfcrop\space --version}% -\iexec[log,quiet]{\docshots@gs\space --version}% +\iexec[\docshots@log,quiet]{\docshots@gs\space --version}% \iexec[null]{mkdir -p \docshots@tmpdir/\jobname}% @@ -107,14 +114,15 @@ \iexec[null]{perl -i -0777pe "s/(\\n|^)\\x{25} /\\1/g" \docshots@tmpdir/\jobname/verbatim.tex}% \fi% - \def\hash{\pdfmdfivesum file {\docshots@tmpdir/\jobname/verbatim.tex}}% + \def\hash{\pdfmdfivesum file + {\docshots@tmpdir/\jobname/verbatim.tex}}% \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 @@ -122,22 +130,22 @@ \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}} {}}}% - \iexec[log,quiet]{rm -f \docshots@tmpdir/\jobname/after.sh} + \iexec[\docshots@log,quiet]{rm -f \docshots@tmpdir/\jobname/after.sh} \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}}% \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}% @@ -154,7 +162,14 @@ \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% @@ -162,15 +177,16 @@ } \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}% } \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}% } |