texlive[63346] Master/texmf-dist: hvextern (20may22)

commits+karl at tug.org commits+karl at tug.org
Fri May 20 23:38:39 CEST 2022


Revision: 63346
          http://tug.org/svn/texlive?view=revision&revision=63346
Author:   karl
Date:     2022-05-20 23:38:39 +0200 (Fri, 20 May 2022)
Log Message:
-----------
hvextern (20may22)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/hvextern/Changes
    trunk/Master/texmf-dist/doc/latex/hvextern/hvextern.pdf
    trunk/Master/texmf-dist/doc/latex/hvextern/hvextern.tex
    trunk/Master/texmf-dist/tex/latex/hvextern/hvextern.sty

Modified: trunk/Master/texmf-dist/doc/latex/hvextern/Changes
===================================================================
--- trunk/Master/texmf-dist/doc/latex/hvextern/Changes	2022-05-20 21:38:27 UTC (rev 63345)
+++ trunk/Master/texmf-dist/doc/latex/hvextern/Changes	2022-05-20 21:38:39 UTC (rev 63346)
@@ -1,5 +1,9 @@
 hvextern.sty ----------------
 
+v 0.25 2022-05-19  - added framesep keyword
+                   - added keywords for vertical space
+                   - added keyword textOptions for reading text output
+                   - use \hv at marginpar instead of \marginpar/\marginnote
 v 0.24 2022-05-11  - fix introduced bug for \hv at rm
                    - added tcolorbox support for \runExtCmd
                    . added keywords pagesep and mpsep

Modified: trunk/Master/texmf-dist/doc/latex/hvextern/hvextern.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/hvextern/hvextern.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/hvextern/hvextern.tex	2022-05-20 21:38:27 UTC (rev 63345)
+++ trunk/Master/texmf-dist/doc/latex/hvextern/hvextern.tex	2022-05-20 21:38:39 UTC (rev 63346)
@@ -23,12 +23,12 @@
 
 \begin{document}
 \title{Writing, running and including the output of external documents 
-from within a main \LaTeX\ document~--v. \hvexternFileversion}
-\author{Herbert Voß\thanks{herbert at dante.de}}
+from within a main\newline \LaTeX\ document~--v. \hvexternFileversion}
+\author{Herbert Voß \url{herbert at dante.de}}
 \maketitle
 \tableofcontents
 
-\newpage
+%\newpage
 
 \setkeys{hv}{moveToExampleDir,ExampleDir=Examples,showFilename,verbose}
 \section{Syntax}
@@ -37,6 +37,9 @@
 \usepackage{hvextern}
 \end{verbatim}
 
+\addtocontents{toc}{\protect\enlargethispage{2ex}}
+
+
 \begin{sloppypar}
 This package allows to write external \MP, \TeX, \ConTeXt, \LaTeX, \LuaTeX, \LuaLaTeX, \XeTeX, \XeLaTeX, Lua, Perl, Java and/or Python
 source code, which will then be run via \texttt{shell escape} to create a PDF oder text output to include
