diff options
Diffstat (limited to 'macros/latex/contrib/hvextern')
-rw-r--r-- | macros/latex/contrib/hvextern/Changes | 2 | ||||
-rw-r--r-- | macros/latex/contrib/hvextern/doc/hvdoctools.sty | 7 | ||||
-rw-r--r-- | macros/latex/contrib/hvextern/doc/hvextern.pdf | bin | 1195275 -> 1202031 bytes | |||
-rw-r--r-- | macros/latex/contrib/hvextern/doc/hvextern.tex | 122 | ||||
-rw-r--r-- | macros/latex/contrib/hvextern/latex/hvextern.sty | 94 |
5 files changed, 161 insertions, 64 deletions
diff --git a/macros/latex/contrib/hvextern/Changes b/macros/latex/contrib/hvextern/Changes index 512bf9c194..0204c888fb 100644 --- a/macros/latex/contrib/hvextern/Changes +++ b/macros/latex/contrib/hvextern/Changes @@ -1,5 +1,7 @@ hvextern.sty ---------------- +v 0.23 2022-05-08 - added \runExtCmd + - added doctype shell v 0.22 2022-05-05 - added mpvalign, tclbox v 0.21 2022-04-30 - added java support v 0.20 2022-04-27 - use L3 for the comma separated lists diff --git a/macros/latex/contrib/hvextern/doc/hvdoctools.sty b/macros/latex/contrib/hvextern/doc/hvdoctools.sty index 04cdd46724..23ff524a9a 100644 --- a/macros/latex/contrib/hvextern/doc/hvdoctools.sty +++ b/macros/latex/contrib/hvextern/doc/hvdoctools.sty @@ -24,13 +24,17 @@ \def\Lprog#1{\texttt{#1}\index{#1@\texttt{#1} (program)}} \def\Lcolor#1{\texttt{#1}\index{#1@\texttt{#1} (color)}} \def\Loption#1{\texttt{#1}\index{#1@\texttt{#1} (package option)}} -\def\Lkeyword#1{\texttt{#1}\index{#1@\texttt{#1} (keyword)}} +\def\Lkeyword#1{\texttt{#1}\index{#1@\texttt{#1} (keyword)}\index{Keyword!#1@\texttt{#1}}} \def\Lkeyval#1{\texttt{#1}\index{#1@\texttt{#1} (value)}} \def\Lskip#1{\texttt{\textbackslash#1}\index{#1@\texttt{\textbackslash#1} (skip)}} \def\Lkeyset#1{\expandafter\Lkeyset@i#1\@nil} \def\Lkeyset@i#1=#2\@nil{\texttt{#1=#2}% \index{#1@\texttt{#1} (keyword)}\index{Keyword!#1@\texttt{#1}} \index{#2@\texttt{#2} (value)}\index{Value!#2@\texttt{#2}}} + +\def\LKeyset#1{\expandafter\LKeyset@i#1\@nil} +\def\LKeyset@i#1=#2\@nil{\texttt{#1=#2}% + \index{#1@\texttt{#1} (keyword)}\index{Keyword!#1@\texttt{#1}}} \newsavebox\boxdef \newenvironment{BDef} {\begin{lrbox}{\boxdef} @@ -40,6 +44,7 @@ {\BCmd\fbox{\usebox\boxdef}\endBCmd} \aftergroup\@afterindentfalse\aftergroup\@afterheading } +\def\Lclass#1{\texttt{#1}\index{#1@\texttt{#1} (doc class)}} \newskip\BDefaboveskip \newskip\BDefbelowskip diff --git a/macros/latex/contrib/hvextern/doc/hvextern.pdf b/macros/latex/contrib/hvextern/doc/hvextern.pdf Binary files differindex 2817fa93b8..c521b487ea 100644 --- a/macros/latex/contrib/hvextern/doc/hvextern.pdf +++ b/macros/latex/contrib/hvextern/doc/hvextern.pdf diff --git a/macros/latex/contrib/hvextern/doc/hvextern.tex b/macros/latex/contrib/hvextern/doc/hvextern.tex index c26ac017a0..8c104803e6 100644 --- a/macros/latex/contrib/hvextern/doc/hvextern.tex +++ b/macros/latex/contrib/hvextern/doc/hvextern.tex @@ -30,7 +30,7 @@ from within a main \LaTeX\ document~--v. \hvexternFileversion} \newpage -\setkeys{hv}{moveToExampleDir,ExampleDir=Examples,showFilename} +\setkeys{hv}{moveToExampleDir,ExampleDir=Examples,showFilename,verbose} \section{Syntax} \begin{verbatim} @@ -44,7 +44,7 @@ it into the main \LaTeX\ document. \end{sloppypar} -There is only one environment: +There is only one environment and one command: \begin{verbatim} \begin{externalDocument}[<options>]{<external filename without extension>} @@ -52,6 +52,8 @@ There is only one environment: source code ... \end{externalDocument} + +\runExtCmd[<options>]{<command with arguments>}{<external filename without extension>} \end{verbatim} The main document \emph{must} be run with the \Loption{-shell-escape} option, otherwise it won't work, e.g.: @@ -71,7 +73,7 @@ automatically in the main document.. \noindent \fbox{\begin{minipage}{\dimexpr\linewidth-2\fboxsep-2\fboxrule\relax} \emph{All} examples in this document are created on-the-fly while running this \LaTeX\ document -with \texttt{lualatex} with the \texttt{-\kern2pt-shell-escape} option. +with \texttt{lualatex} with the \texttt{-\kern1pt-shell-escape} option. \end{minipage}} @@ -114,7 +116,7 @@ shown by the environment \Lenv{externalDocument}. \end{minipage} \begin{minipage}{.39\linewidth} \begin{externalDocument}[ - compiler=pdflatex,force,cleanup={log,aux},verbose]{voss} + compiler=pdflatex,force=false,cleanup={log,aux},verbose]{voss} \documentclass{standalone} %StartVisiblePreamble \usepackage{fontenc} @@ -172,7 +174,7 @@ catagory, which is done internally by the package. The complete definition of th showFilename, code, ext=py, - force, + force=false, docType=py, usefancyvrb, grfOptions={width=\linewidth}]{python} @@ -222,7 +224,7 @@ line in the above code shows how it can be done with Python. \begin{externalDocument}[ compiler=python3, progpath=/usr/local/bin/, - force, + force=false, showFilename, runs=1, code, @@ -271,7 +273,7 @@ image.save(imageName+".png", "PNG") \begin{externalDocument}[grfOptions={width=0.95\linewidth}, compiler=xelatex,code,mpwidth=0.6\linewidth, - crop,cleanup,force,usefancyvrb=false,ext=tex]{voss} + crop,cleanup,force=false,usefancyvrb=false,ext=tex]{voss} \documentclass{article} %StartVisiblePreamble \usepackage{tikz} @@ -354,7 +356,7 @@ ext=lua, compiler=lua, docType=lua, ... The default setting is always shown in brackets. \subsection{Programs and runs} -The \texttt{progpath} should only in some +The \Lkeyword{progpath} should only in some rare cases needed. In general all used compilers will be found by the system. A given \Lkeyword{progpath} must be end with a slash, e.g. \Lkeyval{./bin/} @@ -366,9 +368,9 @@ must be end with a slash, e.g. \Lkeyval{./bin/} \end{verbatim} Instead of the optional arguments - \\Lkeyword{compiler}, \\Lkeyword{biber}, and \\Lkeyword{xindex} one can define an individual + \Lkeyword{compiler}, \Lkeyword{biber}, and \Lkeyword{xindex} one can define an individual command sequence by using the optional argument - \\Lkeyword{runsequence}. It must be comma separated list: + \Lkeyword{runsequence}. It must be comma separated list: \begin{verbatim} runsequence={lualatex,biber,xindex -l de -c AU,lualatex,lualatex} @@ -381,7 +383,7 @@ runsequence={lualatex,biber,xindex -l de -c AU,lualatex,lualatex} runsequence={lualatex,biber,xindex -l de -c AU,lualatex,lualatex}, showFilename, verbose, - force, + force=false, cleanup={log,aux,toc,bbl,blg}, code,docType=latex, lstOptions={columns=fixed}]{voss} @@ -420,7 +422,7 @@ the environment \Lenv{externalDocument} is: \begin{externalDocument}[ verbose, compiler=java,ext=java,code, - force,docType=java,includegraphic, + force=false,docType=java,includegraphic, usefancyvrb,grfOptions={width=0.9\linewidth}]{java} import java.awt.Color; import java.awt.Graphics; @@ -484,7 +486,7 @@ public class Main { \end{externalDocument} - +%$ \subsection{Grafik options} @@ -545,7 +547,7 @@ to \Lcs{VerbatimInput}. The following example uses mpwidth=0.6\linewidth, crop, cleanup, - force, + force=false, docType=latex]{voss} \RequirePackage{pdfmanagement-testphase} \DeclareDocumentMetadata{} @@ -571,7 +573,7 @@ There are different colors for the preamble and body listing: the backgrund and \define@key{hv}{BObody}[black8]{\def\hv@extern@BObody{#1}} \end{verbatim} -The options are passed to \Lpack{tcolorbox} and preset to \Lcolor{black12} and \Lcolor{black!8}. +The options are passed to \Lpack{tcolorbox} and preset to \Lcolor{black"!12} and \Lcolor{black"!8}. The color of the frame is set to the same values, hence not seen. The following example uses \begin{verbatim} @@ -591,7 +593,7 @@ The color of the frame is set to the same values, hence not seen. The following mpwidth=0.6\linewidth, crop, cleanup, - force, + force=false, usefancyvrb, docType=latex]{voss} \RequirePackage{pdfmanagement-testphase} @@ -668,7 +670,7 @@ The image Figure~\ref{img:cox} shows an example for a floting object. % mpwidth=0.6\linewidth, crop, cleanup, - force, + force=false, usefancyvrb, float, caption={An example for Coxeter images}, @@ -730,7 +732,7 @@ The following example uses: % mpwidth=0.6\linewidth, % crop, cleanup, - force, + force=false, frame, % usefancyvrb, % float, @@ -756,7 +758,7 @@ The following example uses: \subsection{Cropping the PDF} -Instead of using the \Index{documentclass} \Lcs{standalone}, which already crops the created PDF, +Instead of using the \Index{documentclass} \Lclass{standalone}, which already crops the created PDF, one can use the optional argument \Lkeyword{crop}. \begin{verbatim} @@ -789,7 +791,7 @@ The follwoing example was created with % mpwidth=0.6\linewidth, crop, cropmargin=5, cleanup, - force, + force=false, frame, % usefancyvrb, % float, @@ -849,7 +851,7 @@ or \Lkeyval{b}. code, crop, cleanup, - force, + force=false, docType=latex]{voss} \documentclass{article} \pagestyle{empty} @@ -872,7 +874,7 @@ or \Lkeyval{b}. code, crop, cleanup, - force, + force=false, docType=latex]{voss} \documentclass{article} \pagestyle{empty} @@ -896,7 +898,7 @@ or \Lkeyval{b}. code, crop, cleanup, - force, + force=false, docType=latex]{voss} \documentclass{article} \pagestyle{empty} @@ -920,7 +922,7 @@ or \Lkeyval{b}. code, crop, cleanup, - force, + force=false, mpwidth=0.5\linewidth, docType=latex]{voss} \documentclass{article} @@ -944,7 +946,7 @@ or \Lkeyval{b}. code, crop, cleanup, - force, + force=false, mpwidth=0.5\linewidth, docType=latex]{voss} \documentclass{article} @@ -969,7 +971,7 @@ or \Lkeyval{b}. code, crop, cleanup, - force, + force=false, mpwidth=0.5\linewidth, docType=latex]{voss} \documentclass{article} @@ -981,18 +983,18 @@ or \Lkeyval{b}. \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 current line. This may make sense, if you need characters which are +image can be part of the \Index{current line}. This may make sense, if you need characters which are not part of your current font. \begin{verbatim} \define@boolkey{hv}[hv@extern@]{inline}[true]{\hv@extern@codefalse} \end{verbatim} -With \texttt{inline=true} the optional argument \texttt{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, docType=latex]{voss}% + crop, cropmargin=0, cleanup, force=false, docType=latex]{voss}% \documentclass{ctexart} \pagestyle{empty} \begin{document} @@ -1008,7 +1010,7 @@ With \Lkeyset{inline} the optional argument \Lkeyword{code} is automatically set next Chinese characters \begin{externalDocument}[ compiler=xelatex, inline, runs=2, grfOptions={height=8pt}, - crop, cropmargin=0, cleanup, force, docType=latex]{voss} + crop, cropmargin=0, cleanup, force=false, docType=latex]{voss} \documentclass{ctexart} \pagestyle{empty} \begin{document} @@ -1020,9 +1022,9 @@ are inserted as inline image without showing the code. The complete code looks l \subsection{Input text instead of an image} -By default the created pdf which can be, of course, only test, wil be insert by \verb|\incudegraphics|. -If you have only text as output and dont want to create a pdf you can insert this kind of -output as verbatim text by setting \verb|includegraphic=false|. +By default the created pdf which can be, of course, only text, will be inserted by \Lcs{includegraphics}. +If you have only text as output and don't want to create a pdf you can insert this kind of +output as verbatim text by setting \Lkeyset{includegraphic=false}. \begin{verbatim} \define@boolkey{hv}[hv@extern@]{includegraphic}[true]{} @@ -1046,7 +1048,7 @@ sorted digits of the number $A$: $495=954-459$. \begin{externalDocument}[ - compiler=perl, force, docType=pl, ext=pl, includegraphic=false, + compiler=perl, force=false, docType=pl, ext=pl, includegraphic=false, code, mpwidth=0.6\linewidth]{voss} #!/usr/bin/perl # @@ -1101,7 +1103,7 @@ outFile = io.open(shortFN..".txt","w+") -- open external file \begin{externalDocument}[ - compiler=lua, force, docType=lua, ext=lua, includegraphic=false, code, usefancyvrb=false]{voss} + compiler=lua, force=false, docType=lua, ext=lua, includegraphic=false, code, usefancyvrb=false]{voss} #!/usr/bin/env lua local filename = arg[0] local shortFN = filename:match("(.+)%..+") @@ -1140,7 +1142,7 @@ outFile:close() \subsection{Running additional external programs} -For a \LaTeX\ additional programs for bibliography, index, a.s.o. maybe needed. +For a \LaTeX\ additional programs for \Index{bibliography}, \Index{index}, a.s.o. maybe needed. \begin{verbatim} \define@boolkey{hv}[hv@extern@]{biber}[true]{} @@ -1174,7 +1176,7 @@ The following examples uses pages=2, crop, cleanup, - force, + force=false, xindex, xindexOptions={-l DE --config AU}, mpwidth=0.6\linewidth, @@ -1230,7 +1232,7 @@ runsequence={lualatex,biber,{xindex -l de -c AU},lualatex,lualatex} runsequence={lualatex,biber,xindex -l de -c AU,lualatex,lualatex}, showFilename, verbose, - force, + force=false, cleanup={log,aux,toc,bbl,blg}, code,docType=latex, lstOptions={columns=fixed}]{voss} @@ -1264,7 +1266,7 @@ Sort with xindex \verb|-l DE --config AU| \subsection{Using \texttt{listings}} -The default is using \verb|\lstinputlisting| for the printed code sequences. +The default is using \Lcs{lstinputlisting} for the printed code sequences. \begin{externalDocument}[ grfOptions={width=0.45\linewidth}, @@ -1272,7 +1274,7 @@ The default is using \verb|\lstinputlisting| for the printed code sequences. frame,compiler=pdflatex, showFilename, % crop, - force,runs=2,code,docType=latex, + force=false,runs=2,code,docType=latex, frame, lstOptions={columns=fixed}]{voss} %StartVisiblePreamble @@ -1322,7 +1324,7 @@ The default is using \verb|\lstinputlisting| for the printed code sequences. -It also possible to use \verb|\VerbatimInput| from package \texttt{fancyvrb}. In general +It also possible to use \Lcs{VerbatimInput} from package \Lpack{fancyvrb}. In general it makes no difference using the optional argument \Lkeyword{usefancyvrb} or not. @@ -1332,7 +1334,7 @@ it makes no difference using the optional argument \Lkeyword{usefancyvrb} or not frame,compiler=pdflatex, showFilename, % crop, - force,runs=2,code,docType=latex, + force=false,runs=2,code,docType=latex, frame,usefancyvrb]{voss} %StartVisiblePreamble \documentclass[chapterprefix=on,parskip=half-,DIV=12,fontsize=12pt]{scrbook} @@ -1392,7 +1394,7 @@ it makes no difference using the optional argument \Lkeyword{usefancyvrb} or not compiler=mpost, showFilename, % crop, - force, + force=false, cleanup, code, docType=mp, @@ -1424,7 +1426,7 @@ end; compiler=tex, showFilename, % crop, - force, + force=false, code, docType=tex, ext=tex,]{voss} @@ -1488,7 +1490,7 @@ This is the start of the introduction. compiler=lualatex, showFilename, crop, - force, + force=false, code, docType=latex, ext=tex,]{voss} @@ -1528,7 +1530,7 @@ This is the start of the introduction. compiler=context, showFilename, runs=2, - force, + force=false, code, docType=context, ext=tex,]{voss} @@ -1569,18 +1571,32 @@ foo \end{externalDocument} +\section{Running external commands} +Integrating the current directory of this document we can use the macro \Lcs{runExtCmd} with +the optional argument \Lkeyword{redirect} + +\begin{verbatim} +\runExtCmd[redirect]{ls -la}{voss} +\end{verbatim} + +to get the directory listed: + +\medskip +\runExtCmd[redirect,verbose]{ls -la}{voss} + + \section{Other options} \begin{description} -\item[\texttt{force=false}] can speed up the comiling time for the document. If a created image/output +\item[\Lkeyset{force=false}] can speed up the comiling time for the document. If a created image/output already exists, there is no need to create it with the next run again and again. -\item[\texttt{cleanup}] the auxiliary files of a \LaTeX-run are deleted, preset to \texttt{.aux}, \texttt{.log}. +\item[\Lkeyword{cleanup}] the auxiliary files of a \LaTeX-run are deleted, preset to \texttt{aux}, \texttt{log}. It must be a comma seperated list of the extensions of the main file, s.g. \texttt{cleanup=\{aux,log\}}. -\item[\texttt{copyToExampleDir}] name of a directory for the examples, must first be created by the user himself -\item[\texttt{ExamplesDir}] move all examples into a directory -\item[\texttt{tclbox=false}] Can be used if there are some negative interactions between package \texttt{listing} - and package \texttt{tcolorbox}. -\item[\texttt{eps}] create an eps from the pdf (historical) +\item[\Lkeyword{copyToExampleDir}] name of a directory for the examples, must first be created by the user himself +\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{eps}] create an eps from the pdf (historical). \end{description} diff --git a/macros/latex/contrib/hvextern/latex/hvextern.sty b/macros/latex/contrib/hvextern/latex/hvextern.sty index f728f941ae..5179123aa2 100644 --- a/macros/latex/contrib/hvextern/latex/hvextern.sty +++ b/macros/latex/contrib/hvextern/latex/hvextern.sty @@ -11,8 +11,8 @@ %% and version 1.3c or later is part of all distributions of LaTeX %% version 2005/12/01 or later. -\def\hvexternFileversion{0.22} -\ProvidesFile{hvextern}[2022/05/05 v\hvexternFileversion: package for running external documents (HV)] +\def\hvexternFileversion{0.23} +\ProvidesFile{hvextern}[2022/05/08 v\hvexternFileversion: package for running external documents (HV)] \RequirePackage{shellesc,xkeyval,graphicx,marginnote,fancyvrb,tikz,listings,ifplatform} \RequirePackage{tcolorbox,xparse} @@ -81,7 +81,7 @@ %\define@key{hv}{compiler}[pdflatex]{\def\hv@extern@compiler{#1}} \define@choicekey*+{hv}{compiler}[\val\nr]{mpost,tex,latex,luatex,python3,perl,lua,java,% - xetex,pdflatex,lualatex,xelatex,context}[pdflatex]{% + xetex,pdflatex,lualatex,xelatex,context,sh,texlua}[pdflatex]{% \hv@typeout{>>>> Compiler type \nr}% \def\hv@extern@compiler{\val}% \edef\hv@extern@compilerNo{\nr}% @@ -297,6 +297,15 @@ {//StopVisiblePreamble} +%---- Shell +%\input{hvextern-sh.cfg} +\hv@extern@ExampleType{sh} + {\NumChar StartVisibleMain} + {\NumChar StopVisibleMain} + {\NumChar StartVisiblePreamble} + {\NumChar StopVisiblePreamble} + + %%%--------------------------------- end config part ------------------ %% @@ -305,6 +314,7 @@ \newenvironment{externalDocument}[2][]{% \xdef\hvExternDateiname{#2-\arabic{hv@example@counter}}% \setkeys{hv}{#1}% \begin + \hv@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}{}{% @@ -332,10 +342,11 @@ \hv@typeout{>>>> running \hv@extern@compiler~ \hvExternDateiname\hv@extern@ext}% \hv@extern@runLATEX{\hv@extern@progpath}{\hv@extern@compiler}{\hvExternDateiname}{\hv@extern@ext}% \else - \hv@typeout{>>>> running \hv@extern@compiler~ \hvExternDateiname\hv@extern@ext}% \ifhv@extern@redirect + \hv@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}% \ShellEscape{\hv@extern@progpath\hv@extern@compiler\space\hvExternDateiname\hv@extern@ext}% \fi \fi @@ -350,7 +361,7 @@ \ShellEscape{xindex \hv@extern@xindexOptions\space \hvExternDateiname.idx}% NAch xindex nochmal latex \ShellEscape{\hv@extern@progpath\hv@extern@compiler\space\hvExternDateiname}% \fi - \else + \else % runsequence \expandafter\run@hv@extern@sequenceList\expandafter{\hv@extern@runsequence}% \fi \ifhv@extern@crop @@ -360,8 +371,9 @@ \ifhv@extern@eps \ShellEscape{pdftops -eps -f 1 -l 1 \hvExternDateiname.pdf}% \fi - \fi + \fi% end force \ifhv@extern@code%-------------- Code Part + \hv@typeout{>>>>Starting Code part ...}% \par\noindent \begingroup \ifdim\hv@extern@mpwidth>\z@ \minipage[\hv@extern@mpvalign]{\hv@extern@mpwidth}\vspace{0pt}\fi @@ -402,8 +414,8 @@ \fi \ifdim\hv@extern@mpwidth > \z@\relax \endminipage\fi \endgroup - \fi - \ifhv@extern@code\else + \fi % end code part + \ifhv@extern@code\else % only if no code \ifhv@extern@showFilename \hv@typeout{>>>> Set filename in the margin!}% \marginnote{\rotatebox{90}{\hvExternDateiname}}% @@ -412,6 +424,7 @@ \ifhv@extern@moveToExampleDir % \ShellEscape{mkdir\space\hv@extern@ExamplesDir/}% \hv@typeout{>>>> Move file into example dir}% + \hv@typeout{>>>>>>\hvExternDateiname ---- \hv@extern@ExamplesDir}% \ShellEscape{\hv@move \hvExternDateiname.*\space \hv@extern@ExamplesDir}% \fi \ifhv@extern@includegraphic @@ -452,15 +465,76 @@ \else% no graphic, only text \ifdim\hv@extern@mpwidth>\z@ \hfill\minipage[t]{\dimexpr\linewidth-\hv@extern@mpwidth-1em\relax}\vspace{0pt} - \noindent\VerbatimInput{\hv@extern@ExamplesDir\hvExternDateiname.txt} + \noindent\BodyListing{\hv@extern@ExamplesDir\hvExternDateiname.txt} \endminipage \else - \noindent\VerbatimInput{\hv@extern@ExamplesDir\hvExternDateiname.txt} + \noindent\BodyListing{\hv@extern@ExamplesDir\hvExternDateiname.txt} \fi \fi \ifhv@extern@force\expandafter\run@hv@extern@cleanup\expandafter{\hv@extern@cleanup}\fi% cleanup } + \stepcounter{hv@example@counter}% + + +\newcommand\runExtCmd[3][]{% + \begingroup + \setkeys{hv}{code=false,includegraphic=false,#1}% + \xdef\hvExternDateiname{#3-\arabic{hv@example@counter}}% + \hv@typeout{>>>> running #2}% + \ifhv@extern@redirect + \ShellEscape{\hv@extern@progpath#2 > \hv@extern@ExamplesDir\hvExternDateiname.txt}% + \else + \ShellEscape{\hv@extern@progpath#2}% + \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@typeout{>>>> Floating environment}% + \begin{figure}[!htb] + \else + \hv@typeout{>>>> No floating environment}% + \par\noindent\begingroup + \fi + \hv@extern@align + \hv@typeout{>>>> Input image \hv@extern@ExamplesDir\hvExternDateiname}% + \ifhv@extern@frame + \expandafter\@for\expandafter\next\expandafter:\expandafter=\hv@extern@pages\do{% + \fbox{\expandafter\includegraphics\expandafter[\hv@extern@grfOptions,page=\next]{\hv@extern@ExamplesDir\hvExternDateiname}}% + \hspace{5pt}}\hspace*{-5pt}% + \else + \expandafter\@for\expandafter\next\expandafter:\expandafter=\hv@extern@pages\do{% + \expandafter\includegraphics\expandafter[\hv@extern@grfOptions,page=\next]% + {\hv@extern@ExamplesDir\hvExternDateiname}% + \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 + \end{figure}% + \else + \ifdim\hv@extern@mpwidth>\z@ \endminipage\else\par\endgroup\fi + \fi + \fi + \else% no graphic, only text + \ifhv@extern@float + \hv@typeout{>>>> Floating environment}% + \begin{figure}[!htb] + \noindent\BodyListing{\hv@extern@ExamplesDir\hvExternDateiname.txt} + \ifx\hv@extern@caption\@empty\else\caption{\hv@extern@caption}\fi + \ifx\hv@extern@label\@empty\else\label{\hv@extern@label}\fi + \end{figure} + \else + \noindent\BodyListing{\hv@extern@ExamplesDir\hvExternDateiname.txt} + \fi + \fi + \ifhv@extern@force\expandafter\run@hv@extern@cleanup\expandafter{\hv@extern@cleanup}\fi% cleanup + \endgroup +} % %% \endinput |