diff options
author | Karl Berry <karl@freefriends.org> | 2022-10-16 20:13:35 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2022-10-16 20:13:35 +0000 |
commit | 8bef47547f86e14494c02edeaf377bac25279156 (patch) | |
tree | fe6932cb9e7b2f01c1ff069a8b699950eb7920bc /Master/texmf-dist/tex/latex/docshots/docshots.sty | |
parent | bb3cce09999dca0412d465b9d2cdc4e5e5b0a497 (diff) |
docshots (16oct22)
git-svn-id: svn://tug.org/texlive/trunk@64722 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/docshots/docshots.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/docshots/docshots.sty | 75 |
1 files changed, 58 insertions, 17 deletions
diff --git a/Master/texmf-dist/tex/latex/docshots/docshots.sty b/Master/texmf-dist/tex/latex/docshots/docshots.sty index a826431e7f6..44abfe234f9 100644 --- a/Master/texmf-dist/tex/latex/docshots/docshots.sty +++ b/Master/texmf-dist/tex/latex/docshots/docshots.sty @@ -31,7 +31,16 @@ \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{docshots} -[2022-10-14 0.0.1 TeX Samples Next to Their PDF Snapshots in DTX] +[2022-10-16 0.0.2 TeX Samples Next to Their PDF Snapshots in DTX] + + + + + + + + + @@ -47,35 +56,67 @@ \RequirePackage{tikz} \usetikzlibrary{shadows.blur} -\iexec[log,quiet]{pdflatex --version}% +\RequirePackage{pgfopts} +\pgfkeys{ + /docshots/.cd, + dtx/.store in=\docshots@dtx, + pdflatex/.store in=\docshots@pdflatex, + pdflatex/.default=pdflatex, + gs/.store in=\docshots@gs, + gs/.default=gs, + pdfcrop/.store in=\docshots@pdfcrop, + pdfcrop/.default=pdfcrop, + margin/.store in=\docshots@margin, + margin/.default=5, + hspace/.store in=\docshots@hspace, + hspace/.default=1.8em, + left/.store in=\docshots@left, + left/.default=.3\linewidth, + right/.store in=\docshots@right, + right/.default=.65\linewidth, + pdflatex,gs,pdfcrop,margin,hspace,left,right +} +\ProcessPgfOptions{/docshots} + +\iexec[log,quiet]{\docshots@pdflatex\space --version}% -\iexec[log,quiet]{pdfcrop --version}% +\iexec[log,quiet]{\docshots@pdfcrop\space --version}% -\iexec[log,quiet]{gs --version}% +\iexec[log,quiet]{\docshots@gs\space --version}% \iexec[null]{mkdir -p _docshots/\jobname}% \newenvironment{docshot} -{\VerbatimEnvironment\begin{VerbatimOut}{_docshots/\jobname/verbatim.tex}} +{\VerbatimEnvironment\begin{VerbatimOut} + {_docshots/\jobname/verbatim.tex}} {\end{VerbatimOut}% - \iexec[null]{perl -i -0777pe "s/(\\n|^)\\x{25} /\\1/g" - _docshots/\jobname/verbatim.tex}% + \ifdefined\docshots@dtx% + \iexec[null]{perl -i -0777pe "s/(\\n|^)\\x{25} /\\1/g" + _docshots/\jobname/verbatim.tex}% + \fi% \def\hash{\pdfmdfivesum file {_docshots/\jobname/verbatim.tex}}% - \message{^^Jdocshots: name set to "\hash"^^J}% - \iexec[log,quiet]{cp _docshots/\jobname/verbatim.tex - _docshots/\jobname/\hash.tex}% - \iexec[log,quiet]{(cd _docshots/\jobname; - pdflatex -interaction=batchmode -shell-escape \hash.tex)}% - \iexec[log,quiet]{pdfcrop --margins 5 _docshots/\jobname/\hash.pdf - _docshots/\jobname/\hash.crop.pdf}% + \IfFileExists{_docshots/\jobname/\hash.pdf} + {\message{won't render, the PDF already exists: _docshots/\jobname/\hash.pdf^^J}} + {\iexec[log,quiet]{cp _docshots/\jobname/verbatim.tex + _docshots/\jobname/\hash.tex}% + \iexec[log,quiet]{cd _docshots/\jobname; + \docshots@pdflatex\space -interaction=batchmode + -shell-escape \hash.tex}}% + \IfFileExists{_docshots/\jobname/\hash.crop.pdf} + {\message{won't pdfcrop, the PDF already exists: _docshots/\jobname/\hash.crop.pdf^^J}} + {\iexec[log,quiet]{\docshots@pdfcrop\space + --margins \docshots@margin\space + _docshots/\jobname/\hash.pdf + _docshots/\jobname/\hash.crop.pdf}}% \fvset{frame=leftline,numbers=left,numbersep=3pt, framerule=.4pt,rulecolor=\color{gray}, samepage=true}% \par% \tikz[baseline=(a.north)] \node[draw=gray] (a) - {\includegraphics[width=.3\linewidth]{_docshots/\jobname/\hash.crop.pdf}};% - \hspace{1.8em}% - \begin{minipage}[t]{.65\linewidth}% + {\includegraphics[width=\docshots@left] + {_docshots/\jobname/\hash.crop.pdf}};% + \hspace{\docshots@hspace}% + \begin{minipage}[t]{\docshots@right}% \vspace{0pt}% \VerbatimInput{_docshots/\jobname/\hash.tex}% \vspace{0pt}% |