@@ -144,7 +147,6 @@
 \begin{Verbatim}
 \begin{externalDocument}[
   compiler=python3,
-  showFilename,
   code,
   ext=py,
   docType=py,
@@ -171,7 +173,6 @@
 \begin{Verbatim}
 \begin{externalDocument}[
   compiler=python3,
-  showFilename,
   code,
   ext=py,
   force=false,
@@ -225,7 +226,6 @@
   compiler=python3,
   progpath=/usr/local/bin/,
   force=false,
-  showFilename,
   runs=1,
   code,
   ext=py,
@@ -269,11 +269,9 @@
 
 
 
-
-
 \begin{externalDocument}[grfOptions={width=0.95\linewidth},
   compiler=xelatex,code,mpwidth=0.6\linewidth,
-  crop,cleanup,force=false,usefancyvrb=false,ext=tex]{voss}
+  crop,cleanup,force=false,usefancyvrb=false,ext=tex,showFilename=false]{voss}
 \documentclass{article}
 %StartVisiblePreamble
 \usepackage{tikz}
@@ -298,6 +296,7 @@
 \end{externalDocument}
 
 
+
 \section{Setting marker in the source}
 The marker for the code ranges which should be listed depend to the used programming language:
 
@@ -379,9 +378,10 @@
 \begin{externalDocument}[
   grfOptions={width=0.30\linewidth},
   pages={1,3,5},
+  pagesep=2pt,
   frame,
   runsequence={lualatex,biber,xindex -l de -c AU,lualatex,lualatex},
-  showFilename,
+  ,
   verbose,
   force=false,
   cleanup={log,aux,toc,bbl,blg},
@@ -412,6 +412,9 @@
 \end{externalDocument}
 
 
+
+
+
 The following \Java-program creates the Mandelbrot set as png image. The valid setting for 
 the environment \Lenv{externalDocument} is:
 
@@ -489,6 +492,8 @@
 %$
 
 
+
+
 \subsection{Grafik options}
 \begin{verbatim}
 \define at key{hv}{grfOptions}[]{\def\hv at extern@grfOptions{#1}}
@@ -524,6 +529,10 @@
 \end{externalDocument}
 
 
+
+\newpage%%%%%%%%%%%
+
+
 \subsection{Listings options}
 
 \begin{verbatim}
@@ -563,6 +572,8 @@
 \end{document}
 \end{externalDocument}
 
+
+
 \subsection{Background color}
 
 There are different colors for the preamble and body listing: the backgrund and frame color.
@@ -644,63 +655,6 @@
 The type of the source code can be different to the compiler, e.g. source \Lkeyval{latex},
 but compiler \Lkeyval{lualatex}.
 
-
-\subsection{Output as floating object with caption and label}
-
-By default the images are not inserted as a float. This can be changed by
-the keyword \Lkeyword{float}, a caption and a label are optional. The float type is always
-\Lenv{figure}.
-
-\begin{verbatim}
-\define at boolkey{hv}[hv at extern@]{float}[true]{}
-\define at key{hv}{caption}[]{\def\hv at extern@caption{#1}}
-\define at key{hv}{label}[]{\def\hv at extern@label{#1}}
-\end{verbatim}
-
-The image Figure~\ref{img:cox} shows an example for a floting object.
-
-\begin{externalDocument}[
-  grfOptions={width=\linewidth},
-  lstOptions={fontsize=\small,fontfamily=tt},
-%  lstOptions={basicstyle=\small\ttfamily},
-  compiler=lualatex,
-  BGpreamble=red!10, BOpreamble=red, 
-  BGbody=blue!8, BObody=blue,
-  code,
-%  mpwidth=0.6\linewidth,
-  crop,
-  cleanup,
-  force=false,
-  usefancyvrb,
-  float,
-  caption={An example for Coxeter images},
-  label=img:cox,
-  docType=latex]{voss}
-\RequirePackage{pdfmanagement-testphase}
-\DeclareDocumentMetadata{}
-\documentclass{article}
-%StartVisiblePreamble
-\usepackage{pst-coxeterp} 
-%StopVisiblePreamble
-\pagestyle{empty}
-\begin{document}
-\begin{pspicture}(-1,-1)(1,1)\Simplex[dimension=2]\end{pspicture}
-%
-\begin{pspicture}(-1,-1)(1,1)\Simplex[dimension=3]\end{pspicture}
-%
-\begin{pspicture}(-1,-1)(1,1)\Simplex[dimension=5]\end{pspicture}
-%
-\begin{pspicture}(-1,-1)(1,1)\Simplex[dimension=7]\end{pspicture}
-%
-% ------------------------------------
-% Only some text to show the pagebreak
-% ------------------------------------
-\end{document}
-\end{externalDocument}
-
-
-
-
 \subsection{Output more than one page}
 The pages which should be printed can be defined by
 
@@ -707,15 +661,18 @@
 
 \begin{verbatim}
 \define at key{hv}{pages}[1]{\def\hv at extern@pages{#1}}
+\define at key{hv}{pagesep}[1em]{\hv at extern@pagesep=#1}
 \define at boolkey{hv}[hv at extern@]{frame}[true]{}
 \end{verbatim}
 
 With \Lkeyword{frame} the pages can be framed (internally by \Lcs{fbox}).
 It is leaved to the user to choose the correct image width for the pages.
+The separation between the pages is defined by the length \Lkeyword{pagesep}.
 The following example uses:
 
 \begin{verbatim}
   pages={1,2,3},
+  pagesep=2pt,
   grfOptions={width=0.3\linewidth},
   compiler=lualatex, runs=2,  % for the TOC
   frame,
@@ -723,6 +680,7 @@
 
 \begin{externalDocument}[
   pages={1,2,3},
+  pagesep=2pt,
   grfOptions={width=0.3\linewidth},
 %  lstOptions={fontsize=\small,fontfamily=tt},
   compiler=lualatex, runs=2,
@@ -732,7 +690,7 @@
 %  mpwidth=0.6\linewidth,
 %  crop,
   cleanup,
-  force=false,
+  force=true,
   frame,
 %  usefancyvrb,
 %  float,
@@ -757,6 +715,61 @@
 
 
 
+
+\subsection{Output as floating object with caption and label}
+
+By default the images are not inserted as a float. This can be changed by
+the keyword \Lkeyword{float}, a caption and a label are optional. The float type is always
+\Lenv{figure}.
+
+\begin{verbatim}
+\define at boolkey{hv}[hv at extern@]{float}[true]{}
+\define at key{hv}{floatsetting}[]{\def\hv at extern@floatsetting{#1}}
+\define at key{hv}{caption}[]{\def\hv at extern@caption{#1}}
+\define at key{hv}{label}[]{\def\hv at extern@label{#1}}
+\end{verbatim}
+
+The image Figure~\ref{img:cox} shows an example for a floating object, which uses the floatsetting \verb|!htb|,
+which is the default. Using a caption and a label are optional.
+
+\begin{externalDocument}[
+  grfOptions={width=\linewidth},
+  lstOptions={fontsize=\small,fontfamily=tt},
+%  lstOptions={basicstyle=\small\ttfamily},
+  compiler=lualatex,
+  BGpreamble=red!10, BOpreamble=red, 
+  BGbody=blue!8, BObody=blue,
+  code,
+%  mpwidth=0.6\linewidth,
+  crop,
+  cleanup,
+  force=true,
+  usefancyvrb,
+  float,
+  floatsetting=!ht,
+  caption={An example for Coxeter images},
+  label=img:cox,
+  docType=latex]{voss}
+\RequirePackage{pdfmanagement-testphase}
+\DeclareDocumentMetadata{}
+\documentclass{article}
+%StartVisiblePreamble
+\usepackage{pst-coxeterp} 
+%StopVisiblePreamble
+\pagestyle{empty}
+\begin{document}
+\begin{pspicture}(-1,-1)(1,1)\Simplex[dimension=2]\end{pspicture}
+\begin{pspicture}(-1,-1)(1,1)\Simplex[dimension=3]\end{pspicture}
+\begin{pspicture}(-1,-1)(1,1)\Simplex[dimension=5]\end{pspicture}
+\begin{pspicture}(-1,-1)(1,1)\Simplex[dimension=7]\end{pspicture}
+\end{document}
+\end{externalDocument}
+
+
+
+%\clearpage%%%%%%%%%%%%%%%%%
+
+
 \subsection{Cropping the PDF}
 Instead of using the \Index{documentclass} \Lclass{standalone}, which already crops the created PDF,
 one can use the optional argument \Lkeyword{crop}.
@@ -774,6 +787,7 @@
 
 \begin{verbatim}
   pages={1,2,3},
+  pagesep=2pt,
   grfOptions={width=0.3\linewidth},
   compiler=lualatex, runs=2,  % for the TOC
   frame,
@@ -782,6 +796,7 @@
 
 \begin{externalDocument}[
   pages={1,2,3},
+  pagesep=2pt,
   grfOptions={width=0.3\linewidth},
 %  lstOptions={fontsize=\small,fontfamily=tt},
   compiler=lualatex, runs=2,
@@ -838,17 +853,18 @@
 %\define at key{hv}{align}[\centering]{\def\hv at extern@align{#1}}
 %\end{verbatim}
 
-\subsubsection{the default}
-
+%\textbf{the default}
+%
 \begin{verbatim}
-  align=\centering,
+  align=\centering,  % default
 \end{verbatim}
-
+%
 \begin{externalDocument}[
   compiler=lualatex, runs=2,
   BGpreamble=red!10, BOpreamble=red, 
   BGbody=blue!8, BObody=blue,
   code,
+  showFilename=false,
   crop,
   cleanup,
   force=false,
@@ -860,7 +876,7 @@
 \end{document}
 \end{externalDocument}
 
-\subsubsection{Left aligned}
+%\textbf{Left aligned}
 
 \begin{verbatim}
   align=\raggedright,
@@ -871,6 +887,7 @@
   compiler=lualatex, runs=2,
   BGpreamble=red!10, BOpreamble=red, 
   BGbody=blue!8, BObody=blue,
+  showFilename=false,
   code,
   crop,
   cleanup,
@@ -883,7 +900,7 @@
 \end{document}
 \end{externalDocument}
 
-\subsubsection{Right aligned}
+%\textbf{Right aligned}
 
 \begin{verbatim}
   align=\raggedleft,
@@ -896,6 +913,7 @@
   BGpreamble=red!10, BOpreamble=red, 
   BGbody=blue!8, BObody=blue,
   code,
+  showFilename=false,
   crop,
   cleanup,
   force=false,
@@ -910,9 +928,9 @@
 
 %Now the same for side by side output.
 
-\subsubsection{the default -- side by side}
+%\textbf{the default -- side by side}
 \begin{verbatim}
-  align=\centering,  mpwidth=0.5\linewidth,
+  align=\centering,  mpwidth=0.5\linewidth,   % default for side by side
 \end{verbatim}
 
 \begin{externalDocument}[
@@ -921,6 +939,7 @@
   BGbody=blue!8, BObody=blue,
   code,
   crop,
+  showFilename=false,
   cleanup,
   force=false,
   mpwidth=0.5\linewidth,
@@ -932,7 +951,7 @@
 \end{document}
 \end{externalDocument}
 
-\subsubsection{Left aligned -- side by side}
+%\textbf{Left aligned -- side by side}
 
 \begin{verbatim}
   align=\raggedright,   mpwidth=0.5\linewidth,
@@ -944,6 +963,7 @@
   BGpreamble=red!10, BOpreamble=red, 
   BGbody=blue!8, BObody=blue,
   code,
+  showFilename=false,
   crop,
   cleanup,
   force=false,
@@ -956,7 +976,7 @@
 \end{document}
 \end{externalDocument}
 
-\subsubsection{Right aligned -- side by side}
+%\textbf{Right aligned -- side by side}
 
 \begin{verbatim}
   align=\raggedleft,  mpwidth=0.5\linewidth,
@@ -969,6 +989,7 @@
   BGpreamble=red!10, BOpreamble=red, 
   BGbody=blue!8, BObody=blue,
   code,
+  showFilename=false,
   crop,
   cleanup,
   force=false,
@@ -981,6 +1002,9 @@
 \end{document}
 \end{externalDocument}
 
+
+
+
 \subsection{Inline images}
 By default code and image are own paragraphs. With the optional argument \Lkeyword{inline} the created
 image can be part of the \Index{current line}. This may make sense, if you need characters which are
@@ -987,14 +1011,18 @@
 not part of your current font.
 
 \begin{verbatim}
-\define at boolkey{hv}[hv at extern@]{inline}[true]{\hv at extern@codefalse}
+\define at boolkey{hv}[hv at extern@]{inline}[true]{%
+    \hv at extern@codefalse
+    \hv at extern@showFilenamefalse}
 \end{verbatim}
 
-With the setting \LKeyset{inline=true} the optional keyword \Lkeyword{code} is automatically set to false. The
+With the setting \LKeyset{inline=true} the optional keyword \Lkeyword{code} 
+is automatically set to false. The
 next  Chinese characters 
 \begin{externalDocument}[
   compiler=xelatex, inline, runs=2, grfOptions={height=8pt},
-  crop, cropmargin=0, cleanup, force=false, docType=latex]{voss}%
+  crop, cropmargin=0, 
+  cleanup, force=false, docType=latex]{voss}%
 \documentclass{ctexart}
 \pagestyle{empty}
 \begin{document}
@@ -1006,8 +1034,8 @@
 
 
 \begin{Verbatim}
-With \Lkeyset{inline} the optional argument \Lkeyword{code} is automatically set to false. The
-next  Chinese characters 
+With \Lkeyset{inline} the optional argument \Lkeyword{code} is 
+automatically set to false. The next  Chinese characters 
 \begin{externalDocument}[
   compiler=xelatex, inline, runs=2, grfOptions={height=8pt},
   crop, cropmargin=0, cleanup, force=false, docType=latex]{voss}
@@ -1017,7 +1045,8 @@
 美好的一天
 \end{document}
 \end{externalDocument}
-are inserted as inline image without showing the code. The complete code looks like:
+are inserted as inline image without showing the code. The complete 
+code looks like:
 \end{Verbatim}
 
 
@@ -1049,7 +1078,7 @@
 
 \begin{externalDocument}[
   compiler=perl, force=false, docType=pl, ext=pl, includegraphic=false,
-  code, mpwidth=0.6\linewidth]{voss}
+  code, mpwidth=0.6\linewidth, showFilename=false]{voss}
 #!/usr/bin/perl
 #
 # Herbert Voss 2005-05-31
@@ -1103,7 +1132,8 @@
 
 
 \begin{externalDocument}[
-  compiler=lua, force=false, docType=lua, ext=lua, includegraphic=false, code, usefancyvrb=false]{voss}
+  compiler=lua, force=false, docType=lua, ext=lua, includegraphic=false, 
+  code, usefancyvrb=false,textOptions={basicstyle=\ttfamily\footnotesize}]{voss}
 #!/usr/bin/env lua
 local filename = arg[0]
 local shortFN = filename:match("(.+)%..+")
@@ -1181,6 +1211,7 @@
   xindexOptions={-l DE --config AU},
   mpwidth=0.6\linewidth,
   usefancyvrb=false,
+  showFilename=false,
   docType=latex]{voss}
 \documentclass[paper=a6,DIV=18,parskip=half-]{screxa}
 \pagestyle{empty}
@@ -1228,6 +1259,7 @@
 \begin{externalDocument}[
   grfOptions={width=0.30\linewidth},
   pages={1,3,5},
+  pagesep=2pt,
   frame,
   runsequence={lualatex,biber,xindex -l de -c AU,lualatex,lualatex},
   showFilename,
@@ -1382,7 +1414,27 @@
 \end{externalDocument}
 
 
+%\clearpage
 
+
+\subsection{Vertical space}
+
+\begin{verbatim}
+\define at key{hv}{aboveskip}[\medskipamount]{\setlength\hv at extern@aboveskip{#1}}
+\define at key{hv}{belowpreambleskip}[\smallskipamount]{\setlength\hv at extern@belowpreambleskip{#1}}
+\define at key{hv}{belowbodyskip}[\smallskipamount]{\setlength\hv at extern@belowbodyskip{#1}}
+\define at key{hv}{belowskip}[\medskipamount]{\setlength\hv at extern@belowskip{#1}}
+\end{verbatim}
+
+\begin{description}
+\item[\Lkeyword{aboveskip}] Vertical space \emph{before} the environment \Lenv{externalDocument} or
+    the command \Lcs{runExtCmd} (default \Lcs{medskipamount})
+\item[\Lkeyword{belowpreambleskip}] Vertical  space between preamble and body (default \Lcs{smallskipamount})
+\item[\Lkeyword{belowbodyskip}] Vertical space between  body and output (default \Lcs{smallskipamount})
+\item[\Lkeyword{belowskip}] Vertical space \emph{after}  the environment \Lenv{externalDocument} or
+    the command \Lcs{runExtCmd} (default \Lcs{medskipamount})
+\end{description}
+
 \section{Supported engines}
 \subsection{\MP\ example}
 
@@ -1525,6 +1577,7 @@
 \begin{externalDocument}[
   grfOptions={width=0.3\linewidth},
   pages={1,2,3},
+  pagesep=2pt,
   frame,
   verbose=false,
   compiler=context,
@@ -1596,6 +1649,7 @@
 \item[\Lkeyword{ExamplesDir}] move all examples into a directory
 \item[\Lkeyset{tclbox=false}] Can be used if there are some negative interactions between package \Lpack{listings}
    and package \Lpack{tcolorbox}.
+\item[\Lkeyword{framesep}] Value for \Lcs{fbox} if keyword \texttt{frame} is used.
 \item[\Lkeyword{mpsep}] Distance between code and output (default 1\,em).
 \item[\Lkeyword{pagesep}] Distance between pages for multipage output (default 1\,em).
 \item[\Lkeyword{eps}] create an eps from the pdf (historical).

Modified: trunk/Master/texmf-dist/tex/latex/hvextern/hvextern.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/hvextern/hvextern.sty	2022-05-20 21:38:27 UTC (rev 63345)
+++ trunk/Master/texmf-dist/tex/latex/hvextern/hvextern.sty	2022-05-20 21:38:39 UTC (rev 63346)
@@ -11,10 +11,11 @@
 %% and version 1.3c or later is part of all distributions of LaTeX
 %% version 2005/12/01 or later.
 
-\def\hvexternFileversion{0.24}
-\ProvidesFile{hvextern}[2022/05/11 v\hvexternFileversion: package for running external documents (HV)]
+\def\hvexternFileversion{0.25}
+\ProvidesFile{hvextern}[2022/05/19 v\hvexternFileversion: package for running external documents (HV)]
 
-\RequirePackage{shellesc,xkeyval,graphicx,marginnote,fancyvrb,tikz,listings,ifplatform}
+\RequirePackage{shellesc,xkeyval,graphicx}
+\RequirePackage{fancyvrb,tikz,listings,ifplatform}
 \RequirePackage{tcolorbox,xparse}
 \tcbuselibrary{skins,breakable}
 
@@ -30,8 +31,15 @@
 \newcounter{@@@runs} 
 \newsavebox\hv at extern@box
 \newlength\hv at LineWidth
+\newlength\hv at TextWidth
 \newlength\hv at extern@pagesep
 \newlength\hv at extern@mpsep
+\newlength\hv at extern@framesep
+\newlength\hv at extern@aboveskip
+\newlength\hv at extern@belowpreambleskip
+\newlength\hv at extern@belowbodyskip
+\newlength\hv at extern@belowskip
+
 \AtBeginDocument{\setlength\hv at LineWidth{\dimexpr\linewidth-2\fboxsep-2\fboxrule}}
 \newlength\hv at extern@mpwidth \setlength\hv at extern@mpwidth{\z@}
 
@@ -40,11 +48,18 @@
 \define at key{hv}{runs}[1]{\setcounter{hv at extern@runs}{#1}}
 \define at key{hv}{grfOptions}[]{\def\hv at extern@grfOptions{#1}}
 \define at key{hv}{lstOptions}[]{\def\hv at extern@lstOptions{#1}}
+\define at key{hv}{textOptions}[]{\def\hv at extern@textOptions{#1}}
 \define at key{hv}{BGpreamble}[black!12]{\def\hv at extern@BGpreamble{#1}}
 \define at key{hv}{BGbody}[black!8]{\def\hv at extern@BGbody{#1}}
 \define at key{hv}{BOpreamble}[black!12]{\def\hv at extern@BOpreamble{#1}}
 \define at key{hv}{BObody}[black!8]{\def\hv at extern@BObody{#1}}
 \define at key{hv}{docType}[latex]{\def\hv at extern@docType{#1}}
+%\define at choicekey*+{hv}{docType}[\val\nr]{latex,mp,tex,py,pl,lua,java,context,sh}[latex]{% 
+%  \hv at typeout{>>>> ´doc type \nr}%
+%  \def\hv at extern@docType{\val}%
+%}{\PackageWarning{hvextern}{erroneous input (#1) for docType ignored. Using latex.}%
+%  \def\hv at extern@docType{latex}%
+% }
 \define at key{hv}{caption}[]{\def\hv at extern@caption{#1}}
 \define at key{hv}{label}[]{\def\hv at extern@label{#1}}
 \define at key{hv}{pages}[1]{\def\hv at extern@pages{#1}}
@@ -65,10 +80,11 @@
 \define at boolkey{hv}[hv at extern@]{xindex}[true]{}
 \define at key{hv}{xindexOptions}[]{\def\hv at extern@xindexOptions{#1}}
 \define at boolkey{hv}[hv at extern@]{includegraphic}[true]{}
-\define at boolkey{hv}[hv at extern@]{inline}[true]{\hv at extern@codefalse}
+\define at boolkey{hv}[hv at extern@]{inline}[true]{\hv at extern@codefalse\hv at extern@showFilenamefalse}
 \define at boolkey{hv}[hv at extern@]{frame}[true]{}
+\define at key{hv}{framesep}[\the\fboxsep]{\setlength\hv at extern@framesep{#1}}
 \define at boolkey{hv}[hv at extern@]{float}[true]{}
-%\define at boolkey{hv}[hv at extern@]{cleanup}[true]{}
+\define at key{hv}{floatsetting}[]{\def\hv at extern@floatsetting{#1}}
 \define at key{hv}{cleanup}[{aux,log}]{\def\hv at extern@cleanup{#1}}% 
 \define at boolkey{hv}[hv at extern@]{moveToExampleDir}[true]{}
 \define at key{hv}{align}[\centering]{\def\hv at extern@align{#1}}
@@ -82,7 +98,6 @@
 \define at boolkey{hv}[hv at extern@]{eps}[true]{}
 \define at boolkey{hv}[hv at extern@]{verbose}[true]{}
 \def\hv at typeout#1{\ifhv at extern@verbose\typeout{#1}\fi}
-
 %\define at key{hv}{compiler}[pdflatex]{\def\hv at extern@compiler{#1}}
 \define at choicekey*+{hv}{compiler}[\val\nr]{mpost,tex,latex,luatex,python3,perl,lua,java,%
      xetex,pdflatex,lualatex,xelatex,context,sh,texlua}[pdflatex]{% 
@@ -93,6 +108,10 @@
   \def\hv at extern@compiler{pdflatex}%
   \def\hv at extern@compilerNo{9}%
  }
+\define at key{hv}{aboveskip}[\medskipamount]{\setlength\hv at extern@aboveskip{#1}}
+\define at key{hv}{belowpreambleskip}[\smallskipamount]{\setlength\hv at extern@belowpreambleskip{#1}}
+\define at key{hv}{belowbodyskip}[\smallskipamount]{\setlength\hv at extern@belowbodyskip{#1}}
+\define at key{hv}{belowskip}[\medskipamount]{\setlength\hv at extern@belowskip{#1}}
 
 \def\ResetKeys{%
  \setkeys{hv}{%
@@ -105,6 +124,7 @@
   tcbox=true,%          use tcolorbox
   grfOptions={},%	Optionen der einzubindenden Grafik
   lstOptions={},%	Optionen für das Listing
+  textOptions={},%	Options for text output
   BGpreamble=black!12,% Backgroundcolor for preamble
   BGbody=black!8,%      Backgroundcolor for body
   BOpreamble=black!12,% Bodercolor for preamble
@@ -118,7 +138,9 @@
   xindexOptions={},%     options for xindex
   force=false,%		Compiler, auch wenn PDF existiert?
   frame=false,%		keinen Rahmen um Abbildung
+  framesep=\the\fboxsep,% 
   float=false,%		nicht als Gleitumgebung
+  floatsetting=!htb,%   placement
   caption=,%	        keine Caption
   label=,%		kein Label
   pages=1,%		welche Seiten auszugeben sind
@@ -129,11 +151,16 @@
   ExampleDir=Examples,% Unterverzeichnis für Beispiele
   align=\centering,%    Ausgabe zentrieren
   mpwidth=0pt,%         no minipage
+  mpsep=1em,%           sep  between two minipages
   mpvalign=t,%          if side by side output the vertical alignment          
   usefancyvrb=false,%   use VerbatimInput instead of listings
   progpath={},
   cropmargin=2,%        2pb margin
   eps=false,%           create an eps output?          
+  aboveskip=\medskipamount,% space above everything
+  belowpreambleskip=\smallskipamount,% space below preamble
+  belowbodyskip=\smallskipamount,% space below body
+  belowskip=\medskipamount,% space below everything
   }%
 }
 
@@ -167,10 +194,14 @@
 \lstset{belowskip=0pt,aboveskip=0pt}% global
 \tcbset{breakable,left=2pt,right=2pt,top=2pt,bottom=2pt,boxsep=0pt}
 
+\def\hv at marginpar#1{%
+  \makebox[\dimexpr\hv at TextWidth+\marginparsep-1ex][r]{\makebox(0,0){\rotatebox[origin=lb]{90}{#1}}}%
+}
+
 \newcommand\PreambleVerbatim[2][]{%
   \hv at typeout{Running PreambleVerbatim with #1, #2}%
   \ifhv at extern@tcbox
-    \begin{tcolorbox}\VerbatimInput[#1]{#2}\end{tcolorbox}%
+    \begin{tcolorbox}[before skip=0pt,after skip=0pt]\VerbatimInput[#1]{#2}\end{tcolorbox}%
   \else
     \VerbatimInput[#1]{#2}
   \fi}
@@ -178,7 +209,7 @@
 \newcommand\BodyVerbatim[2][]{%
   \hv at typeout{Running BodyVerbatim with #1, #2}%
   \ifhv at extern@tcbox
-    \begin{tcolorbox}\VerbatimInput[#1]{#2}\end{tcolorbox}%
+    \begin{tcolorbox}[before skip=0pt,after skip=0pt]\VerbatimInput[#1]{#2}\end{tcolorbox}%
   \else
     \VerbatimInput[#1]{#2}
   \fi}
@@ -186,17 +217,19 @@
 \newcommand\PreambleListing[2][]{%
   \hv at typeout{Running PreambleListing with #1, #2}%
   \ifhv at extern@tcbox 
-    \begin{tcolorbox}[top=-2pt]\expandafter\lstinputlisting\expandafter[#1]{#2}\end{tcolorbox}%
+    \begin{tcolorbox}[before skip=0pt,after skip=0pt%,top=-2pt
+    ]\expandafter\lstinputlisting\expandafter[#1,aboveskip=0pt,belowskip=0pt]{#2}\end{tcolorbox}%
   \else    
-    \expandafter\lstinputlisting\expandafter[#1]{#2}%
+    \expandafter\lstinputlisting\expandafter[#1,aboveskip=0pt,belowskip=0pt]{#2}%
   \fi}
 
 \newcommand\BodyListing[2][]{%
   \hv at typeout{Running BodyListing with #1, #2}%
   \ifhv at extern@tcbox 
-    \begin{tcolorbox}[top=-2pt]\expandafter\lstinputlisting\expandafter[#1]{#2}\end{tcolorbox}%
+    \begin{tcolorbox}[before skip=0pt,after skip=0pt,%top=-2pt
+    ]\expandafter\lstinputlisting\expandafter[#1,aboveskip=0pt,belowskip=0pt]{#2}\end{tcolorbox}%
   \else
-    \expandafter\lstinputlisting\expandafter[#1]{#2}%
+    \expandafter\lstinputlisting\expandafter[#1,aboveskip=0pt,belowskip=0pt]{#2}%
   \fi}
 
 \newcounter{hv at example@counter}
@@ -382,20 +415,26 @@
      \fi
    \fi%    end force
    \ifhv at extern@code%--------------        Code Part
-     \hv at typeout{>>>>Starting Code part ...}%
-     \par\noindent
+     \hv at typeout{>>>>Starting Code part with preamble ...}%
      \begingroup
-      \ifdim\hv at extern@mpwidth>\z@ \minipage[\hv at extern@mpvalign]{\hv at extern@mpwidth}\vspace{0pt}\fi
-      \ifhv at extern@usefancyvrb
+       \hv at TextWidth=\textwidth
+       \ifdim\hv at extern@mpwidth>\z@ 
+         \noindent
+         \minipage[\hv at extern@mpvalign]{\hv at extern@mpwidth}
+         \vspace{0pt}%
+       \else
+         \vspace{\hv at extern@aboveskip}\noindent
+       \fi
+       \ifhv at extern@usefancyvrb
          \@nameuse{\hv at extern@docType @initPreambleFancy}%
          \edef\@@@temp{\@nameuse{\hv at extern@docType @initPreamble}}%
          % we need lstinputlisting, because \VerbatimInput doesn't work in a box
          \savebox\hv at extern@box{\expandafter\lstinputlisting\expandafter[\@@@temp]{\hvExternDateiname\hv at extern@ext}}%
-%         \savebox\hv at extern@box{\VerbatimInput{\hvExternDateiname\hv at extern@ext}}%
          \ifdim\wd\hv at extern@box > \z@\relax
            \expandafter\fvset\expandafter{\hv at extern@lstOptions}%
            \tcbset{colback=\hv at extern@BGpreamble,colframe=\hv at extern@BOpreamble}%
            \PreambleVerbatim{\hvExternDateiname\hv at extern@ext}%
+           \vspace{\hv at extern@belowpreambleskip}%
          \fi
       \else
         \edef\@@@temp{\@nameuse{\hv at extern@docType @initPreamble}}%
@@ -404,30 +443,35 @@
           \expandafter\lstset\expandafter{\hv at extern@lstOptions}%
           \tcbset{colback=\hv at extern@BGpreamble,colframe=\hv at extern@BOpreamble}%
           \PreambleListing[\@@@temp]{\hvExternDateiname\hv at extern@ext}%
+          \vspace{\hv at extern@belowpreambleskip}%
         \fi
       \fi
       \ifhv at extern@showFilename
-         \marginnote{\rotatebox{90}{\hvExternDateiname\hv at extern@ext}}%[-15mm]%
+         \hv at typeout{>>>> Set filename in the margin!}%
+         \noindent
+         \hv at marginpar{\hvExternDateiname\hv at extern@ext}%
       \fi
 %     
+      \hv at typeout{>>>>Starting Code body ...}%}
        \ifhv at extern@usefancyvrb
          \@nameuse{\hv at extern@docType @initTextFancy}%
          \expandafter\fvset\expandafter{\hv at extern@lstOptions}%
          \tcbset{colback=\hv at extern@BGbody,colframe=\hv at extern@BObody}%
          \expandafter\BodyVerbatim\expandafter[\hv at extern@lstOptions]{\hvExternDateiname\hv at extern@ext}%
-       \else
+      \else
          \expandafter\lstset\expandafter{\hv at extern@lstOptions}%
          \edef\@@@temp{\@nameuse{\hv at extern@docType @initText}}%
          \tcbset{colback=\hv at extern@BGbody,colframe=\hv at extern@BObody}%
          \BodyListing[\@@@temp]{\hvExternDateiname\hv at extern@ext}%
-       \fi
-     \ifdim\hv at extern@mpwidth > \z@\relax \endminipage\fi
-     \endgroup
+      \fi
+    \ifdim\hv at extern@mpwidth > \z@\relax \endminipage\fi
+    \endgroup
    \fi % end code part
    \ifhv at extern@code\else  % only if no code
       \ifhv at extern@showFilename
         \hv at typeout{>>>> Set filename in the margin!}%
-        \marginnote{\rotatebox{90}{\hvExternDateiname}}%
+        \noindent
+        \hv at marginpar{\hvExternDateiname\hv at extern@ext}%
       \fi
    \fi
    \ifhv at extern@moveToExampleDir
@@ -442,31 +486,37 @@
      \else
        \ifhv at extern@float
          \hv at typeout{>>>> Floating environment}% 
-         \begin{figure}[!htb]
+         \expandafter\figure\expandafter[\hv at extern@floatsetting]
        \else
          \hv at typeout{>>>> No floating environment}% 
+         \vspace{\hv at extern@belowbodyskip}
          \ifdim\hv at extern@mpwidth>\z@ 
            \hfill\minipage[\hv at extern@mpvalign]{\dimexpr\linewidth-\hv at extern@mpwidth-1em\relax}\vspace{0pt}%
          \else
-           \par\noindent\begingroup
+           \vspace{\hv at extern@belowbodyskip}\noindent
+           \begingroup
          \fi
        \fi
        \hv at extern@align
        \hv at typeout{>>>> Input image \hv at extern@ExamplesDir\hvExternDateiname}% 
        \ifhv at extern@frame
+         \begingroup
+         \fboxsep=\hv at extern@framesep
          \expandafter\@for\expandafter\next\expandafter:\expandafter=\hv at extern@pages\do{%
-           \fbox{\expandafter\includegraphics\expandafter[\hv at extern@grfOptions,page=\next]{\hv at extern@ExamplesDir\hvExternDateiname}}%
-              \hspace{\hv at extern@pagesep}}\hspace*{-\hv at extern@pagesep}%
+           \fbox{\expandafter\includegraphics\expandafter[\hv at extern@grfOptions,page=\next]%
+             {\hv at extern@ExamplesDir\hvExternDateiname}}\hspace{\hv at extern@pagesep}}%
+         \hspace*{-\hv at extern@pagesep}%
+         \endgroup
        \else
          \expandafter\@for\expandafter\next\expandafter:\expandafter=\hv at extern@pages\do{%
            \expandafter\includegraphics\expandafter[\hv at extern@grfOptions,page=\next]%
-             {\hv at extern@ExamplesDir\hvExternDateiname}%
-              \hspace{\hv at extern@pagesep}}\hspace*{-\hv at extern@pagesep}%
+             {\hv at extern@ExamplesDir\hvExternDateiname}\hspace{\hv at extern@pagesep}}%
+         \hspace*{-\hv at extern@pagesep}%
        \fi
        \ifx\hv at extern@caption\@empty\else\caption{\hv at extern@caption}\fi
        \ifx\hv at extern@label\@empty\else\label{\hv at extern@label}\fi
        \ifhv at extern@float
-         \end{figure}%
+         \endfigure
        \else
          \ifdim\hv at extern@mpwidth>\z@  \endminipage\else\par\endgroup\fi
        \fi
@@ -474,28 +524,26 @@
    \else% no graphic, only text
      \ifdim\hv at extern@mpwidth>\z@ 
        \hfill\minipage[t]{\dimexpr\linewidth-\hv at extern@mpwidth-\hv at extern@mpsep\relax}\vspace{0pt}
-       \noindent
        \ifhv at extern@usefancyvrb
-         \expandafter\BodyVerbatim\expandafter[\hv at extern@lstOptions]{\hv at extern@ExamplesDir\hvExternDateiname.txt}%
+         \expandafter\VerbatimInput\expandafter[\hv at extern@textOptions]{\hv at extern@ExamplesDir\hvExternDateiname.txt}%
        \else
-         \expandafter\BodyListing\expandafter[\hv at extern@lstOptions]{\hv at extern@ExamplesDir\hvExternDateiname.txt}%
+         \expandafter\lstinputlisting\expandafter[\hv at extern@textOptions]{\hv at extern@ExamplesDir\hvExternDateiname.txt}%
        \fi
        \endminipage
      \else
+       \vspace{\hv at extern@belowbodyskip}
        \noindent
        \ifhv at extern@usefancyvrb
-         \expandafter\BodyVerbatim\expandafter[\hv at extern@lstOptions]{\hv at extern@ExamplesDir\hvExternDateiname.txt}%
+         \expandafter\VerbatimInput\expandafter[\hv at extern@textOptions]{\hv at extern@ExamplesDir\hvExternDateiname.txt}%
        \else
-         \expandafter\BodyListing\expandafter[\hv at extern@lstOptions]{\hv at extern@ExamplesDir\hvExternDateiname.txt}%
+         \expandafter\lstinputlisting\expandafter[\hv at extern@textOptions]{\hv at extern@ExamplesDir\hvExternDateiname.txt}%
        \fi
      \fi
    \fi
    \ifhv at extern@force\expandafter\run at hv@extern at cleanup\expandafter{\hv at extern@cleanup}\fi%   cleanup
+  \vspace{\hv at extern@belowskip}%
 }
 
-\stepcounter{hv at example@counter}%
-
-
 \newcommand\runExtCmd[3][]{%
   \begingroup
   \setkeys{hv}{code=false,includegraphic=false,#1}%
@@ -514,7 +562,7 @@
      \else
        \ifhv at extern@float
          \hv at typeout{>>>> Floating environment}% 
-         \begin{figure}[!htb]
+         \expandafter\figure\expandafter[\hv at extern@floatsetting]
        \else
          \hv at typeout{>>>> No floating environment}% 
          \par\noindent\begingroup
@@ -522,9 +570,12 @@
        \hv at extern@align
        \hv at typeout{>>>> Input image \hv at extern@ExamplesDir\hvExternDateiname}% 
        \ifhv at extern@frame
+         \begingroup
+         \fboxsep=\hv at extern@framesep
          \expandafter\@for\expandafter\next\expandafter:\expandafter=\hv at extern@pages\do{%
            \fbox{\expandafter\includegraphics\expandafter[\hv at extern@grfOptions,page=\next]{\hv at extern@ExamplesDir\hvExternDateiname}}%
               \hspace{5pt}}\hspace*{-5pt}%
+         \endgroup
        \else
          \expandafter\@for\expandafter\next\expandafter:\expandafter=\hv at extern@pages\do{%
            \expandafter\includegraphics\expandafter[\hv at extern@grfOptions,page=\next]%
@@ -534,7 +585,7 @@
        \ifx\hv at extern@caption\@empty\else\caption{\hv at extern@caption}\fi
        \ifx\hv at extern@label\@empty\else\label{\hv at extern@label}\fi
        \ifhv at extern@float
-         \end{figure}%
+         \endfigure
        \else
          \ifdim\hv at extern@mpwidth>\z@  \endminipage\else\par\endgroup\fi
        \fi
@@ -542,7 +593,7 @@
    \else% no graphic, only text
      \ifhv at extern@float
        \hv at typeout{>>>> Floating environment}% 
-       \begin{figure}[!htb]
+       \expandafter\figure\expandafter[!htb]
        \ifhv at extern@usefancyvrb
          \expandafter\BodyVerbatim\expandafter[\hv at extern@lstOptions]{\hv at extern@ExamplesDir\hvExternDateiname.txt}
        \else     
@@ -550,7 +601,7 @@
        \fi
        \ifx\hv at extern@caption\@empty\else\caption{\hv at extern@caption}\fi
        \ifx\hv at extern@label\@empty\else\label{\hv at extern@label}\fi
-       \end{figure}
+       \endfigure
      \else
        \noindent
        \ifhv at extern@usefancyvrb
@@ -563,6 +614,9 @@
    \ifhv at extern@force\expandafter\run at hv@extern at cleanup\expandafter{\hv at extern@cleanup}\fi%   cleanup
   \endgroup
 }
+
+\stepcounter{hv at example@counter}%
+
 %
 %%
 \endinput



More information about the tex-live-commits mailing list.