texlive[70795] Master/texmf-dist: hvextern (28mar24)

commits+karl at tug.org commits+karl at tug.org
Thu Mar 28 21:07:42 CET 2024


Revision: 70795
          https://tug.org/svn/texlive?view=revision&revision=70795
Author:   karl
Date:     2024-03-28 21:07:42 +0100 (Thu, 28 Mar 2024)
Log Message:
-----------
hvextern (28mar24)

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	2024-03-28 01:16:33 UTC (rev 70794)
+++ trunk/Master/texmf-dist/doc/latex/hvextern/Changes	2024-03-28 20:07:42 UTC (rev 70795)
@@ -1,5 +1,7 @@
 hvextern.sty ----------------
 
+v 0.41  2024-03-27  - added compiler option=Rscript
+                    - fix for Windows and R runs
 v 0.40  2024-03-22  - added option mposttex for metapost program which
                       can be tex (default) | latex
 v 0.39  2024-01-30  - fixed bug with check for force option

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	2024-03-28 01:16:33 UTC (rev 70794)
+++ trunk/Master/texmf-dist/doc/latex/hvextern/hvextern.tex	2024-03-28 20:07:42 UTC (rev 70795)
@@ -1,4 +1,4 @@
-%% $Id: hvextern.tex 883 2024-03-22 19:29:21Z herbert $
+%% $Id: hvextern.tex 884 2024-03-27 19:50:43Z herbert $
 \DocumentMetadata{}% for lualatex and pstricks
 \documentclass[english,paper=a4,twoside,usegeometry]{scrartcl}
 \usepackage{babel}
@@ -41,7 +41,7 @@
 
 %\newpage
 
-\setkeys{hv}{moveToExampleDir,ExampleDir=Exa,showFilename,verbose,force=false}
+\setkeys{hv}{moveToExampleDir,ExampleDir=Exa,showFilename,verbose,force=true}
 
 
 %\clearpage
@@ -63,9 +63,12 @@
 
 \begin{sloppypar}
 This package allows to write external \MP, \TeX, \ConTeXt, \LaTeX, \LuaTeX, \LuaLaTeX, \XeTeX, \XeLaTeX, 
-\Index{Lua}, \Index{Perl}, \Index{Java} and/or \Index{Python}
+\Index{Lua}, \Index{Perl}, \Index{Java}, \Index{Python}, and /or \Index{R}
 source code, which will then be run via \texttt{shell escape} to create a PDF or text output to include
-it into the main \LaTeX\ document. 
+it into the main \LaTeX\ document. The values for the
+optional argument \Lkeyword{compiler}  must be the real prgram name  on the the local system, e.g. for Windows:
+mpost, tex, context.exe, latex.exe, luatex.exe, lualatex.exe, xetex.exe, xelatex.exe, 
+lua.exe, perl.exe, java.exe, pathon.exe, and /or Rscript.exe.
 \end{sloppypar}
 
 
