texlive[64820] Master/texmf-dist: docshots (26oct22)
commits+karl at tug.org
commits+karl at tug.org
Wed Oct 26 22:00:20 CEST 2022
Revision: 64820
http://tug.org/svn/texlive?view=revision&revision=64820
Author: karl
Date: 2022-10-26 22:00:20 +0200 (Wed, 26 Oct 2022)
Log Message:
-----------
docshots (26oct22)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/latex/docshots/DEPENDS.txt
trunk/Master/texmf-dist/doc/latex/docshots/README.md
trunk/Master/texmf-dist/doc/latex/docshots/docshots.pdf
trunk/Master/texmf-dist/source/latex/docshots/docshots.dtx
trunk/Master/texmf-dist/tex/latex/docshots/docshots.sty
Modified: trunk/Master/texmf-dist/doc/latex/docshots/DEPENDS.txt
===================================================================
--- trunk/Master/texmf-dist/doc/latex/docshots/DEPENDS.txt 2022-10-26 19:59:50 UTC (rev 64819)
+++ trunk/Master/texmf-dist/doc/latex/docshots/DEPENDS.txt 2022-10-26 20:00:20 UTC (rev 64820)
@@ -4,4 +4,7 @@
hard pgf
hard pgfopts
hard listings
-hard minted
\ No newline at end of file
+hard minted
+hard pdftexcmds
+hard ifluatex
+hard ifxetex
Modified: trunk/Master/texmf-dist/doc/latex/docshots/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/docshots/README.md 2022-10-26 19:59:50 UTC (rev 64819)
+++ trunk/Master/texmf-dist/doc/latex/docshots/README.md 2022-10-26 20:00:20 UTC (rev 64820)
@@ -28,6 +28,8 @@
\end{document}
```
+Otherwise, you can download [`docshots.sty`](https://raw.githubusercontent.com/objectionary/eolang.sty/gh-pages/docshots/docshots.sty) and add to your project.
+
If you want to contribute yourself, make a fork, then create a branch,
then run `l3build ctan` in the root directory.
It should compile everything without errors. If not, submit an issue and wait.
Modified: trunk/Master/texmf-dist/doc/latex/docshots/docshots.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/source/latex/docshots/docshots.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/docshots/docshots.dtx 2022-10-26 19:59:50 UTC (rev 64819)
+++ trunk/Master/texmf-dist/source/latex/docshots/docshots.dtx 2022-10-26 20:00:20 UTC (rev 64820)
@@ -50,7 +50,7 @@
%<package>\NeedsTeXFormat{LaTeX2e}
%<package>\ProvidesPackage{docshots}
%<*package>
-[2022-10-25 0.0.5 TeX Samples Next to Their PDF Snapshots in DTX]
+[2022-10-26 0.2.0 TeX Samples Next to Their PDF Snapshots in DTX]
%</package>
%<*driver>
\documentclass{ltxdoc}
@@ -128,13 +128,9 @@
% \begin{docshot}
% \documentclass{article}
% \usepackage{tikz}
-% \usetikzlibrary{backgrounds}
% \pagestyle{empty}
% \begin{document}
-% \begin{tikzpicture}[
-% show background rectangle,
-% background rectangle/.style=
-% {draw=none,fill=gray!20}]
+% \begin{tikzpicture}
% \node [circle,draw] (v0) {$v_0$};
% \node [circle,draw=orange,thick,
% below right of=v0] (v1) {$v_1$};
@@ -155,11 +151,11 @@
% When you render a text instead of a single picture, it's recommended to use
% \href{https://ctan.org/pkg/geometry}{geometry} package to change the size
-% of the page and then |empty| page style to remove page numbering:
+% of the page:
% \begin{docshot}
% \documentclass{article}
-% \usepackage[paperwidth=2in]{geometry}
-% \pagestyle{empty}
+% \usepackage[paperwidth=2in,
+% paperheight=2.2in]{geometry}
% \begin{document}
% ``There is no sadder thing than
% a young pessimist, except an old
@@ -166,6 +162,7 @@
% pessimist'' --- \emph{Mark Twain}
% \end{document}
% \end{docshot}
+% You can also use |\pagestyle{empty}| as was done in previous docshots.
% \section{Package Options}
@@ -230,6 +227,18 @@
%</verb>
%\fi
+% \DescribeMacro{nocrop}
+% You may disable cropping with the help of |nocrop| option:
+%\iffalse
+%<*verb>
+%\fi
+\begin{verbatim}
+\usepackage[nocrop]{docshot}
+\end{verbatim}
+%\iffalse
+%</verb>
+%\fi
+
% \DescribeMacro{hspace}
% The horizontal distance between the image and its verbatim \TeX{} source
% may be configured via |hspace| package option:
@@ -271,7 +280,7 @@
%\fi
% \DescribeMacro{tmpdir}
-% The default location of temp files is |\docshots at tmpdir|. You can change this using |tmpdir| option:
+% The default location of temp files is |_docshots|. You can change this using |tmpdir| option:
%\iffalse
%<*verb>
%\fi
@@ -448,17 +457,21 @@
% Then, we process package options:
% \changes{0.0.4}{2022/10/18}{Package options "lstinputlisting" and "inputminted" introduced to enable printing of verbatim text either via listings or minted packages.}
% \changes{0.0.5}{2022/10/24}{Package option "log" added, which enables detailed logging via exec. By default, there is no logging at all.}
+% \changes{0.2.0}{2022/10/26}{New package option "nocrop" added to allow disabling of "pdfcrop" execution.}
% \begin{macrocode}
\RequirePackage{pgfopts}
+\RequirePackage{ifluatex}
+\RequirePackage{ifxetex}
\def\docshots at log{}
\pgfkeys{
/docshots/.cd,
dtx/.store in=\docshots at dtx,
log/.code=\def\docshots at log{log},
+ nocrop/.code=\def\docshots at nocrop{},
lstinputlisting/.store in=\docshots at lstinputlisting,
inputminted/.store in=\docshots at inputminted,
tmpdir/.store in=\docshots at tmpdir,
- tmpdir/.default=_docshots,
+ tmpdir/.default=_docshots\ifxetex-xe\else\ifluatex-lua\fi\fi,
small/.store in=\docshots at small,
tiny/.store in=\docshots at tiny,
runs/.store in=\docshots at runs,
@@ -484,28 +497,39 @@
% Then, we print the version of |pdflatex| to \TeX{} log:
% \begin{macrocode}
-\iexec[\docshots at log,quiet]{\docshots at pdflatex\space --version}%
+\iexec[\docshots at log,quiet]{"\docshots at pdflatex" --version}%
% \end{macrocode}
% Then, we print the version of \href{https://ctan.org/pkg/pdfcrop}{pdfcrop} to \TeX{} log:
% \begin{macrocode}
-\iexec[\docshots at log,quiet]{\docshots at pdfcrop\space --version}%
+\ifdefined\docshots at nocrop\else%
+ \iexec[\docshots at log,quiet]{"\docshots at pdfcrop" --version}%
+\fi%
% \end{macrocode}
% Then, we print the version of |ghostscript| to \TeX{} log:
% \begin{macrocode}
-\iexec[\docshots at log,quiet]{\docshots at gs\space --version}%
+\iexec[\docshots at log,quiet]{"\docshots at gs" --version}%
% \end{macrocode}
% Then, we make a directory where all temporary files will be kept:
% \begin{macrocode}
-\iexec[null]{mkdir -p \docshots at tmpdir/\jobname}%
+\iexec[null]{mkdir -p "\docshots at tmpdir/\jobname"}%
% \end{macrocode}
+% \begin{macro}{\docshots at mdfive}
+% \changes{0.1.1}{2022/10/26}{New supplementary command added to calculate MD5 sum of a file.}
+% Then, we define a command for MD5 hash calculating of a file:
+% \begin{macrocode}
+\RequirePackage{pdftexcmds}
+\makeatletter\newcommand\docshots at mdfive[1]{\pdf at filemdfivesum{#1}}\makeatother
+% \end{macrocode}
+% \end{macro}
+
% \begin{macro}{docshot}
% Then, we define |docshot| environment:
% \begin{macrocode}
-\newenvironment{docshot}
+\makeatletter\newenvironment{docshot}
{\VerbatimEnvironment\begin{VerbatimOut}
{\docshots at tmpdir/\jobname/verbatim.tex}}
{\end{VerbatimOut}%
@@ -519,29 +543,34 @@
% \end{macrocode}
% We calculate MD5 hashsum of the file content:
% \begin{macrocode}
- \def\hash{\pdfmdfivesum file
- {\docshots at tmpdir/\jobname/verbatim.tex}}%
+ \def\hash{\docshots at mdfive{\docshots at 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|:
+% \changes{0.1.0}{2022/10/26}{The output is saved to a hash-named file, for better uniqueness of temporary files.}
% \begin{macrocode}
\IfFileExists{\docshots at tmpdir/\jobname/\hash.pdf}
- {\message{docshots: won't render, the PDF already exists
- (\docshots at tmpdir/\jobname/\hash.pdf)^^J}}
- {\iexec[\docshots at log,quiet]{cp \docshots at tmpdir/\jobname/verbatim.tex
- \docshots at tmpdir/\jobname/\hash.tex}%
- \foreach \n in {1,...,\docshots at runs}{
- \iexec[\docshots at log,quiet]{cd \docshots at tmpdir/\jobname;
- \docshots at pdflatex\space
+ {\message{docshots: Won't render,
+ the PDF '\docshots at tmpdir/\jobname/\hash.pdf' already exists^^J}}
+ {\iexec[\docshots at log,quiet]{cp "\docshots at tmpdir/\jobname/verbatim.tex"
+ "\docshots at tmpdir/\jobname/\hash.tex"}%
+ \foreach \n in {1,...,\docshots at runs}{%
+ \iexec[\docshots at log,
+ stdout=\docshots at tmpdir/\jobname/\hash.stdout,
+ exit=\docshots at tmpdir/\jobname/\hash.ret,
+ quiet,trace]{cd "\docshots at tmpdir/\jobname" &&
+ "\docshots at pdflatex"
-interaction=errorstopmode
-halt-on-error
-shell-escape
- \hash.tex}
- \message{docshots: pdflatex run no.\n^^J}
+ \hash.tex}%
+ \ifnum\n=1\else%
+ \message{docshots: pdflatex run no.\n^^J}%
+ \fi%
\IfFileExists{\docshots at tmpdir/\jobname/after.sh}
{\iexec[\docshots at log,quiet]{chmod a+x
- \docshots at tmpdir/\jobname/after.sh}
- \iexec[\docshots at log,quiet]{cd \docshots at tmpdir/\jobname;
+ "\docshots at tmpdir/\jobname/after.sh"}
+ \iexec[\docshots at log,quiet]{cd "\docshots at tmpdir/\jobname" &&
./after.sh \n\space \hash\space \hash.tex}}
{}}}%
% \end{macrocode}
@@ -548,23 +577,30 @@
% Here we delete |after.sh| which may exist here after the last
% compilation of |pdflatex|:
% \begin{macrocode}
- \iexec[\docshots at log,quiet]{rm -f \docshots at tmpdir/\jobname/after.sh}
+ \iexec[\docshots at log,quiet]{rm -f "\docshots at 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:
% \begin{macrocode}
\IfFileExists{\docshots at tmpdir/\jobname/\hash.crop.pdf}
- {\message{docshots: won't pdfcrop, the PDF already exists
- (\docshots at tmpdir/\jobname/\hash.crop.pdf)^^J}}
- {\iexec[\docshots at log,quiet]{\docshots at pdfcrop\space
- --margins \docshots at margin\space
- \docshots at tmpdir/\jobname/\hash.pdf
- \docshots at tmpdir/\jobname/\hash.crop.pdf}}%
+ {\message{docshots: Won't pdfcrop,
+ the PDF '\docshots at tmpdir/\jobname/\hash.crop.pdf'
+ already exists^^J}}
+ {\ifdefined\docshots at nocrop
+ \iexec[\docshots at log,quiet]{cp
+ "\docshots at tmpdir/\jobname/\hash.pdf"
+ "\docshots at tmpdir/\jobname/\hash.crop.pdf"}%
+ \else%
+ \iexec[\docshots at log,quiet]{"\docshots at pdfcrop"
+ --margins 0
+ "\docshots at tmpdir/\jobname/\hash.pdf"
+ "\docshots at tmpdir/\jobname/\hash.crop.pdf"}%
+ \fi}%
% \end{macrocode}
% We configure |fancyvrb|:
% \begin{macrocode}
\fvset{numbers=left,numbersep=3pt}%
- \fvset{frame=leftline,framerule=.4pt,rulecolor=\color{gray}}%
+ \fvset{frame=leftline,framerule=.2pt,rulecolor=\color{gray}}%
\fvset{samepage=true}%
\fvset{baselinestretch=1}%
\ifdefined\docshots at small%
@@ -574,12 +610,13 @@
\fvset{fontsize=\scriptsize}%
\fi%
% \end{macrocode}
-% We render the two column content:
+% Finally, we render the two-column content:
% \begin{macrocode}
\begingroup%
\par%
\tikz[baseline=(a.north)]
- \node (a) [draw=gray,inner sep=0]
+ \node (a) [draw=gray,inner sep=\docshots at margin,
+ line width=.2pt]
{\includegraphics[width=\docshots at left]
{\docshots at tmpdir/\jobname/\hash.crop.pdf}};%
\hspace{\docshots at hspace}%
@@ -597,7 +634,7 @@
\end{minipage}%
\par%
\endgroup%
-}
+}\makeatother
% \end{macrocode}
% \end{macro}
@@ -604,11 +641,11 @@
% \begin{macro}{\docshotPrerequisite}
% Then, we define |\docshotPrerequisite| command:
% \begin{macrocode}
-\newcommand\docshotPrerequisite[1]{
- \iexec[\docshots at log,quiet]{cp #1 \docshots at tmpdir/\jobname}%
- \message{docshots: file #1 copied to
- \docshots at tmpdir/\jobname/#1^^J}%
-}
+\makeatletter\newcommand\docshotPrerequisite[1]{
+ \iexec[\docshots at log,quiet]{cp #1 "\docshots at tmpdir/\jobname"}%
+ \message{docshots: File '#1' copied to
+ '\docshots at tmpdir/\jobname/#1'^^J}%
+}\makeatother
% \end{macrocode}
% \end{macro}
@@ -615,12 +652,12 @@
% \begin{macro}{\docshotAfter}
% Finally, we define |\docshotAfter| command:
% \begin{macrocode}
-\newcommand\docshotAfter[1]{
+\makeatletter\newcommand\docshotAfter[1]{
\iexec[\docshots at log,quiet]{/bin/echo -n '\detokenize{#1}'
- > \docshots at tmpdir/\jobname/after.sh}%
- \message{docshots: file
- \docshots at tmpdir/\jobname/after.sh created^^J}%
-}
+ > "\docshots at tmpdir/\jobname/after.sh"}%
+ \message{docshots: File
+ '\docshots at tmpdir/\jobname/after.sh' created^^J}%
+}\makeatother
% \end{macrocode}
% \end{macro}
Modified: trunk/Master/texmf-dist/tex/latex/docshots/docshots.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/docshots/docshots.sty 2022-10-26 19:59:50 UTC (rev 64819)
+++ trunk/Master/texmf-dist/tex/latex/docshots/docshots.sty 2022-10-26 20:00:20 UTC (rev 64820)
@@ -31,7 +31,7 @@
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{docshots}
-[2022-10-25 0.0.5 TeX Samples Next to Their PDF Snapshots in DTX]
+[2022-10-26 0.2.0 TeX Samples Next to Their PDF Snapshots in DTX]
@@ -58,6 +58,7 @@
+
\RequirePackage{iexec}
\RequirePackage{fancyvrb}
\RequirePackage{xcolor}
@@ -65,15 +66,18 @@
\RequirePackage{tikz}
\RequirePackage{pgfopts}
+\RequirePackage{ifluatex}
+\RequirePackage{ifxetex}
\def\docshots at log{}
\pgfkeys{
/docshots/.cd,
dtx/.store in=\docshots at dtx,
log/.code=\def\docshots at log{log},
+ nocrop/.code=\def\docshots at nocrop{},
lstinputlisting/.store in=\docshots at lstinputlisting,
inputminted/.store in=\docshots at inputminted,
tmpdir/.store in=\docshots at tmpdir,
- tmpdir/.default=_docshots,
+ tmpdir/.default=_docshots\ifxetex-xe\else\ifluatex-lua\fi\fi,
small/.store in=\docshots at small,
tiny/.store in=\docshots at tiny,
runs/.store in=\docshots at runs,
@@ -96,15 +100,20 @@
}
\ProcessPgfOptions{/docshots}
-\iexec[\docshots at log,quiet]{\docshots at pdflatex\space --version}%
+\iexec[\docshots at log,quiet]{"\docshots at pdflatex" --version}%
-\iexec[\docshots at log,quiet]{\docshots at pdfcrop\space --version}%
+\ifdefined\docshots at nocrop\else%
+ \iexec[\docshots at log,quiet]{"\docshots at pdfcrop" --version}%
+\fi%
-\iexec[\docshots at log,quiet]{\docshots at gs\space --version}%
+\iexec[\docshots at log,quiet]{"\docshots at gs" --version}%
-\iexec[null]{mkdir -p \docshots at tmpdir/\jobname}%
+\iexec[null]{mkdir -p "\docshots at tmpdir/\jobname"}%
-\newenvironment{docshot}
+\RequirePackage{pdftexcmds}
+\makeatletter\newcommand\docshots at mdfive[1]{\pdf at filemdfivesum{#1}}\makeatother
+
+\makeatletter\newenvironment{docshot}
{\VerbatimEnvironment\begin{VerbatimOut}
{\docshots at tmpdir/\jobname/verbatim.tex}}
{\end{VerbatimOut}%
@@ -112,37 +121,48 @@
\iexec[null]{perl -i -0777pe "s/(\\n|^)\\x{25} /\\1/g"
\docshots at tmpdir/\jobname/verbatim.tex}%
\fi%
- \def\hash{\pdfmdfivesum file
- {\docshots at tmpdir/\jobname/verbatim.tex}}%
+ \def\hash{\docshots at mdfive{\docshots at tmpdir/\jobname/verbatim.tex}}%
\IfFileExists{\docshots at tmpdir/\jobname/\hash.pdf}
- {\message{docshots: won't render, the PDF already exists
- (\docshots at tmpdir/\jobname/\hash.pdf)^^J}}
- {\iexec[\docshots at log,quiet]{cp \docshots at tmpdir/\jobname/verbatim.tex
- \docshots at tmpdir/\jobname/\hash.tex}%
- \foreach \n in {1,...,\docshots at runs}{
- \iexec[\docshots at log,quiet]{cd \docshots at tmpdir/\jobname;
- \docshots at pdflatex\space
+ {\message{docshots: Won't render,
+ the PDF '\docshots at tmpdir/\jobname/\hash.pdf' already exists^^J}}
+ {\iexec[\docshots at log,quiet]{cp "\docshots at tmpdir/\jobname/verbatim.tex"
+ "\docshots at tmpdir/\jobname/\hash.tex"}%
+ \foreach \n in {1,...,\docshots at runs}{%
+ \iexec[\docshots at log,
+ stdout=\docshots at tmpdir/\jobname/\hash.stdout,
+ exit=\docshots at tmpdir/\jobname/\hash.ret,
+ quiet,trace]{cd "\docshots at tmpdir/\jobname" &&
+ "\docshots at pdflatex"
-interaction=errorstopmode
-halt-on-error
-shell-escape
- \hash.tex}
- \message{docshots: pdflatex run no.\n^^J}
+ \hash.tex}%
+ \ifnum\n=1\else%
+ \message{docshots: pdflatex run no.\n^^J}%
+ \fi%
\IfFileExists{\docshots at tmpdir/\jobname/after.sh}
{\iexec[\docshots at log,quiet]{chmod a+x
- \docshots at tmpdir/\jobname/after.sh}
- \iexec[\docshots at log,quiet]{cd \docshots at tmpdir/\jobname;
+ "\docshots at tmpdir/\jobname/after.sh"}
+ \iexec[\docshots at log,quiet]{cd "\docshots at tmpdir/\jobname" &&
./after.sh \n\space \hash\space \hash.tex}}
{}}}%
- \iexec[\docshots at log,quiet]{rm -f \docshots at tmpdir/\jobname/after.sh}
+ \iexec[\docshots at log,quiet]{rm -f "\docshots at tmpdir/\jobname/after.sh"}
\IfFileExists{\docshots at tmpdir/\jobname/\hash.crop.pdf}
- {\message{docshots: won't pdfcrop, the PDF already exists
- (\docshots at tmpdir/\jobname/\hash.crop.pdf)^^J}}
- {\iexec[\docshots at log,quiet]{\docshots at pdfcrop\space
- --margins \docshots at margin\space
- \docshots at tmpdir/\jobname/\hash.pdf
- \docshots at tmpdir/\jobname/\hash.crop.pdf}}%
+ {\message{docshots: Won't pdfcrop,
+ the PDF '\docshots at tmpdir/\jobname/\hash.crop.pdf'
+ already exists^^J}}
+ {\ifdefined\docshots at nocrop
+ \iexec[\docshots at log,quiet]{cp
+ "\docshots at tmpdir/\jobname/\hash.pdf"
+ "\docshots at tmpdir/\jobname/\hash.crop.pdf"}%
+ \else%
+ \iexec[\docshots at log,quiet]{"\docshots at pdfcrop"
+ --margins 0
+ "\docshots at tmpdir/\jobname/\hash.pdf"
+ "\docshots at tmpdir/\jobname/\hash.crop.pdf"}%
+ \fi}%
\fvset{numbers=left,numbersep=3pt}%
- \fvset{frame=leftline,framerule=.4pt,rulecolor=\color{gray}}%
+ \fvset{frame=leftline,framerule=.2pt,rulecolor=\color{gray}}%
\fvset{samepage=true}%
\fvset{baselinestretch=1}%
\ifdefined\docshots at small%
@@ -154,7 +174,8 @@
\begingroup%
\par%
\tikz[baseline=(a.north)]
- \node (a) [draw=gray,inner sep=0]
+ \node (a) [draw=gray,inner sep=\docshots at margin,
+ line width=.2pt]
{\includegraphics[width=\docshots at left]
{\docshots at tmpdir/\jobname/\hash.crop.pdf}};%
\hspace{\docshots at hspace}%
@@ -172,20 +193,20 @@
\end{minipage}%
\par%
\endgroup%
-}
+}\makeatother
-\newcommand\docshotPrerequisite[1]{
- \iexec[\docshots at log,quiet]{cp #1 \docshots at tmpdir/\jobname}%
- \message{docshots: file #1 copied to
- \docshots at tmpdir/\jobname/#1^^J}%
-}
+\makeatletter\newcommand\docshotPrerequisite[1]{
+ \iexec[\docshots at log,quiet]{cp #1 "\docshots at tmpdir/\jobname"}%
+ \message{docshots: File '#1' copied to
+ '\docshots at tmpdir/\jobname/#1'^^J}%
+}\makeatother
-\newcommand\docshotAfter[1]{
+\makeatletter\newcommand\docshotAfter[1]{
\iexec[\docshots at log,quiet]{/bin/echo -n '\detokenize{#1}'
- > \docshots at tmpdir/\jobname/after.sh}%
- \message{docshots: file
- \docshots at tmpdir/\jobname/after.sh created^^J}%
-}
+ > "\docshots at tmpdir/\jobname/after.sh"}%
+ \message{docshots: File
+ '\docshots at tmpdir/\jobname/after.sh' created^^J}%
+}\makeatother
More information about the tex-live-commits
mailing list.