summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2022-05-27 20:41:15 +0000
committerKarl Berry <karl@freefriends.org>2022-05-27 20:41:15 +0000
commit77061c35b4d54a630fe1ab1381cffb09611b8f5e (patch)
tree701480eb65280654fd3c7e01317327c966c38821 /Master/texmf-dist/tex
parenta0a752c86b459166c18bc676e93192c99fe4c455 (diff)
hvextern (27may22)
git-svn-id: svn://tug.org/texlive/trunk@63412 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r--Master/texmf-dist/tex/latex/hvextern/hvextern.sty111
1 files changed, 58 insertions, 53 deletions
diff --git a/Master/texmf-dist/tex/latex/hvextern/hvextern.sty b/Master/texmf-dist/tex/latex/hvextern/hvextern.sty
index 8b0fa75f1f4..19f14ec67fe 100644
--- a/Master/texmf-dist/tex/latex/hvextern/hvextern.sty
+++ b/Master/texmf-dist/tex/latex/hvextern/hvextern.sty
@@ -1,3 +1,4 @@
+%% $Id: hvextern.sty 559 2022-05-27 06:59:29Z herbert $
%% This is file `hvextern.sty',
%%
%% Copyright (C) 2016-22
@@ -11,8 +12,8 @@
%% and version 1.3c or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
-\def\hvexternFileversion{0.26}
-\ProvidesFile{hvextern}[2022/05/23 v\hvexternFileversion: package for running external documents (HV)]
+\def\hvexternFileversion{0.27}
+\ProvidesFile{hvextern}[2022/05/27 v\hvexternFileversion: package for running external documents (HV)]
\RequirePackage{shellesc,xkeyval,graphicx}
\RequirePackage{fancyvrb,tikz,listings,ifplatform}
@@ -30,6 +31,7 @@
\newcounter{hv@extern@runs}
\newcounter{@@@runs}
+\newcounter{hv@extern@pageCNT}
\newsavebox\hv@extern@box
\newlength\hv@LineWidth
\newlength\hv@TextWidth
@@ -42,7 +44,7 @@
\newlength\hv@extern@belowskip
\newlength\hv@extern@shiftFN
-\AtBeginDocument{\setlength\hv@LineWidth{\dimexpr\linewidth-2\fboxsep-2\fboxrule}}
+\AtBeginDocument{\setlength\hv@LineWidth{\the\dimexpr\linewidth-2\fboxsep-2\fboxrule\relax}}
\newlength\hv@extern@mpwidth \setlength\hv@extern@mpwidth{\z@}
\define@key{hv}{progpath}{\def\hv@extern@progpath{#1}}
@@ -57,7 +59,7 @@
\define@key{hv}{BObody}[black!8]{\def\hv@extern@BObody{#1}}
\define@key{hv}{docType}[latex]{\def\hv@extern@docType{#1}}
%\define@choicekey*+{hv}{docType}[\val\nr]{latex,mp,tex,py,pl,lua,java,context,sh}[latex]{%
-% \hv@typeout{>>>> ´doc type \nr}%
+% \hv@typeout{doc type \nr}%
% \def\hv@extern@docType{\val}%
%}{\PackageWarning{hvextern}{erroneous input (#1) for docType ignored. Using latex.}%
% \def\hv@extern@docType{latex}%
@@ -101,10 +103,11 @@
}
\define@boolkey{hv}[hv@extern@]{eps}[true]{}
\define@boolkey{hv}[hv@extern@]{verbose}[true]{}
-\def\hv@typeout#1{\ifhv@extern@verbose\typeout{#1}\fi}
+\def\hv@ex@typeout#1{\ifhv@extern@verbose\typeout{>>(hvextern) #1}\fi}
+
\define@choicekey*+{hv}{compiler}[\val\nr]{mpost,tex,latex,luatex,python3,perl,lua,java,%
xetex,pdflatex,lualatex,xelatex,context,sh,texlua}[pdflatex]{%
- \hv@typeout{>>>> Compiler type \nr}%
+ \hv@ex@typeout{Compiler type \nr}%
\def\hv@extern@compiler{\val}%
\edef\hv@extern@compilerNo{\nr}%
}{\PackageWarning{hvextern}{erroneous input (#1) for compiler ignored. Using pdflatex.}%
@@ -194,7 +197,7 @@
{
\clist_map_inline:nn {#1}{%
\ShellEscape{\hv@extern@progpath##1\space\hvExternDateiname}
- %\hv@typeout{>>>> sequencerun: ##1}
+ %\hv@ex@typeout{sequencerun: ##1}
}
}
\ExplSyntaxOff
@@ -203,10 +206,10 @@
\tcbset{breakable,left=2pt,right=2pt,top=2pt,bottom=2pt,boxsep=0pt}
\def\hv@marginpar#1{%
- \leavevmode\checkoddpage
- \sbox\hv@extern@box{\rotatebox[origin=C]{90}{\rule{2\hv@extern@shiftFN}{0pt}#1}}%
+ \sbox\hv@extern@box{\rotatebox[origin=C]{90}{\rule{2\hv@extern@shiftFN}{0pt}\texttt{#1}}}%
\ht\hv@extern@box=\z@ \wd\hv@extern@box=\z@ \dp\hv@extern@box=\z@
\noindent
+ \checkoddpage
\ifoddpage% we have a right page
\if@twocolumn
\ifhv@extern@outerFN
@@ -239,23 +242,23 @@
}
\newcommand\PreambleVerbatim[2][]{%
- \hv@typeout{Running PreambleVerbatim with #1, #2}%
+ \hv@ex@typeout{Running PreambleVerbatim with #1, #2}%
\ifhv@extern@tcbox
\begin{tcolorbox}[before skip=0pt,after skip=0pt]\VerbatimInput[#1]{#2}\end{tcolorbox}%
\else
- \VerbatimInput[#1]{#2}
+ \VerbatimInput[#1]{#2}%
\fi}
\newcommand\BodyVerbatim[2][]{%
- \hv@typeout{Running BodyVerbatim with #1, #2}%
+ \hv@ex@typeout{Running BodyVerbatim with #1, #2}%
\ifhv@extern@tcbox
\begin{tcolorbox}[before skip=0pt,after skip=0pt]\VerbatimInput[#1]{#2}\end{tcolorbox}%
\else
- \VerbatimInput[#1]{#2}
+ \VerbatimInput[#1]{#2}%
\fi}
\newcommand\PreambleListing[2][]{%
- \hv@typeout{Running PreambleListing with #1, #2}%
+ \hv@ex@typeout{Running PreambleListing with #1, #2}%
\ifhv@extern@tcbox
\begin{tcolorbox}[before skip=0pt,after skip=0pt%,top=-2pt
]\expandafter\lstinputlisting\expandafter[#1,aboveskip=0pt,belowskip=0pt]{#2}\end{tcolorbox}%
@@ -264,7 +267,7 @@
\fi}
\newcommand\BodyListing[2][]{%
- \hv@typeout{Running BodyListing with #1, #2}%
+ \hv@ex@typeout{Running BodyListing with #1, #2}%
\ifhv@extern@tcbox
\begin{tcolorbox}[before skip=0pt,after skip=0pt,%top=-2pt
]\expandafter\lstinputlisting\expandafter[#1,aboveskip=0pt,belowskip=0pt]{#2}\end{tcolorbox}%
@@ -291,13 +294,13 @@
{\perCent StopVisiblePreamble}
\def\hv@extern@runMP#1#2#3#4{% path compiler file extension
- \hv@typeout{>>>> running #1#2 #3#4}%
+ \hv@ex@typeout{running #1#2 #3#4}%
\ShellEscape{#1#2\space -tex=tex\space #3#4}%
- \hv@typeout{>>>> running #1tex #3}%
+ \hv@ex@typeout{running #1tex #3}%
\ShellEscape{#1tex\space "\string\input\space epsf\string\relax\string\nopagenumbers\string\epsfbox{#3.1}\string\bye"}%
- \hv@typeout{>>>> running #1dvips #3}%
+ \hv@ex@typeout{running #1dvips #3}%
\ShellEscape{#1dvips\space -j\space -E\space -o\space #3.eps\space epsf.dvi}%
- \hv@typeout{>>>> running #1epstopdf #3}%
+ \hv@ex@typeout{running #1epstopdf #3}%
\ShellEscape{#1epstopdf\space #3.eps}%
}
@@ -310,11 +313,11 @@
{\perCent StopVisiblePreamble}
\def\hv@extern@runTEX#1#2#3#4{% path compiler file extension
- \hv@typeout{>>>> running #1#2 #3#4}%
+ \hv@ex@typeout{running #1#2 #3#4}%
\ShellEscape{#1tex\space #3#4}%
- \hv@typeout{>>>> running #1dvips #3}%
+ \hv@ex@typeout{running #1dvips #3}%
\ShellEscape{#1dvips\space #3.dvi}%
- \hv@typeout{>>>> running ps2pdf #3.ps}%
+ \hv@ex@typeout{running ps2pdf #3.ps}%
\ShellEscape{#1ps2pdf\space -dAutoRotatePages=/None\space -dALLOWPSTRANSPARENCY\space #3.ps}%
}
@@ -328,11 +331,11 @@
% only for the sequence latex->dvips->ps2pdf
\def\hv@extern@runLATEX#1#2#3#4{% path-compiler-file-extension
- \hv@typeout{>>>> running #1#2 #3#4}%
+ \hv@ex@typeout{running #1#2 #3#4}%
\ShellEscape{#1#2\space #3#4}%
- \hv@typeout{>>>> running #1dvips #3}%
+ \hv@ex@typeout{running #1dvips #3}%
\ShellEscape{#1dvips\space #3.dvi}%
- \hv@typeout{>>>> running ps2pdf #3.ps}%
+ \hv@ex@typeout{running ps2pdf #3.ps}%
\ShellEscape{#1ps2pdf\space -dAutoRotatePages=/None\space -dALLOWPSTRANSPARENCY\space #3.ps}%
}
@@ -398,47 +401,47 @@
\xdef\hvExternDateiname{#2-\arabic{hv@example@counter}}%
\gdef\hv@extern@savePara{#1}%
\setkeys{hv}{#1}% \begin
- \hv@typeout{External filename: \hvExternDateiname}%
+ \hv@ex@typeout{External filename: \hvExternDateiname}%
\expandafter\IfFileExists\expandafter{\hv@extern@ExamplesDir\hvExternDateiname.pdf}{}{%
\expandafter\IfFileExists\expandafter{\hv@extern@ExamplesDir\hvExternDateiname.png}{}{%
\expandafter\IfFileExists\expandafter{\hv@extern@ExamplesDir\hvExternDateiname.txt}{}{%
\global\hv@extern@forcetrue}}}% set force, if no pdf or png exists
\begingroup
- \hv@typeout{>>> writing file \hvExternDateiname\hv@extern@ext ...}%
+ \hv@ex@typeout{writing file \hvExternDateiname\hv@extern@ext ...}%
\filecontents[force,noheader]{\hvExternDateiname\hv@extern@ext}%
}
{\endfilecontents% \end%
- \hv@typeout{>>> ... done}%
+ \hv@ex@typeout{... done}%
\global\stepcounter{hv@example@counter}%
\endgroup
\expandafter\hvExternSetKeys\expandafter{\hv@extern@savePara}%
\xdef\hv@extern@fullPath{\hv@extern@ExamplesDir\hvExternDateiname}%
\ifhv@extern@force
\ifx\hv@extern@runsequence\@empty
- \hv@typeout{>>>> force=true: running \hv@extern@progpath\hv@extern@compiler~ \hvExternDateiname\hv@extern@ext ...}%
+ \hv@ex@typeout{force=true: running \hv@extern@progpath\hv@extern@compiler~ \hvExternDateiname\hv@extern@ext ...}%
\setcounter{@@@runs}{\value{hv@extern@runs}}%
\loop\ifnum\the@@@runs > 0\relax
\ifcase\hv@extern@compilerNo \relax % we have metapost
- \hv@typeout{>>>> running mpost \hvExternDateiname\hv@extern@ext}%
+ \hv@ex@typeout{running mpost \hvExternDateiname\hv@extern@ext}%
\hv@extern@runMP{\hv@extern@progpath}{\hv@extern@compiler}{\hvExternDateiname}{\hv@extern@ext}%
\or %1
- \hv@typeout{>>>> running tex \hvExternDateiname\hv@extern@ext}%
+ \hv@ex@typeout{running tex \hvExternDateiname\hv@extern@ext}%
\hv@extern@runTEX{\hv@extern@progpath}{\hv@extern@compiler}{\hvExternDateiname}{\hv@extern@ext}%
\or %2
- \hv@typeout{>>>> running \hv@extern@compiler~ \hvExternDateiname\hv@extern@ext}%
+ \hv@ex@typeout{running \hv@extern@compiler~ \hvExternDateiname\hv@extern@ext}%
\hv@extern@runLATEX{\hv@extern@progpath}{\hv@extern@compiler}{\hvExternDateiname}{\hv@extern@ext}%
\else
\ifhv@extern@redirect
- \hv@typeout{>>>> running \hv@extern@compiler~ \hvExternDateiname\hv@extern@ext > \hvExternDateiname.txt}%
+ \hv@ex@typeout{running \hv@extern@compiler~ \hvExternDateiname\hv@extern@ext > \hvExternDateiname.txt}%
\ShellEscape{\hv@extern@progpath\hv@extern@compiler\space\hvExternDateiname\hv@extern@ext\space > \hvExternDateiname.txt}%
\else
- \hv@typeout{>>>> running \hv@extern@compiler~ \hvExternDateiname\hv@extern@ext}%
+ \hv@ex@typeout{running \hv@extern@compiler~ \hvExternDateiname\hv@extern@ext}%
\ShellEscape{\hv@extern@progpath\hv@extern@compiler\space\hvExternDateiname\hv@extern@ext}%
\fi
\fi
\addtocounter{@@@runs}{-1}%
\repeat
- \hv@typeout{>>> ... done}%
+ \hv@ex@typeout{... done}%
\ifhv@extern@biber
\ShellEscape{biber \hvExternDateiname}% NAch biber nochmal latex
\ShellEscape{\hv@extern@progpath\hv@extern@compiler\space\hvExternDateiname}%
@@ -457,9 +460,11 @@
\ifhv@extern@eps
\ShellEscape{pdftops -eps -f 1 -l 1 \hvExternDateiname.pdf}%
\fi
+ \else
+ \hv@ex@typeout{force=false: NOT running \hvExternDateiname\hv@extern@ext ...}%
\fi% end force
\ifhv@extern@code%-------------- Code Part
- \hv@typeout{>>>>Starting Code part with preamble ...}%
+ \hv@ex@typeout{Starting Code part with preamble ...}%
\begingroup
\if@twocolumn
\ifhv@extern@outerFN
@@ -472,6 +477,7 @@
\fi
\ifdim\hv@extern@mpwidth>\z@
\noindent
+ \tcbset{breakable=false}%
\minipage[\hv@extern@mpvalign]{\hv@extern@mpwidth}
\vspace{0pt}%
\else
@@ -499,12 +505,12 @@
\fi
\fi
\ifhv@extern@showFilename
- \hv@typeout{>>>> Set filename in the margin!}%
+ \hv@ex@typeout{Set filename in the margin!}%
\noindent
\hv@marginpar{\hvExternDateiname\hv@extern@ext}%
\fi
%
- \hv@typeout{>>>>Starting Code body ...}%}
+ \hv@ex@typeout{Starting Code body ...}%}
\ifhv@extern@usefancyvrb
\@nameuse{\hv@extern@docType @initTextFancy}%
\expandafter\fvset\expandafter{\hv@extern@lstOptions}%
@@ -521,15 +527,15 @@
\fi % end code part
\ifhv@extern@code\else % only if no code
\ifhv@extern@showFilename
- \hv@typeout{>>>> Set filename in the margin!}%
+ \hv@ex@typeout{Set filename in the margin!}%
\noindent
\hv@marginpar{\hvExternDateiname\hv@extern@ext}%
\fi
\fi
\ifhv@extern@moveToExampleDir
% \ShellEscape{mkdir\space\hv@extern@ExamplesDir/}%
- \hv@typeout{>>>> Move file into example dir}%
- \hv@typeout{>>>>>>\hvExternDateiname ----> \hv@extern@ExamplesDir}%
+ \hv@ex@typeout{Move file into example dir}%
+ \hv@ex@typeout{\hvExternDateiname ----> \hv@extern@ExamplesDir}%
\ShellEscape{\hv@move \hvExternDateiname.*\space \hv@extern@ExamplesDir}%
\fi
\ifhv@extern@includegraphic
@@ -537,10 +543,10 @@
\expandafter\includegraphics\expandafter[\hv@extern@grfOptions]{\hv@extern@fullPath}%
\else
\ifhv@extern@float
- \hv@typeout{>>>> Floating environment}%
+ \hv@ex@typeout{Floating environment}%
\expandafter\figure\expandafter[\hv@extern@floatsetting]
\else
- \hv@typeout{>>>> No floating environment}%
+ \hv@ex@typeout{No floating environment}%
\vspace{\hv@extern@belowbodyskip}
\ifdim\hv@extern@mpwidth>\z@
\hfill\minipage[\hv@extern@mpvalign]{\dimexpr\linewidth-\hv@extern@mpwidth-1em\relax}\vspace{0pt}%
@@ -550,29 +556,28 @@
\fi
\fi
\hv@extern@align
- \hv@typeout{>>>> Input image \hv@extern@fullPath}%
+ \hv@ex@typeout{Input image \hv@extern@fullPath}%
\ifhv@extern@frame
\begingroup
\fboxsep=\hv@extern@framesep
\expandafter\@for\expandafter\next\expandafter:\expandafter=\hv@extern@pages\do{%
- \hv@typeout{>>>> Image loop: next=\next\space \hv@extern@fullPath}%
\fbox{\expandafter\includegraphics\expandafter[\hv@extern@grfOptions,page=\next]%
{\hv@extern@fullPath}}\hspace{\hv@extern@pagesep}}%
\hspace*{-\hv@extern@pagesep}%
\endgroup
\else
\expandafter\@for\expandafter\next\expandafter:\expandafter=\hv@extern@pages\do{%
- \hv@typeout{>>>> Image loop: next=\next\space \hv@extern@fullPath}%
\expandafter\includegraphics\expandafter[\hv@extern@grfOptions,page=\next]%
{\hv@extern@fullPath}\hspace{\hv@extern@pagesep}}%
\hspace*{-\hv@extern@pagesep}%
\fi
+ \par% for \hv@extern@align
\ifx\hv@extern@caption\@empty\else\caption{\hv@extern@caption}\fi
\ifx\hv@extern@label\@empty\else\label{\hv@extern@label}\fi
\ifhv@extern@float
\endfigure
\else
- \ifdim\hv@extern@mpwidth>\z@ \endminipage\else\unskip\strut\par\endgroup\fi
+ \ifdim\hv@extern@mpwidth>\z@ \endminipage\else\endgroup\fi
\fi
\fi
\else% no graphic, only text
@@ -585,7 +590,7 @@
\fi
\endminipage
\else
- \vspace{\hv@extern@belowbodyskip}
+ \vspace{\hv@extern@belowbodyskip}%
\noindent
\ifhv@extern@usefancyvrb
\expandafter\VerbatimInput\expandafter[\hv@extern@textOptions]{\hv@extern@fullPath.txt}%
@@ -603,7 +608,7 @@
\setkeys{hv}{code=false,includegraphic=false,#1}%
\xdef\hvExternDateiname{#3-\arabic{hv@example@counter}}%
\xdef\hv@extern@fullPath{\hv@extern@ExamplesDir\hvExternDateiname}%
- \hv@typeout{>>>> running #2}%
+ \hv@ex@typeout{running #2}%
\ifhv@extern@redirect
\ShellEscape{\hv@extern@progpath#2 > \hv@extern@ExamplesDir\hvExternDateiname.txt}%
\else
@@ -616,14 +621,14 @@
\expandafter\includegraphics\expandafter[\hv@extern@grfOptions]{\hv@extern@ExamplesDir\hvExternDateiname}%
\else
\ifhv@extern@float
- \hv@typeout{>>>> Floating environment}%
+ \hv@ex@typeout{Floating environment}%
\expandafter\figure\expandafter[\hv@extern@floatsetting]
\else
- \hv@typeout{>>>> No floating environment}%
+ \hv@ex@typeout{No floating environment}%
\par\noindent\begingroup
\fi
\hv@extern@align
- \hv@typeout{>>>> Input image \hv@extern@ExamplesDir\hvExternDateiname}%
+ \hv@ex@typeout{Input image \hv@extern@ExamplesDir\hvExternDateiname}%
\ifhv@extern@frame
\begingroup
\fboxsep=\hv@extern@framesep
@@ -646,7 +651,7 @@
\fi
\else% no graphic, only text
\ifhv@extern@float
- \hv@typeout{>>>> Floating environment}%
+ \hv@ex@typeout{Floating environment}%
\expandafter\figure\expandafter[!htb]
\ifhv@extern@usefancyvrb
\expandafter\BodyVerbatim\expandafter[\hv@extern@lstOptions]{\hv@extern@fullPath.txt}