summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/hvextern/latex/hvextern.sty
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/hvextern/latex/hvextern.sty')
-rw-r--r--macros/latex/contrib/hvextern/latex/hvextern.sty116
1 files changed, 78 insertions, 38 deletions
diff --git a/macros/latex/contrib/hvextern/latex/hvextern.sty b/macros/latex/contrib/hvextern/latex/hvextern.sty
index 16e127376f..5aaeb26f49 100644
--- a/macros/latex/contrib/hvextern/latex/hvextern.sty
+++ b/macros/latex/contrib/hvextern/latex/hvextern.sty
@@ -1,4 +1,4 @@
-%% $Id: hvextern.sty 882 2024-03-22 19:23:40Z herbert $
+%% $Id: hvextern.sty 884 2024-03-27 19:50:43Z herbert $
%% This is file `hvextern.sty',
%%
%% Copyright (C) 2016-24
@@ -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.40}
-\ProvidesFile{hvextern}[2024/03/22 v\hvexternFileversion: package for running external documents (HV)]
+\def\hvexternFileversion{0.41}
+\ProvidesFile{hvextern}[2024/03/27 v\hvexternFileversion: package for running external documents (HV)]
\newif\ifhv@extern@checkCode
\hv@extern@checkCodefalse
@@ -73,6 +73,7 @@
\newlength\hv@extern@mpwidth \setlength\hv@extern@mpwidth{\z@}
\newif\ifhv@extern@save@force@state
+\newif\ifhv@extern@runR
\define@key{hv}{progpath}{\def\hv@extern@progpath{#1}}
\define@key{hv}{runsequence}[]{\def\hv@extern@runsequence{#1}}
@@ -86,7 +87,7 @@
\define@key{hv}{BOpreamble}[black!12]{\def\hv@extern@BOpreamble{#1}}
\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]{%
+%\define@choicekey*+{hv}{docType}[\val\nr]{latex,mp,tex,py,pl,lua,java,context,sh,R}[latex]{%
% \hv@typeout{doc type \nr}%
% \def\hv@extern@docType{\val}%
%}{\PackageWarning{hvextern}{erroneous input (#1) for docType ignored. Using latex.}%
@@ -134,15 +135,32 @@
\define@boolkey{hv}[hv@extern@]{eps}[true]{}
\define@boolkey{hv}[hv@extern@]{verbose}[true]{}
-\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) \val}%
- \def\hv@extern@compiler{\val}%
- \edef\hv@extern@compilerNo{\nr}%
-}{\PackageWarning{hvextern}{unknown compiler type (#1). Maybe you should define a run sequence???}%
- \def\hv@extern@compiler{#1}%
- \def\hv@extern@compilerNo{-1}%
- }
+\ifwindows
+ \define@choicekey*+{hv}{compiler}[\val\nr]{mpost.exe,tex.exe,latex.exe,luatex.exe,%
+ python3.exe,perl.exe,lua.exe,java.exe,%
+ xetex.exe,pdflatex.exe,lualatex.exe,xelatex.exe,context.exe,sh,%
+ texlua.exe,Rscript.exe}[pdflatex.exe]{%
+ \hv@ex@typeout{Compiler type (\nr) \val}%
+ \def\hv@extern@compiler{\val}%
+ \edef\hv@extern@compilerNo{\nr}%
+ \ifnum\nr=15 \hv@extern@runRtrue\else\hv@extern@runRfalse\fi
+ }{\PackageWarning{hvextern}{unknown compiler type (#1). Maybe you should define
+ a run sequence???}%
+ \def\hv@extern@compiler{#1}%
+ \def\hv@extern@compilerNo{-1}%
+ }
+\else
+ \define@choicekey*+{hv}{compiler}[\val\nr]{mpost,tex,latex,luatex,python3,perl,lua,java,%
+ xetex,pdflatex,lualatex,xelatex,context,sh,texlua,Rscript}[pdflatex]{%
+ \hv@ex@typeout{Compiler type (\nr) \val}%
+ \def\hv@extern@compiler{\val}%
+ \edef\hv@extern@compilerNo{\nr}%
+ \ifnum\nr=15 \hv@extern@runRtrue\else\hv@extern@runRfalse\fi
+ }{\PackageWarning{hvextern}{unknown compiler type (#1). Maybe you should define a run sequence???}%
+ \def\hv@extern@compiler{#1}%
+ \def\hv@extern@compilerNo{-1}%
+ }
+\fi
\define@boolkey{hv}[hv@extern@]{shellesc}[true]{}
\define@key{hv}{aboveskip}[\medskipamount]{\setlength\hv@extern@aboveskip{#1}}
\define@key{hv}{belowpreambleskip}[2pt]{\setlength\hv@extern@belowpreambleskip{#1}}
@@ -156,57 +174,57 @@
\setkeys{hv}{%
align=\centering,% Ausgabe zentrieren
aboveskip=\medskipamount,% space above everything
- belowpreambleskip=2pt, %\smallskipamount,% space below preamble
- belowbodyskip=2pt, %\smallskipamount,% space below body
+ belowpreambleskip=2pt,%\smallskipamount,% space below preamble
+ belowbodyskip=2pt, %\smallskipamount,% space below body
belowskip=\medskipamount,% space below everything
BGpreamble=black!12,% Backgroundcolor for preamble
BGbody=black!8,% Backgroundcolor for body
BOpreamble=black!12,% Bodercolor for preamble
BObody=black!8,% Bodercolor for body
- biber=false,% Biber laufen lassen?
+ biber=false,% Biber laufen lassen?
caption=,% keine Caption
cleanup={},% Hilfsdateien nicht löschen
code=false,% show Code
compiler=pdflatex,% zu verwendener Compiler
- crop=false,% erzeugte PDF "croppen"
+ crop=false,% erzeugte PDF "croppen"
cropmargin=2,% 2pb margin
- docType=latex,% LaTeX example Code
+ docType=latex,% LaTeX example Code
eps=false,% create an eps output?
ExampleDir=Examples,% Unterverzeichnis für Beispiele
ext=tex,% file extension
- float=false,% nicht als Gleitumgebung
+ float=false,% nicht als Gleitumgebung
floatsetting=!htb,% placement
- force=true,% Compiler, auch wenn PDF existiert?
- frame=false,% keinen Rahmen um Abbildung
+ force=true,% Compile, auch wenn PDF existiert?
+ frame=false,% keinen Rahmen um Abbildung
framesep=\the\fboxsep,%
- grfOptions={},% Optionen der einzubindenden Grafik
+ grfOptions={},% Optionen der einzubindenden Grafik
includegraphic=true,% Grafik einbinden oder User überlassen
inline=false,% Grafik nicht in derselben Zeile
- label=,% kein Label
- lstOptions={},% Optionen für das Listing
+ label=,% kein Label
+ lstOptions={},% Optionen für das Listing
moveToExampleDir=false,% Verschieben nach ExamplesDir
mpwidth=0pt,% no minipage
mpsep=1em,% sep between two minipages
mpvalign=t,% if side by side output the vertical alignment
outerFN=false,% use fullwidth in twocolumn mode (starred floats)
- pages=1,% welche Seiten auszugeben sind
+ pages=1,% welche Seiten auszugeben sind
pagesep=1em,% horizontal sep between pages
- progpath={},
+ progpath={},%
redirect=false,% write output into a file *.txt
- runs=1,% Anzahl Compiler-Durchläufe
- runsAfter=0, % Anzahl Durchläufe nach makeindex
- runsequence={},% Im Moment nicht aktiv
- shellesc=false,% use shell-escape
+ runs=1,% Anzahl Compiler-Durchläufe
+ runsAfter=0, % Anzahl Durchläufe nach makeindex
+ runsequence={},% Im Moment nicht aktiv
+ shellesc=false,% use shell-escape
shiftFN=\z@,% raise printed filename
showFilename=false,% Filenamen im Rand angeben
- showoutput=true,% with false only code is shown
+ showoutput=true,% with false only code is shown
tcbox=true,% use tcolorbox
- textOptions={},% Options for text output
+ textOptions={},% Options for text output
usefancyvrb=false,% use VerbatimInput instead of listings
verbose=false,% no extra output in the logfile
vshift=\z@,% raise object (pdf) with \raisebox{}{}
- xindex=false,% xindex laufen lassen?
- xindexOptions={},% options for xindex
+ xindex=false,% xindex laufen lassen?
+ xindexOptions={},% options for xindex
mposttex=tex,% mpost program tex or latex
}%
}
@@ -441,6 +459,14 @@
{\NumChar StartVisiblePreamble}
{\NumChar StopVisiblePreamble}
+%---- R
+%\input{hvextern-R.cfg}
+\hv@extern@ExampleType{R}
+ {\NumChar StartVisibleMain}
+ {\NumChar StopVisibleMain}
+ {\NumChar StartVisiblePreamble}
+ {\NumChar StopVisiblePreamble}
+
%%%--------------------------------- end config part ------------------
@@ -518,12 +544,21 @@
\hv@ex@typeout{running \hv@extern@compiler~ \hvExternFilename\hv@extern@ext > \hvExternFilename.txt}%
\ShellEscape{\hv@extern@progpath\hv@extern@compiler\space\hvExternFilename\hv@extern@ext\space > \hvExternFilename.txt}%
\else
- \hv@ex@typeout{running \hv@extern@compiler~\hv@run@options~\hvExternFilename\hv@extern@ext}%
- \ShellEscape{\hv@extern@progpath\hv@extern@compiler\space\hv@run@options\space\hvExternFilename\hv@extern@ext}%
+ \ifwindows
+ \hv@ex@typeout{running \hv@extern@compiler~\hv@run@options~\hvExternFilename\hv@extern@ext}%
+ \ShellEscape{"\hv@extern@progpath\hv@extern@compiler" \hv@run@options\space\hvExternFilename\hv@extern@ext}%
+ \else
+ \hv@ex@typeout{running \hv@extern@compiler~\hv@run@options~\hvExternFilename\hv@extern@ext}%
+ \ShellEscape{\hv@extern@progpath\hv@extern@compiler\space\hv@run@options\space\hvExternFilename\hv@extern@ext}%
+ \fi
\fi
\fi
\addtocounter{@@@runs}{-1}%
\repeat
+ \ifhv@extern@runR % we have Rscript
+ \hv@ex@typeout{copy r-dummy.pdf to \hvExternFilename.pdf}%
+ \ShellEscape{\hv@move\space Rplots.pdf \hvExternFilename.pdf}%
+ \fi
\hv@ex@typeout{... done}%
\ifhv@extern@biber
\ShellEscape{biber \hvExternFilename}% NAch biber nochmal latex
@@ -551,8 +586,13 @@
\hv@ex@typeout{running \hv@extern@compiler~ \hvExternFilename\hv@extern@ext > \hvExternFilename.txt}%
\ShellEscape{\hv@extern@progpath\hv@extern@compiler\space\hvExternFilename\hv@extern@ext\space > \hvExternFilename.txt}%
\else
- \hv@ex@typeout{running \hv@extern@compiler~ \hvExternFilename\hv@extern@ext}%
- \ShellEscape{\hv@extern@progpath\hv@extern@compiler\space\hvExternFilename\hv@extern@ext}%
+ \ifwindows
+ \hv@ex@typeout{running \hv@extern@compiler~ \hvExternFilename\hv@extern@ext}%
+ \ShellEscape{"\hv@extern@progpath\hv@extern@compiler" \hvExternFilename\hv@extern@ext}%
+ \else
+ \hv@ex@typeout{running \hv@extern@compiler~ \hvExternFilename\hv@extern@ext}%
+ \ShellEscape{\hv@extern@progpath\hv@extern@compiler\space\hvExternFilename\hv@extern@ext}%
+ \fi
\fi
\fi
\addtocounter{@@@runs}{-1}%