@@ -418,6 +421,33 @@
 \define at key{hv}{runs}[1]{\setcounter{hv at extern@runs}{#1}}
 \end{verbatim}
 
+For Windows the \Lkeyword{progpath} should always be written with slashes and not
+backslashes. e.g.
+
+\begin{verbatim}
+  compiler=Rscript.exe,
+  progpath=C:/Program Files/R/R-4.3.3/bin/x64/,
+\end{verbatim}
+
+For macOS it is something like this:
+
+\begin{externalDocument}[
+  compiler=Rscript,
+  progpath=/opt/homebrew/bin/,
+  grfOptions={width=0.5\linewidth},
+  code=true,
+  usefancyvrb,
+  ext=R,
+  docType=R]{voss}
+#StartVisibleMain
+head(pressure) # Die ersten Werte der internen Datenliste
+pdf()          # erzeugt die PDF "Rplots.pdf"
+plot(pressure)
+#StopVisibleMain
+\end{externalDocument}
+
+
+
 Instead of the optional arguments
  \Lkeyword{compiler}, \Lkeyword{biber}, and \Lkeyword{xindex} one can define an individual
  command sequence by using the optional argument
@@ -539,8 +569,8 @@
 %$
 
 
+\clearpage
 
-
 \subsection{Grafik options}
 \begin{verbatim}
 \define at key{hv}{grfOptions}[]{\def\hv at extern@grfOptions{#1}}

Modified: trunk/Master/texmf-dist/tex/latex/hvextern/hvextern.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/hvextern/hvextern.sty	2024-03-28 01:16:33 UTC (rev 70794)
+++ trunk/Master/texmf-dist/tex/latex/hvextern/hvextern.sty	2024-03-28 20:07:42 UTC (rev 70795)
@@ -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 at extern@checkCode
 \hv at extern@checkCodefalse
@@ -73,6 +73,7 @@
 \newlength\hv at extern@mpwidth \setlength\hv at extern@mpwidth{\z@}
 
 \newif\ifhv at extern@save at force@state
+\newif\ifhv at extern@runR
 
 \define at key{hv}{progpath}{\def\hv at extern@progpath{#1}}
 \define at key{hv}{runsequence}[]{\def\hv at extern@runsequence{#1}}
@@ -86,7 +87,7 @@
 \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]{% 
+%\define at choicekey*+{hv}{docType}[\val\nr]{latex,mp,tex,py,pl,lua,java,context,sh,R}[latex]{% 
 %  \hv at typeout{doc type \nr}%
 %  \def\hv at extern@docType{\val}%
 %}{\PackageWarning{hvextern}{erroneous input (#1) for docType ignored. Using latex.}%
@@ -134,15 +135,32 @@
 \define at boolkey{hv}[hv at extern@]{eps}[true]{}
 \define at boolkey{hv}[hv at extern@]{verbose}[true]{}
 
-\define at choicekey*+{hv}{compiler}[\val\nr]{mpost,tex,latex,luatex,python3,perl,lua,java,%
-     xetex,pdflatex,lualatex,xelatex,context,sh,texlua}[pdflatex]{% 
-  \hv at ex@typeout{Compiler type (\nr) \val}%
-  \def\hv at extern@compiler{\val}%
-  \edef\hv at extern@compilerNo{\nr}%
-}{\PackageWarning{hvextern}{unknown compiler type (#1). Maybe you should define a run sequence???}%
-  \def\hv at extern@compiler{#1}%
-  \def\hv at extern@compilerNo{-1}%
- }
+\ifwindows
+  \define at 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 at ex@typeout{Compiler type (\nr) \val}%
+      \def\hv at extern@compiler{\val}%
+      \edef\hv at extern@compilerNo{\nr}%
+      \ifnum\nr=15 \hv at extern@runRtrue\else\hv at extern@runRfalse\fi
+  }{\PackageWarning{hvextern}{unknown compiler type (#1). Maybe you should define 
+      a run sequence???}%
+    \def\hv at extern@compiler{#1}%
+    \def\hv at extern@compilerNo{-1}%
+  }
+\else
+  \define at choicekey*+{hv}{compiler}[\val\nr]{mpost,tex,latex,luatex,python3,perl,lua,java,%
+     xetex,pdflatex,lualatex,xelatex,context,sh,texlua,Rscript}[pdflatex]{% 
+    \hv at ex@typeout{Compiler type (\nr) \val}%
+    \def\hv at extern@compiler{\val}%
+    \edef\hv at extern@compilerNo{\nr}%
+    \ifnum\nr=15 \hv at extern@runRtrue\else\hv at extern@runRfalse\fi
+  }{\PackageWarning{hvextern}{unknown compiler type (#1). Maybe you should define a run sequence???}%
+    \def\hv at extern@compiler{#1}%
+    \def\hv at extern@compilerNo{-1}%
+  }
+\fi
 \define at boolkey{hv}[hv at extern@]{shellesc}[true]{}
 \define at key{hv}{aboveskip}[\medskipamount]{\setlength\hv at extern@aboveskip{#1}}
 \define at key{hv}{belowpreambleskip}[2pt]{\setlength\hv at 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,7 +459,15 @@
   {\NumChar StartVisiblePreamble}
   {\NumChar StopVisiblePreamble}
 
+%---- R
+%\input{hvextern-R.cfg}
+\hv at extern@ExampleType{R}
+  {\NumChar StartVisibleMain}
+  {\NumChar StopVisibleMain}
+  {\NumChar StartVisiblePreamble}
+  {\NumChar StopVisiblePreamble}
 
+
 %%%---------------------------------  end config part ------------------
 
 %%
@@ -518,12 +544,21 @@
              \hv at ex@typeout{running \hv at extern@compiler~ \hvExternFilename\hv at extern@ext > \hvExternFilename.txt}%
              \ShellEscape{\hv at extern@progpath\hv at extern@compiler\space\hvExternFilename\hv at extern@ext\space > \hvExternFilename.txt}%
            \else
-             \hv at ex@typeout{running \hv at extern@compiler~\hv at run@options~\hvExternFilename\hv at extern@ext}%
-             \ShellEscape{\hv at extern@progpath\hv at extern@compiler\space\hv at run@options\space\hvExternFilename\hv at extern@ext}%
+             \ifwindows 
+               \hv at ex@typeout{running \hv at extern@compiler~\hv at run@options~\hvExternFilename\hv at extern@ext}%
+               \ShellEscape{"\hv at extern@progpath\hv at extern@compiler" \hv at run@options\space\hvExternFilename\hv at extern@ext}%
+             \else
+               \hv at ex@typeout{running \hv at extern@compiler~\hv at run@options~\hvExternFilename\hv at extern@ext}%
+               \ShellEscape{\hv at extern@progpath\hv at extern@compiler\space\hv at run@options\space\hvExternFilename\hv at extern@ext}%
+             \fi
            \fi
          \fi
          \addtocounter{@@@runs}{-1}%
        \repeat
+       \ifhv at extern@runR   % we have Rscript
+         \hv at ex@typeout{copy r-dummy.pdf to \hvExternFilename.pdf}%
+         \ShellEscape{\hv at move\space Rplots.pdf \hvExternFilename.pdf}%
+       \fi      
        \hv at ex@typeout{... done}%
        \ifhv at extern@biber
          \ShellEscape{biber  \hvExternFilename}%  NAch biber nochmal latex
@@ -551,8 +586,13 @@
                \hv at ex@typeout{running \hv at extern@compiler~ \hvExternFilename\hv at extern@ext > \hvExternFilename.txt}%
                \ShellEscape{\hv at extern@progpath\hv at extern@compiler\space\hvExternFilename\hv at extern@ext\space > \hvExternFilename.txt}%
              \else
-               \hv at ex@typeout{running \hv at extern@compiler~ \hvExternFilename\hv at extern@ext}%
-               \ShellEscape{\hv at extern@progpath\hv at extern@compiler\space\hvExternFilename\hv at extern@ext}%
+               \ifwindows
+                 \hv at ex@typeout{running \hv at extern@compiler~ \hvExternFilename\hv at extern@ext}%
+                 \ShellEscape{"\hv at extern@progpath\hv at extern@compiler" \hvExternFilename\hv at extern@ext}%
+               \else
+                 \hv at ex@typeout{running \hv at extern@compiler~ \hvExternFilename\hv at extern@ext}%
+                 \ShellEscape{\hv at extern@progpath\hv at extern@compiler\space\hvExternFilename\hv at extern@ext}%
+               \fi
              \fi
            \fi
            \addtocounter{@@@runs}{-1}%



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