summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2022-11-10 20:22:21 +0000
committerKarl Berry <karl@freefriends.org>2022-11-10 20:22:21 +0000
commit7f94dd88b995283814387ca983c4cbd435772707 (patch)
tree000b726f869eb1214b42c6cc262d4842912a132e
parent7cb25d7fe89465ed8e77165b04740601f1437449 (diff)
docshots (10nov22)
git-svn-id: svn://tug.org/texlive/trunk@64986 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/latex/docshots/README.md2
-rw-r--r--Master/texmf-dist/doc/latex/docshots/docshots.pdfbin338306 -> 340307 bytes
-rw-r--r--Master/texmf-dist/source/latex/docshots/docshots.dtx55
-rw-r--r--Master/texmf-dist/tex/latex/docshots/docshots.sty22
4 files changed, 65 insertions, 14 deletions
diff --git a/Master/texmf-dist/doc/latex/docshots/README.md b/Master/texmf-dist/doc/latex/docshots/README.md
index 17a6693a35f..839ad7a513c 100644
--- a/Master/texmf-dist/doc/latex/docshots/README.md
+++ b/Master/texmf-dist/doc/latex/docshots/README.md
@@ -28,7 +28,7 @@ For more informaiton, read \TeX{} Book by Donald Knuth.
\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.
+Otherwise, you can download [`docshots.sty`](https://raw.githubusercontent.com/yegor256/docshots/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.
diff --git a/Master/texmf-dist/doc/latex/docshots/docshots.pdf b/Master/texmf-dist/doc/latex/docshots/docshots.pdf
index 9d94d44dee0..9b4f1afa94d 100644
--- a/Master/texmf-dist/doc/latex/docshots/docshots.pdf
+++ b/Master/texmf-dist/doc/latex/docshots/docshots.pdf
Binary files differ
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
diff --git a/Master/texmf-dist/tex/latex/docshots/docshots.sty b/Master/texmf-dist/tex/latex/docshots/docshots.sty
index 56f47c48ec3..8d77d73edcf 100644
--- a/Master/texmf-dist/tex/latex/docshots/docshots.sty
+++ b/Master/texmf-dist/tex/latex/docshots/docshots.sty
@@ -31,7 +31,11 @@
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{docshots}
-[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]
+
+
+
+
@@ -182,17 +186,21 @@
\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
\makeatletter\newcommand\docshotPrerequisite[1]{
@@ -208,6 +216,12 @@
'\docshots@tmpdir/\jobname/after.sh' created^^J}%
}\makeatother
+\makeatletter
+\gdef\docshots@opts{}
+\newcommand\docshotOptions[1]{%
+ \gdef\docshots@opts{#1}%
+}\makeatother
+
\endinput