texlive[76046] trunk: runtexfile (13aug25)

commits+karl at tug.org commits+karl at tug.org
Wed Aug 13 22:01:37 CEST 2025


Revision: 76046
          https://tug.org/svn/texlive?view=revision&revision=76046
Author:   karl
Date:     2025-08-13 22:01:37 +0200 (Wed, 13 Aug 2025)
Log Message:
-----------
runtexfile (13aug25)

Modified Paths:
--------------
    trunk/Build/source/texk/texlive/linked_scripts/runtexfile/runtexfile.lua
    trunk/Master/texmf-dist/doc/support/runtexfile/CHANGELOG
    trunk/Master/texmf-dist/doc/support/runtexfile/README.md
    trunk/Master/texmf-dist/doc/support/runtexfile/runtexfile-doc.pdf
    trunk/Master/texmf-dist/doc/support/runtexfile/runtexfile-doc.tex
    trunk/Master/texmf-dist/scripts/runtexfile/runtexfile.lua

Added Paths:
-----------
    trunk/Master/texmf-dist/doc/support/runtexfile/examples/test3.tex

Modified: trunk/Build/source/texk/texlive/linked_scripts/runtexfile/runtexfile.lua
===================================================================
--- trunk/Build/source/texk/texlive/linked_scripts/runtexfile/runtexfile.lua	2025-08-13 20:00:51 UTC (rev 76045)
+++ trunk/Build/source/texk/texlive/linked_scripts/runtexfile/runtexfile.lua	2025-08-13 20:01:37 UTC (rev 76046)
@@ -1,6 +1,6 @@
 #!/usr/bin/env texlua
 
---%% $Id: runtexfile-doc.tex 1 2025-08-02 16:44:17Z herbert $
+--%% $Id: runtexfile.lua 4 2025-08-13 14:58:56Z herbert $
 -----------------------------------------------------------------------
 --         FILE:  runtexfile.lua
 --  DESCRIPTION:  run a latex document with special steps
@@ -8,10 +8,10 @@
 --       AUTHOR:  Herbert Voß
 --      LICENSE:  LPPL 1.3
 --
--- %% $Id: runtexfile.lua 1 2025-08-02 16:44:17Z herbert $
+-- %% $Id: runtexfile.lua 4 2025-08-13 14:58:56Z herbert $
 -----------------------------------------------------------------------
         runtexfile = runtexfile or { }
