summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2022-06-02 19:59:29 +0000
committerKarl Berry <karl@freefriends.org>2022-06-02 19:59:29 +0000
commit2cd2e4d6222a13277decca1df352460a3db27038 (patch)
tree99ae67d1dc737e1d6ddf5b78dce207c54a42d92f /Master/texmf-dist/tex
parent4a7cfffc15507745d4304e7870a1cd248ecc93d4 (diff)
hvextern (2jun22)
git-svn-id: svn://tug.org/texlive/trunk@63475 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r--Master/texmf-dist/tex/latex/hvextern/hvextern.sty251
1 files changed, 131 insertions, 120 deletions
diff --git a/Master/texmf-dist/tex/latex/hvextern/hvextern.sty b/Master/texmf-dist/tex/latex/hvextern/hvextern.sty
index 19f14ec67fe..62c61d549ef 100644
--- a/Master/texmf-dist/tex/latex/hvextern/hvextern.sty
+++ b/Master/texmf-dist/tex/latex/hvextern/hvextern.sty
@@ -1,4 +1,4 @@
-%% $Id: hvextern.sty 559 2022-05-27 06:59:29Z herbert $
+%% $Id: hvextern.sty 562 2022-06-01 15:37:46Z herbert $
%% This is file `hvextern.sty',
%%
%% Copyright (C) 2016-22
@@ -12,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.27}
-\ProvidesFile{hvextern}[2022/05/27 v\hvexternFileversion: package for running external documents (HV)]
+\def\hvexternFileversion{0.28}
+\ProvidesFile{hvextern}[2022/06/01 v\hvexternFileversion: package for running external documents (HV)]
\RequirePackage{shellesc,xkeyval,graphicx}
\RequirePackage{fancyvrb,tikz,listings,ifplatform}
@@ -33,7 +33,6 @@
\newcounter{@@@runs}
\newcounter{hv@extern@pageCNT}
\newsavebox\hv@extern@box
-\newlength\hv@LineWidth
\newlength\hv@TextWidth
\newlength\hv@extern@pagesep
\newlength\hv@extern@mpsep
@@ -44,7 +43,9 @@
\newlength\hv@extern@belowskip
\newlength\hv@extern@shiftFN
-\AtBeginDocument{\setlength\hv@LineWidth{\the\dimexpr\linewidth-2\fboxsep-2\fboxrule\relax}}
+\newlength\hvExternLineWidth
+\AtBeginDocument{\hvExternLineWidth=\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}}
@@ -86,6 +87,7 @@
\define@boolkey{hv}[hv@extern@]{xindex}[true]{}
\define@key{hv}{xindexOptions}[]{\def\hv@extern@xindexOptions{#1}}
\define@boolkey{hv}[hv@extern@]{includegraphic}[true]{}
+\define@boolkey{hv}[hv@extern@]{output}[true]{}
\define@boolkey{hv}[hv@extern@]{inline}[true]{\hv@extern@codefalse\hv@extern@showFilenamefalse}
\define@boolkey{hv}[hv@extern@]{frame}[true]{}
\define@key{hv}{framesep}[\the\fboxsep]{\setlength\hv@extern@framesep{#1}}
@@ -107,12 +109,12 @@
\define@choicekey*+{hv}{compiler}[\val\nr]{mpost,tex,latex,luatex,python3,perl,lua,java,%
xetex,pdflatex,lualatex,xelatex,context,sh,texlua}[pdflatex]{%
- \hv@ex@typeout{Compiler type \nr}%
+ \hv@ex@typeout{Compiler type (\nr) \val}%
\def\hv@extern@compiler{\val}%
\edef\hv@extern@compilerNo{\nr}%
-}{\PackageWarning{hvextern}{erroneous input (#1) for compiler ignored. Using pdflatex.}%
- \def\hv@extern@compiler{pdflatex}%
- \def\hv@extern@compilerNo{9}%
+}{\PackageWarning{hvextern}{unknown compiler type (#1). Maybe you should define a run sequence???}%
+ \def\hv@extern@compiler{#1}%
+ \def\hv@extern@compilerNo{-1}%
}
\define@key{hv}{aboveskip}[\medskipamount]{\setlength\hv@extern@aboveskip{#1}}
\define@key{hv}{belowpreambleskip}[\smallskipamount]{\setlength\hv@extern@belowpreambleskip{#1}}
@@ -139,6 +141,7 @@
BGbody=black!8,% Backgroundcolor for body
BOpreamble=black!12,% Bodercolor for preamble
BObody=black!8,% Bodercolor for body
+ output=true,% with false only code is shown
includegraphic=true,% Grafik einbinden oder User überlassen
inline=false,% Grafik nicht in derselben Zeile
runs=1,% Anzahl Compiler-Durchläufe
@@ -196,8 +199,8 @@
\NewDocumentCommand\run@hv@extern@sequenceList{ m }
{
\clist_map_inline:nn {#1}{%
- \ShellEscape{\hv@extern@progpath##1\space\hvExternDateiname}
- %\hv@ex@typeout{sequencerun: ##1}
+ \hv@ex@typeout{sequencerun: ##1}%
+ \ShellEscape{\hv@extern@progpath##1\space\hvExternDateiname}%
}
}
\ExplSyntaxOff
@@ -205,6 +208,7 @@
\lstset{belowskip=0pt,aboveskip=0pt}% global
\tcbset{breakable,left=2pt,right=2pt,top=2pt,bottom=2pt,boxsep=0pt}
+
\def\hv@marginpar#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@
@@ -284,8 +288,11 @@
\@namedef{#1@initPreamble}{linerange={#4}-{#5},includerangemarker=false}% code
}% {} ^^to prevent problems with lua comments
+% for the user interface
+\let\defMarkerType\hv@extern@ExampleType
+
%%------------------ the config part --------------------
-%\input{hvextern-mp.cfg}
+
%---- MP
\hv@extern@ExampleType{mp}
{beginfig(1)}
@@ -303,7 +310,6 @@
\hv@ex@typeout{running #1epstopdf #3}%
\ShellEscape{#1epstopdf\space #3.eps}%
}
-
%---- TeX
%\input{hvextern-tex.cfg}
\hv@extern@ExampleType{tex}
@@ -463,6 +469,7 @@
\else
\hv@ex@typeout{force=false: NOT running \hvExternDateiname\hv@extern@ext ...}%
\fi% end force
+ \hfuzz=\maxdimen
\ifhv@extern@code%-------------- Code Part
\hv@ex@typeout{Starting Code part with preamble ...}%
\begingroup
@@ -538,67 +545,69 @@
\hv@ex@typeout{\hvExternDateiname ----> \hv@extern@ExamplesDir}%
\ShellEscape{\hv@move \hvExternDateiname.*\space \hv@extern@ExamplesDir}%
\fi
- \ifhv@extern@includegraphic
- \ifhv@extern@inline
- \expandafter\includegraphics\expandafter[\hv@extern@grfOptions]{\hv@extern@fullPath}%
- \else
- \ifhv@extern@float
- \hv@ex@typeout{Floating environment}%
- \expandafter\figure\expandafter[\hv@extern@floatsetting]
+ \ifhv@extern@output
+ \ifhv@extern@includegraphic
+ \ifhv@extern@inline
+ \expandafter\includegraphics\expandafter[\hv@extern@grfOptions]{\hv@extern@fullPath}%
\else
- \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}%
+ \ifhv@extern@float
+ \hv@ex@typeout{Floating environment}%
+ \expandafter\figure\expandafter[\hv@extern@floatsetting]
\else
- \vspace{\hv@extern@belowbodyskip}\noindent
+ \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}%
+ \else
+ \vspace{\hv@extern@belowbodyskip}\noindent
+ \begingroup
+ \fi
+ \fi
+ \hv@extern@align
+ \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{%
+ \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{%
+ \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\endgroup\fi
\fi
\fi
- \hv@extern@align
- \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{%
- \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{%
- \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\endgroup\fi
- \fi
- \fi
- \else% no graphic, only text
- \ifdim\hv@extern@mpwidth>\z@
- \hfill\minipage[t]{\dimexpr\linewidth-\hv@extern@mpwidth-\hv@extern@mpsep\relax}\vspace{0pt}
- \ifhv@extern@usefancyvrb
- \expandafter\VerbatimInput\expandafter[\hv@extern@textOptions]{\hv@extern@fullPath.txt}%
- \else
- \expandafter\lstinputlisting\expandafter[\hv@extern@textOptions]{\hv@extern@fullPath.txt}%
- \fi
- \endminipage
- \else
- \vspace{\hv@extern@belowbodyskip}%
- \noindent
- \ifhv@extern@usefancyvrb
- \expandafter\VerbatimInput\expandafter[\hv@extern@textOptions]{\hv@extern@fullPath.txt}%
+ \else% no graphic, only text
+ \ifdim\hv@extern@mpwidth>\z@
+ \hfill\minipage[t]{\dimexpr\linewidth-\hv@extern@mpwidth-\hv@extern@mpsep\relax}\vspace{0pt}
+ \ifhv@extern@usefancyvrb
+ \expandafter\VerbatimInput\expandafter[\hv@extern@textOptions]{\hv@extern@fullPath.txt}%
+ \else
+ \expandafter\lstinputlisting\expandafter[\hv@extern@textOptions]{\hv@extern@fullPath.txt}%
+ \fi
+ \endminipage
\else
- \expandafter\lstinputlisting\expandafter[\hv@extern@textOptions]{\hv@extern@fullPath.txt}%
+ \vspace{\hv@extern@belowbodyskip}%
+ \noindent
+ \ifhv@extern@usefancyvrb
+ \expandafter\VerbatimInput\expandafter[\hv@extern@textOptions]{\hv@extern@fullPath.txt}%
+ \else
+ \expandafter\lstinputlisting\expandafter[\hv@extern@textOptions]{\hv@extern@fullPath.txt}%
+ \fi
\fi
\fi
- \fi
+ \fi% end of \ifoutput
\ifhv@extern@force\expandafter\run@hv@extern@cleanup\expandafter{\hv@extern@cleanup}\fi% cleanup
\vspace{\hv@extern@belowskip}%
}
@@ -616,61 +625,63 @@
\fi
\global\stepcounter{hv@example@counter}%
%------------------------------------- output -----------------------------------
- \ifhv@extern@includegraphic
- \ifhv@extern@inline
- \expandafter\includegraphics\expandafter[\hv@extern@grfOptions]{\hv@extern@ExamplesDir\hvExternDateiname}%
- \else
- \ifhv@extern@float
- \hv@ex@typeout{Floating environment}%
- \expandafter\figure\expandafter[\hv@extern@floatsetting]
- \else
- \hv@ex@typeout{No floating environment}%
- \par\noindent\begingroup
- \fi
- \hv@extern@align
- \hv@ex@typeout{Input image \hv@extern@ExamplesDir\hvExternDateiname}%
- \ifhv@extern@frame
- \begingroup
- \fboxsep=\hv@extern@framesep
- \expandafter\@for\expandafter\next\expandafter:\expandafter=\hv@extern@pages\do{%
- \fbox{\expandafter\includegraphics\expandafter[\hv@extern@grfOptions,page=\next]{\hv@extern@fullPath}}%
- \hspace{5pt}}\hspace*{-5pt}%
- \endgroup
- \else
- \expandafter\@for\expandafter\next\expandafter:\expandafter=\hv@extern@pages\do{%
- \expandafter\includegraphics\expandafter[\hv@extern@grfOptions,page=\next]{\hv@extern@fullPath}%
+ \ifhv@extern@output
+ \ifhv@extern@includegraphic
+ \ifhv@extern@inline
+ \expandafter\includegraphics\expandafter[\hv@extern@grfOptions]{\hv@extern@ExamplesDir\hvExternDateiname}%
+ \else
+ \ifhv@extern@float
+ \hv@ex@typeout{Floating environment}%
+ \expandafter\figure\expandafter[\hv@extern@floatsetting]
+ \else
+ \hv@ex@typeout{No floating environment}%
+ \par\noindent\begingroup
+ \fi
+ \hv@extern@align
+ \hv@ex@typeout{Input image \hv@extern@ExamplesDir\hvExternDateiname}%
+ \ifhv@extern@frame
+ \begingroup
+ \fboxsep=\hv@extern@framesep
+ \expandafter\@for\expandafter\next\expandafter:\expandafter=\hv@extern@pages\do{%
+ \fbox{\expandafter\includegraphics\expandafter[\hv@extern@grfOptions,page=\next]{\hv@extern@fullPath}}%
\hspace{5pt}}\hspace*{-5pt}%
- \fi
- \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\par\endgroup\fi
- \fi
- \fi
- \else% no graphic, only text
- \ifhv@extern@float
- \hv@ex@typeout{Floating environment}%
- \expandafter\figure\expandafter[!htb]
- \ifhv@extern@usefancyvrb
- \expandafter\BodyVerbatim\expandafter[\hv@extern@lstOptions]{\hv@extern@fullPath.txt}
- \else
- \expandafter\BodyListing\expandafter[\hv@extern@lstOptions]{\hv@extern@fullPath.txt}
- \fi
- \ifx\hv@extern@caption\@empty\else\caption{\hv@extern@caption}\fi
- \ifx\hv@extern@label\@empty\else\label{\hv@extern@label}\fi
- \endfigure
- \else
- \noindent
- \ifhv@extern@usefancyvrb
- \expandafter\BodyVerbatim\expandafter[\hv@extern@lstOptions]{\hv@extern@fullPath.txt}
- \else
- \expandafter\BodyListing\expandafter[\hv@extern@lstOptions]{\hv@extern@fullPath.txt}
- \fi
- \fi
- \fi
- \ifhv@extern@force\expandafter\run@hv@extern@cleanup\expandafter{\hv@extern@cleanup}\fi% cleanup
+ \endgroup
+ \else
+ \expandafter\@for\expandafter\next\expandafter:\expandafter=\hv@extern@pages\do{%
+ \expandafter\includegraphics\expandafter[\hv@extern@grfOptions,page=\next]{\hv@extern@fullPath}%
+ \hspace{5pt}}\hspace*{-5pt}%
+ \fi
+ \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\par\endgroup\fi
+ \fi
+ \fi
+ \else% no graphic, only text
+ \ifhv@extern@float
+ \hv@ex@typeout{Floating environment}%
+ \expandafter\figure\expandafter[!htb]
+ \ifhv@extern@usefancyvrb
+ \expandafter\BodyVerbatim\expandafter[\hv@extern@lstOptions]{\hv@extern@fullPath.txt}
+ \else
+ \expandafter\BodyListing\expandafter[\hv@extern@lstOptions]{\hv@extern@fullPath.txt}
+ \fi
+ \ifx\hv@extern@caption\@empty\else\caption{\hv@extern@caption}\fi
+ \ifx\hv@extern@label\@empty\else\label{\hv@extern@label}\fi
+ \endfigure
+ \else
+ \noindent
+ \ifhv@extern@usefancyvrb
+ \expandafter\BodyVerbatim\expandafter[\hv@extern@lstOptions]{\hv@extern@fullPath.txt}
+ \else
+ \expandafter\BodyListing\expandafter[\hv@extern@lstOptions]{\hv@extern@fullPath.txt}
+ \fi
+ \fi
+ \fi
+ \fi% end \ifoutput
+ \ifhv@extern@force\expandafter\run@hv@extern@cleanup\expandafter{\hv@extern@cleanup}\fi% cleanup
\endgroup
}