- local version = 0.04
+ local version = 0.05
 runtexfile.version = version
 
 --[[doc--
@@ -53,6 +53,7 @@
 end
 
 local verbose = isInArray("-V",args) or isInArray("--verbose",args)
+local usefilename = isInArray("-f",args) or isInArray("--usefilename",args)
 
 local function flog(s)
   if verbose then tmpfile:write(s.."\n") end
@@ -113,8 +114,9 @@
 end
 
 local LTXfile = removeTeXFileExtension(args[#args])
-print("Main file: "..LTXfile)
-flog("Main file: "..LTXfile)
+local mainLTXfile = LTXfile
+print("Main file: "..mainLTXfile)
+flog("Main file: "..mainLTXfile)
 
 local specialFileName
 
@@ -146,10 +148,13 @@
     if words[1] == "%!" and words[2] == "HV" then
       commandLineFound = true
       specialFileName = getFileName(line)
+--      print(step..": Zeile:"..line)
       if specialFileName then
-        print("Special filename = ".. specialFileName)
+         flog("Use special filename: "..specialFileName)
+         specialFileName = specialFileName:gsub("!!file!!",mainLTXfile)
+         flog("geändert zu filename: "..specialFileName)
       else
-        print("Filename = "..LTXfile)
+         flog("Kein specialFileName")
       end
       command = words[3]
       if isInArray(command,commands) then 

Modified: trunk/Master/texmf-dist/doc/support/runtexfile/CHANGELOG
===================================================================
--- trunk/Master/texmf-dist/doc/support/runtexfile/CHANGELOG	2025-08-13 20:00:51 UTC (rev 76045)
+++ trunk/Master/texmf-dist/doc/support/runtexfile/CHANGELOG	2025-08-13 20:01:37 UTC (rev 76046)
@@ -1,3 +1,4 @@
+0.05  2025-08-13 -added soport for unknown main filenames
 0.04  2025-08-02 -do not use the lapp module (simplifies code)
 0.03  2025-07-19 -rennamed file
                  - define lualatex as command, if no "%! HV" line exists

Modified: trunk/Master/texmf-dist/doc/support/runtexfile/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/support/runtexfile/README.md	2025-08-13 20:00:51 UTC (rev 76045)
+++ trunk/Master/texmf-dist/doc/support/runtexfile/README.md	2025-08-13 20:01:37 UTC (rev 76046)
@@ -51,3 +51,14 @@
 ...
 ```
 
+For online compilers one often do not know themain filename. In such a
+case you can use a placeholder for main file (see example 3):
+
+```
+%! HV lualatex
+%! HV asy <!!file!!-*.asy>
+%! HV lualatex
+
+\documentclass{...}
+...
+```

Added: trunk/Master/texmf-dist/doc/support/runtexfile/examples/test3.tex
===================================================================
--- trunk/Master/texmf-dist/doc/support/runtexfile/examples/test3.tex	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/support/runtexfile/examples/test3.tex	2025-08-13 20:01:37 UTC (rev 76046)
@@ -0,0 +1,124 @@
+%! HV lualatex
+%! HV asy <!!file!!-*.asy>
+%! HV lualatex
+
+\documentclass[12pt]{article}
+
+% Use this form to include EPS (latex) or PDF (pdflatex) files:
+%\usepackage{asymptote}
+
+% Use this form with latex or pdflatex to include inline LaTeX code by default:
+\usepackage[inline]{asymptote}
+
+% Use this form with latex or pdflatex to create PDF attachments by default:
+%\usepackage[attach]{asymptote}
+
+% Enable this line to support the attach option:
+%\usepackage[dvips]{attachfile2}
+
+\begin{document}
+
+% Optional subdirectory for latex files (no spaces):
+\def\asylatexdir{}
+% Optional subdirectory for asy files (no spaces):
+\def\asydir{}
+
+\begin{asydef}
+// Global Asymptote definitions can be put here.
+settings.prc=true;
+import three;
+usepackage("bm");
+texpreamble("\def\V#1{\bm{#1}}");
+// One can globally override the default toolbar settings here:
+// settings.toolbar=true;
+\end{asydef}
+
+Here is a venn diagram produced with Asymptote, drawn to width 4cm:
+
+\def\A{A}
+\def\B{\V{B}}
+
+%\begin{figure}
+\begin{center}
+\begin{asy}
+size(4cm,0);
+pen colour1=red;
+pen colour2=green;
+
+pair z0=(0,0);
+pair z1=(-1,0);
+pair z2=(1,0);
+real r=1.5;
+path c1=circle(z1,r);
+path c2=circle(z2,r);
+fill(c1,colour1);
+fill(c2,colour2);
+
+picture intersection=new picture;
+fill(intersection,c1,colour1+colour2);
+clip(intersection,c2);
+
+add(intersection);
+
+draw(c1);
+draw(c2);
+
+//draw("$\A$",box,z1);              // Requires [inline] package option.
+//draw(Label("$\B$","$B$"),box,z2); // Requires [inline] package option.
+draw("$A$",box,z1);            
+draw("$\V{B}$",box,z2);
+
+pair z=(0,-2);
+real m=3;
+margin BigMargin=Margin(0,m*dot(unit(z1-z),unit(z0-z)));
+
+draw(Label("$A\cap B$",0),conj(z)--z0,Arrow,BigMargin);
+draw(Label("$A\cup B$",0),z--z0,Arrow,BigMargin);
+draw(z--z1,Arrow,Margin(0,m));
+draw(z--z2,Arrow,Margin(0,m));
+
+shipout(bbox(0.25cm));
+\end{asy}
+%\caption{Venn diagram}\label{venn}
+\end{center}
+%\end{figure}
+
+Each graph is drawn in its own environment. One can specify the width
+and height to \LaTeX\ explicitly. This 3D example can be viewed
+interactively either with Adobe Reader or Asymptote's fast OpenGL-based
+renderer. To support {\tt latexmk}, 3D figures should specify
+\verb+inline=true+. It is sometimes desirable to embed 3D files as annotated
+attachments; this requires the \verb+attach=true+ option as well as the
+\verb+attachfile2+ \LaTeX\ package.
+\begin{center}
+\begin{asy}[height=4cm,inline=true,attach=false,viewportwidth=\linewidth]
+currentprojection=orthographic(5,4,2);
+draw(unitcube,blue);
+label("$V-E+F=2$",(0,1,0.5),3Y,blue+fontsize(17pt));
+\end{asy}
+\end{center}
+
+One can also scale the figure to the full line width:
+\begin{center}
+\begin{asy}[width=\the\linewidth,inline=true]
+pair z0=(0,0);
+pair z1=(2,0);
+pair z2=(5,0);
+pair zf=z1+0.75*(z2-z1);
+
+draw(z1--z2);
+dot(z1,red+0.15cm);
+dot(z2,darkgreen+0.3cm);
+label("$m$",z1,1.2N,red);
+label("$M$",z2,1.5N,darkgreen);
+label("$\hat{\ }$",zf,0.2*S,fontsize(24pt)+blue);
+
+pair s=-0.2*I;
+draw("$x$",z0+s--z1+s,N,red,Arrows,Bars,PenMargins);
+s=-0.5*I;
+draw("$\bar{x}$",z0+s--zf+s,blue,Arrows,Bars,PenMargins);
+s=-0.95*I;
+draw("$X$",z0+s--z2+s,darkgreen,Arrows,Bars,PenMargins);
+\end{asy}
+\end{center}
+\end{document}


Property changes on: trunk/Master/texmf-dist/doc/support/runtexfile/examples/test3.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/texmf-dist/doc/support/runtexfile/runtexfile-doc.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/support/runtexfile/runtexfile-doc.tex
===================================================================
--- trunk/Master/texmf-dist/doc/support/runtexfile/runtexfile-doc.tex	2025-08-13 20:00:51 UTC (rev 76045)
+++ trunk/Master/texmf-dist/doc/support/runtexfile/runtexfile-doc.tex	2025-08-13 20:01:37 UTC (rev 76046)
@@ -4,7 +4,7 @@
 %! HV lualatex
 %! HV lualatex
 
-%% $Id: runtexfile-doc.tex 1 2025-08-02 16:44:17Z herbert $
+%% $Id: runtexfile-doc.tex 4 2025-08-13 14:58:56Z herbert $
 %
 \listfiles\setcounter{errorcontextlines}{100}
 \documentclass[paper=a4,fontsize=11pt,DIV=14,parskip=half-,
@@ -45,11 +45,8 @@
 \usepackage{hvextern}
 \lstset{basicstyle=\ttfamily\small,language=[LaTeX]TeX}
 \usepackage{ragged2e}
-\usepackage{makeidx}
-\makeindex
+\usepackage[makeidx]{hvindex}
 
-\usepackage{hvindex}
-
 \def\Lfile#1{\texttt{#1}\index{#1 file@\texttt{#1} file}}
 \def\Lext#1{\texttt{.#1}\index{#1 file extension@\texttt{.#1} file extension}}
 \def\Lcs#1{\texttt{\textbackslash#1}\index{#1@\texttt{\textbackslash#1}}}
@@ -67,6 +64,7 @@
 \usepackage[colorlinks,linktocpage]{hyperref}
 
 \usepackage{minted-code}
+\usepackage{fancyref}
 
 \makeatletter% from: doc.sty
 \newcommand*\GetFileInfo[1]{%
@@ -83,7 +81,7 @@
 
 \newcommand\rD{\texttt{runtexfile}\xspace}
 
-\title{Script \texttt{runtexfile} \\--\\ \normalsize v. 0.04 (\today)}
+\title{Script \texttt{runtexfile} \\--\\ \normalsize v. 0.05 (\today)}
 \author{\shortstack{Herbert Voß\\\small \href{mailto:hvoss at tug.org}{hvoss at tug.org}}}
 \date{}
 \begin{document}
@@ -100,7 +98,7 @@
 \clearpage
 
 \section{Introduction}
-The Lua program \rD  parses an \AllTeX-document for lines
+The \Index{Lua} program \rD  parses an \AllTeX-document for lines
 starting with \verb|%! HV |. The «HV» has no meaning, it should only
 be a significant marker for the command lines.
 Such lines can define commands which will be
@@ -107,7 +105,7 @@
 executed by \rD.  These lines must be at the beginning of the document.
 Only empty lines before will be ignored. \rD will stop parsing for commands
 if a line without a preceeding \verb|%! HV | is found. If there is no such line,
-it runs by default \Lprog{lualatex}.
+it runs the document by default with \Lprog{lualatex}.
 
 
 \subsection{Syntax}
@@ -116,7 +114,7 @@
 long form which, of course, can be mixed:
 
 \begin{verbatim}
-runtexfile [-h,--help] [-v,--verbose] [-V,--version ] filename
+runtexfile [-h,--help] [-v,--verbose] [-V,--version ] main-filename
 \end{verbatim}
 
 Every executed command gets an own \Index{logfile} \verb|runtexfile-?.log| in which
@@ -142,7 +140,8 @@
 to use the option \verb|--interaction=nonstopmode| or not. It is only valid for 
 any run depending to a \AllTeX-program.
 The optional \Index{filename} \verb|<file>| must always be used if the current command expects
-another filename (see example for multiple index files).
+another filename (see example for multiple index files). See also section~\vref{mainfile}
+for \Index{online-compiler}s where you often do not know the main filename.
 
 
 
@@ -172,7 +171,7 @@
 %! HV lualatex
 %! HV lualatex
 
-%% $Id: runtexfile-doc.tex 1 2025-08-02 16:44:17Z herbert $
+%% $Id: runtexfile-doc.tex 4 2025-08-13 14:58:56Z herbert $
 %
 \listfiles\setcounter{errorcontextlines}{100}
 \documentclass[paper=a4,fontsize=11pt,DIV=14,parskip=half-,
@@ -221,10 +220,28 @@
 \end{codeblock}
 
 
-There is an optional argument for \Lfile{lualatex} and options with
-another filename for two of the three \Lfile{xindex} runs.~\parencite{ctan-xindex}
+There is an optional argument for \Lprog{lualatex} and options with
+another filename for two of the three \Lprog{xindex} runs.~\parencite{ctan-xindex}
 
+\subsection{Document test3 -- for Online-Compiler}\label{mainfile}
 
+Most applications do not need the original filename, but in an extended
+version, like \LaTeX\ together with \Lprog{asymptote} it is 
+different.~\parencite{ctan-asymptote} Sometimes you do not know the original
+filename, for example when working with an \Index{online-compiler}.
+In such a case one can use
+the \Index{placeholder} \verb|!!file!!| which will be later replaced
+by  the original \TeX-filename which is used by the first command line..
+
+\begin{codeblock}[language=latex,title=Example \texttt{test3} (Asymptote)]
+%! HV lualatex --shell-escape
+%! HV asy <!!file!!-*asy>
+%! HV lualatex --shell-escape
+\end{codeblock}
+
+Remember that this makes no real sense here, because you know the main file
+name.
+
 \printbibliography
 
 \printindex

Modified: trunk/Master/texmf-dist/scripts/runtexfile/runtexfile.lua
===================================================================
--- trunk/Master/texmf-dist/scripts/runtexfile/runtexfile.lua	2025-08-13 20:00:51 UTC (rev 76045)
+++ trunk/Master/texmf-dist/scripts/runtexfile/runtexfile.lua	2025-08-13 20:01:37 UTC (rev 76046)
@@ -1,6 +1,6 @@
 #!/usr/bin/env texlua
 
---%% $Id: runtexfile-doc.tex 1 2025-08-02 16:44:17Z herbert $
+--%% $Id: runtexfile.lua 4 2025-08-13 14:58:56Z herbert $
 -----------------------------------------------------------------------
 --         FILE:  runtexfile.lua
 --  DESCRIPTION:  run a latex document with special steps
@@ -8,10 +8,10 @@
 --       AUTHOR:  Herbert Voß
 --      LICENSE:  LPPL 1.3
 --
--- %% $Id: runtexfile.lua 1 2025-08-02 16:44:17Z herbert $
+-- %% $Id: runtexfile.lua 4 2025-08-13 14:58:56Z herbert $
 -----------------------------------------------------------------------
         runtexfile = runtexfile or { }
- local version = 0.04
+ local version = 0.05
 runtexfile.version = version
 
 --[[doc--
@@ -53,6 +53,7 @@
 end
 
 local verbose = isInArray("-V",args) or isInArray("--verbose",args)
+local usefilename = isInArray("-f",args) or isInArray("--usefilename",args)
 
 local function flog(s)
   if verbose then tmpfile:write(s.."\n") end
@@ -113,8 +114,9 @@
 end
 
 local LTXfile = removeTeXFileExtension(args[#args])
-print("Main file: "..LTXfile)
-flog("Main file: "..LTXfile)
+local mainLTXfile = LTXfile
+print("Main file: "..mainLTXfile)
+flog("Main file: "..mainLTXfile)
 
 local specialFileName
 
@@ -146,10 +148,13 @@
     if words[1] == "%!" and words[2] == "HV" then
       commandLineFound = true
       specialFileName = getFileName(line)
+--      print(step..": Zeile:"..line)
       if specialFileName then
-        print("Special filename = ".. specialFileName)
+         flog("Use special filename: "..specialFileName)
+         specialFileName = specialFileName:gsub("!!file!!",mainLTXfile)
+         flog("geändert zu filename: "..specialFileName)
       else
-        print("Filename = "..LTXfile)
+         flog("Kein specialFileName")
       end
       command = words[3]
       if isInArray(command,commands) then 



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