texlive[73611] Master/texmf-dist: asypictureb (27jan25)

commits+karl at tug.org commits+karl at tug.org
Mon Jan 27 21:50:30 CET 2025


Revision: 73611
          https://tug.org/svn/texlive?view=revision&revision=73611
Author:   karl
Date:     2025-01-27 21:50:30 +0100 (Mon, 27 Jan 2025)
Log Message:
-----------
asypictureb (27jan25)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/asypictureb/README
    trunk/Master/texmf-dist/doc/latex/asypictureb/asypictureB.pdf
    trunk/Master/texmf-dist/source/latex/asypictureb/asypictureB.dtx
    trunk/Master/texmf-dist/source/latex/asypictureb/asypictureB.ins
    trunk/Master/texmf-dist/tex/latex/asypictureb/asypictureB.sty

Modified: trunk/Master/texmf-dist/doc/latex/asypictureb/README
===================================================================
--- trunk/Master/texmf-dist/doc/latex/asypictureb/README	2025-01-27 20:50:21 UTC (rev 73610)
+++ trunk/Master/texmf-dist/doc/latex/asypictureb/README	2025-01-27 20:50:30 UTC (rev 73611)
@@ -1,6 +1,6 @@
 ----------------------------------------------------------------
-asypictureB --- user-friendly integration of Asymptote into LaTeX
-E-mail: cstaats at math.uchicago.edu
+asypictureB -- user-friendly integration of Asymptote into LaTeX
+E-mail: charles dot staats dot iii at gmail.com
 Released under the LaTeX Project Public License v1.3c or later
 See http://www.latex-project.org/lppl.txt
 ----------------------------------------------------------------

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

Modified: trunk/Master/texmf-dist/source/latex/asypictureb/asypictureB.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/asypictureb/asypictureB.dtx	2025-01-27 20:50:21 UTC (rev 73610)
+++ trunk/Master/texmf-dist/source/latex/asypictureb/asypictureB.dtx	2025-01-27 20:50:30 UTC (rev 73611)
@@ -1,90 +1,6 @@
 % \iffalse meta-comment
-%<*internal>
-\iffalse
-%</internal>
-%<*readme>
-----------------------------------------------------------------
-asypictureB -- user-friendly integration of Asymptote into LaTeX
-E-mail: cstaats at math.uchicago.edu
-Released under the LaTeX Project Public License v1.3c or later
-See http://www.latex-project.org/lppl.txt
-----------------------------------------------------------------
-
-The `asypictureB` package allows users to integrate Asymptote code 
-for producing pictures into LaTeX source code using the shell-escape 
-functionality. It is an alternative to the `asymptote` package 
-that comes with Asymptote. The most important advantage of the 
-asypictureB package is that it provides immediate access to 
-Asymptote errors by repackaging them as LaTeX errors. It also allows 
-limited use of TeX macros such as \the\linewidth inside Asymptote code.
-%</readme>
-%<*internal>
-\fi
-\def\nameofplainTeX{plain}
-\ifx\fmtname\nameofplainTeX\else
-  \expandafter\begingroup
-\fi
-%</internal>
-%<*install>
-\input docstrip.tex
-\keepsilent
-\askforoverwritefalse
-\preamble
-----------------------------------------------------------------
-asypictureB --- user-friendly integration of Asymptote into LaTeX
-E-mail: cstaats at math.uchicago.edu
-Released under the LaTeX Project Public License v1.3c or later
-See http://www.latex-project.org/lppl.txt
-----------------------------------------------------------------
-
-\endpreamble
-\postamble
-
-Copyright (C) 2014 by Charles Staats III
-
-This file may be distributed and/or modified under the
-conditions of the LaTeX Project Public License (LPPL), either
-version 1.3c of this license or (at your option) any later 
-version. The latest version of this license is in the following file:
-
-     http://www.latex-project.org/lppl.txt
-
-This work is "maintained" (as per LPPL maintenance status) by 
-Charles Staats III.
-
-This work consists of the file  asypictureB.dtx
-and the derived files           asypictureB.ins,
-                                asypictureB.pdf, and
-                                asypictureB.sty.
-
-\endpostamble
-\usedir{tex/latex/asypictureb}
-\generate{
-  \file{\jobname.sty}{\from{\jobname.dtx}{package}}
-}
-%</install>
-%<install>\endbatchfile
-%<*internal>
-\usedir{source/latex/asypictureb}
-\generate{
-  \file{\jobname.ins}{\from{\jobname.dtx}{install}}
-}
-\nopreamble\nopostamble
-\usedir{doc/latex/asypictureb}
-\generate{
-  \file{README.txt}{\from{\jobname.dtx}{readme}}
-}
-\ifx\fmtname\nameofplainTeX
-  \expandafter\endbatchfile
-\else
-  \expandafter\endgroup
-\fi
-%</internal>
-%<*package>
-\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{asypictureB}
-  [2014/04/15 v0.3 user-friendly integration of Asymptote into LaTeX]
-%</package> 
+% \fi
+% \iffalse
 %<*driver> 
 \documentclass{ltxdoc}  
 \usepackage{lmodern}
@@ -99,7 +15,7 @@
 \setlength{\emergencystretch}{0.5\linewidth}
 \hypersetup{hidelinks}
 \newcommand{\packagename}[1]{\textsf{#1}}
-\newcommand{\danger}{\fontencoding{U}\fontfamily{futs}\selectfont\char 66\relax}
+\newcommand{\danger}{\fontencoding{U}\fontfamily{futs}\selectfont\char 49\relax}
 \newenvironment{warning}%
 {%
     \medskip\noindent\hangindent=3em\hangafter=-2%
@@ -115,7 +31,6 @@
     
 \EnableCrossrefs 
 \CodelineIndex 
-\RecordChanges 
 \begin{document}
     \DocInput{\jobname.dtx} 
 \end{document}
@@ -131,13 +46,11 @@
 %    corresponds to \packagename{asypictureB}~\fileversion, dated~\filedate.^^A
 %    }^^A
 % }
-% \author{Charles Staats III\thanks{E-mail: cstaats at math.uchicago.edu}}
+% \author{Charles Staats III\thanks{E-mail: charles dot staats dot iii at gmail.com}}
 % \date{Released \filedate}
 %
 % \maketitle
 %
-% \changes{v0.3}{2014/04/15}{First public release}
-%
 % \begin{abstract}
 %  The \packagename{asypictureB} package allows users to integrate Asymptote code 
 %  for producing pictures into \LaTeX\ source code using the shell-escape 
@@ -148,9 +61,6 @@
 %  limited use of TeX macros such as |\the\linewidth| inside Asymptote code.
 % \end{abstract}
 % 
-% \noindent\textbf{Disclaimer:} The author of this package has no affiliation with 
-% the creators of the Asymptote programming language.
-% 
 % \tableofcontents
 % 
 % \section{Introduction}
@@ -179,13 +89,7 @@
 % included into the \TeX\ source once they do what I want.
 % \item 
 % The \packagename{asymptote} package does not support PNG files, 
-% although the Asymptote language does.\footnote{A note 
-% on why this is desirable: Asymptote's 3d capabilities are 
-% currently much better for 
-% rasterized images than for vector graphics. Thus, it is often desirable 
-% to produce a rasterized image. Because of a quirk of Asymptote, it is 
-% easy to produce high-resolution images in PNG format, but much harder 
-% to raise the resolution when the output is in the default PDF format.}
+% although the Asymptote language does.
 % \item
 % The \packagename{asymptote} package does have a mechanism in place so that 
 % when it is used with |latexmk|, Asymptote images that have not changed are 
@@ -197,10 +101,7 @@
 % \item
 % The \packagename{asymptote} package can rescale an Asymptote-produced 
 % image to a given width and/or a given height, but it cannot rescale the 
-% image by a given scaling factor.\footnote{This is relevant because a 
-% second trick for producing a high-resolution rasterized image with the 
-% Asymptote language is to produce a scaled-up PDF image, and then 
-% scale it back down when including it into the \TeX\ file.}
+% image by a given scaling factor.
 % \end{enumerate}
 % The most important issue here is the first, which can to some extent be fixed 
 % using editor features; see, for instance, 
@@ -218,8 +119,8 @@
 % \begin{enumerate}
 % \item
 % Asymptote errors are repackaged as \LaTeX\ errors and reported immediately.
-% At a minimum, the user is shown the Asymptote error log and a line number 
-% that will allow him to locate the correct Asymptote picture within the 
+% At a minimum, users are shown the Asymptote error log and a line number 
+% that will allow them to locate the correct Asymptote picture within the 
 % \TeX\ source file.
 % 
 % Additionally, \packagename{asypictureB} is usually able to display the 
@@ -261,7 +162,7 @@
 % First of all, the \packagename{asypictureB} package is mostly useless unless you 
 % have Asymptote installed on your system. 
 % \begin{itemize}
-% \item For a Mac OS X system, this installation
+% \item For a MacOS system, this installation
 % is automatic with a standard installation 
 % of \href{http://tug.org/mactex/}{MacTeX}. 
 % \item For a Windows system, the 
@@ -268,7 +169,7 @@
 % \href{http://asymptote.sourceforge.net/doc/Microsoft-Windows.html}{official 
 % installation instructions} are fairly good. As of this writing, the most 
 % recent version of the |setup.exe| file can be downloaded from 
-% \url{http://sourceforge.net/projects/asymptote/files/2.24/}.
+% \url{http://sourceforge.net/projects/asymptote/files/2.95/}.
 % \item
 % For a Unix-like system, a version of 
 % Asymptote is included in TeX Live, but there may be additional dependencies;
@@ -280,7 +181,7 @@
 % \end{itemize}
 % 
 % To use the \texttt{asypictureB} package, 
-% the \texttt{.tex} file should be run with shell-escape 
+% your \texttt{.tex} file should be run with shell-escape 
 % enabled:
 % \begin{Verbatim}[commandchars=\\\{\},gobble=2]
 % pdflatex -shell-escape \meta{filename}
@@ -293,7 +194,9 @@
 % 
 % If you are unwilling to use shell-escape, \packagename{asypictureB} 
 % creates a script that makes it easy to execute the necessary commands 
-% afterwards. To use it, run the following three commands at the terminal. 
+% afterwards. To use it, run the following four commands at the terminal. 
+% (The second command is optional; it allows you to inspect the script
+% before running it.)
 % For convenience, it is assumed that the name of the \LaTeX\ source file 
 % is |foo.tex|.
 % 
@@ -302,16 +205,18 @@
 % Windows:
 % \begin{Verbatim}[commandchars=\\\{\},gobble=2]
 % pdflatex foo
-% foo-asy_compile.bat
+% type foo-compile_asy.txt
+% type foo-compile_asy.txt|cmd
 % pdflatex foo
 % \end{Verbatim}
 % \end{minipage}
 % \hfill
 % \begin{minipage}{0.48\linewidth}
-% Mac OS X and Unix-like systems:
+% MacOS and Unix-like systems:
 % \begin{Verbatim}[commandchars=\\\{\},gobble=2]
 % pdflatex foo
-% sh foo-asy_compile.sh
+% cat foo-compile_asy.sh
+% sh foo-compile_asy.sh
 % pdflatex foo
 % \end{Verbatim}
 % \end{minipage}
@@ -322,12 +227,13 @@
 % 
 % \begin{warning}
 % This method is not entirely foolproof. In particular, if |pdflatex| is run 
-% twice in a row without running the \meta{filename}-|asy_compile| 
+% twice in a row without running the \meta{filename}-|compile_asy| 
 % script in between, then 
 % Asymptote pictures which have been compiled at some point in the past, even 
 % if they have since been altered, will 
 % not be recompiled. Should this happen, you can force every |asypicture| 
-% to be recompiled using the |\RequireAsyRecompile| command.
+% to be recompiled by temporarily adding the |\RequireAsyRecompile| command
+% before your first |asypicture|.
 % \end{warning}
 % 
 % \paragraph{The safer method}
@@ -494,7 +400,7 @@
 % 
 % \begin{warning}
 % If \packagename{asypictureB} determines that the contents of an |asypicture|
-% environment named \meta{picturname} 
+% environment named \meta{picturename} 
 % have changed since the last run, it will delete 
 % all of the following files that exist:
 % \begin{Verbatim}[gobble=2,commandchars=\\\{\}]
@@ -541,7 +447,7 @@
 % settings.render = 16;
 % size(@asywidth,0);
 % import three;
-% draw(unitsphere);
+% draw(unitsphere, white);
 % \end{asypicture}
 % \end{minipage}
 % \hfill
@@ -553,7 +459,7 @@
 % settings.render = 16;
 % size(@asywidth,0);
 % import three;
-% draw(unitsphere);
+% draw(unitsphere, white);
 % \end{asypicture}
 % \end{Verbatim}
 % \end{minipage}
@@ -662,14 +568,16 @@
 % \texttt{\meta{filename}-\meta{picturename}\_errors.txt}.
 % \end{quote}
 % Once the Asymptote run is complete, it checks whether the error file 
-% has any content. If so, it throws a \LaTeX\ package error and displays 
+% has any lines of the form
+% \begin{quote}
+% \texttt{\meta{filename}-\meta{picturename}.asy:\meta{number}.\meta{stuff}}
+% \end{quote}
+% If so, it throws a \LaTeX\ package error and displays 
 % the contents of the error file, which include all the errors and 
-% warnings issued by Asymptote. One unfortunate 
-% consequence of this procedure is that 
-% a warning by Asymptote will be translated into a full-fledged error, 
-% which is why the \LaTeX\ error message begins with the words 
-% ``Possible Asymptote error."
-% 
+% warnings issued by Asymptote. Note that if some kind of asy error occurs
+% that does not match this output form, \packagename{asypictureB} will not
+% notice the error.
+%
 % The \LaTeX\ error message will give the line number of the 
 % |\end{asypicture}| command for the |asypicture| that caused the error, which 
 % is of limited use in isolating the error.
@@ -683,15 +591,12 @@
 % error log and print out the five lines leading up to the error.  More precisely, 
 % it does the following:
 % \begin{enumerate}
-% \item If the first line of the error log is of the form
+% \item From the first line of the form
 % \begin{quote}
 % \texttt{\meta{filename}-\meta{picturename}.asy:\meta{number}.\meta{stuff}}
 % \end{quote}
-% then the \meta{number} is extracted. If the first line is not of this 
-% form, then the parsing is considered to have failed. As a consequence, 
-% if the first line of the error log is a warning but an error shows up 
-% later, \packagename{asypictureB} will not notice the error message.
-% In the author's experience, this problem does occur, but not often.
+% the \meta{number} is extracted. Note that if no successful extraction occurs,
+% there will be no \LaTeX\ error.
 % \item Assuming \meta{number} was extracted successfully, the lines 
 % of the |asy| file from 
 % the inclusive range $\meta{number}-5$ to \meta{number} are displayed
@@ -709,7 +614,7 @@
 % \begin{Verbatim}[gobble=2,numbers=left,tabsize=4]
 % \documentclass{article}
 % \usepackage{asypictureB}
-%  \begin{document}
+% \begin{document}
 % \def\asywidth{5cm}
 % \begin{asypicture}{name=error_example}
 % 	// A comment
@@ -725,13 +630,12 @@
 % If this file is saved as \texttt{asyerrorexample.tex} and then 
 % compiled with the shell-escape option, the following error results:
 % \begin{Verbatim}[gobble=2]
-% ./asyerrorexample.tex:13: Package asypicture Error: 
-% Possible Asymptote error:
-% asyerrorexample-error_example.asy: 10.5: syntax error 
+% ! Package asypictureB Error: 
+% draw(l1, dotted);
+% ^
+% asyerrorexample-error_example.asy: 10.5: syntax error
 % error: could not load module 'asyerrorexample-error_example.asy'
 % 
-% 
-% 
 % 6     size(5cm, 0);
 % 7     path l1 = (0,0) -- (1,1);
 % 8     // Another comment
@@ -739,16 +643,16 @@
 % 10     draw(l1, dotted);
 % .
 % 
-% See the asypicture package documentation for explanation.
+% See the asypictureB package documentation for explanation.
 % Type  H <return>  for immediate help.
-%  ...                                              
-%                                                    
+%     ...                                              
+%                                                     
 % l.13 \end{asypicture}
 % \end{Verbatim}
-% The first two lines of the \LaTeX\ error message identifies that the 
-% |asypicture| environment ending on line 13 may have produced an error.
-% The next two lines are the Asymptote error log: they explain that this 
-% was, in fact, a syntax error. Looking at the five lines displayed, 
+% The \LaTeX\ error message first repeats the Asymptote error log,
+% which explains that there was a syntax error. Next, the five lines
+% leading up to the error are displayed.
+% Looking at these five lines, 
 % one can determine that the difficulty was a comma omitted 
 % on line 9 of the Asympote file. (It is diagnosed on line 10 because 
 % of how the compiler works.) Looking at the context, this corresponds 
@@ -765,7 +669,10 @@
 % also used in the \LaTeX\ code to avoid hard-coding numbers. 
 % However, it was almost immediately apparent that this feature 
 % has more sophistocated uses, such as allowing user-defined 
-% syntax or even creating something similar to templates. 
+% syntax or even creating something similar to templates\footnote{If you
+% actually want to use templates in Asymptote code, the experimental
+% \emph{templated imports} feature of the language is probably a
+% better choice than the macro techniques described in this section}. 
 % 
 % \subsection{Limitations}
 % 
@@ -962,7 +869,7 @@
 % same packages loaded and macros defined as in the original document. 
 % For instance, font consistency between the Asymptote images and the 
 % larger document is ensured by this option.
-% It comes with an important limitations---Asymptote cannot use size information 
+% It comes with an important limitation---Asymptote cannot use size information 
 % about the labels when this option is in use.
 % 
 % The closest 
@@ -1077,6 +984,33 @@
 % \paragraph{No spaces in file names} The \packagename{asymptote} package
 % takes measures to accomodate peculiar file names---in particular, file 
 % names that include spaces. The \packagename{asypictureB} package does not.
+%
+% \paragraph{No directory specification} The \packagename{asymptote} package
+% allows the user to specify a directory in which to store the Asymptote
+% code and images. The \packagename{asypictureB} package does not currently
+% have this feature, although there is a patch by user202729 that will hopefully
+% be included in the next version. Note that neither package respects the
+% |-output-directory| commandline option.
+%
+% \paragraph{Suboptimal interaction with \texttt{latexmk}} By design, the
+% \packagename{asypictureB} package allows the image format to be specified by
+% the Asymptote code; it does not care whether a |png| or |pdf| file is produced.
+% Unfortunately, |latexmk| relies on being able to identify the generated image file
+% from the \TeX\ log file. Thus, if you use \packagename{asypictureB} with |latexmk|,
+% it will rerun Asymptote every time for |asypicture|s that produce a file format other
+% than the one expected by |latexmk|. Since \packagename{asypictureB} and |latexmk|
+% are two different solutions to the same problem, I expect most users will choose
+% one or the other. But for those who want to use them together, hopefully there will
+% be a better solution in the future.
+%
+% \section{Acknowledgements}
+%
+% The current \packagename{asypictureB} package incorporates bug fixes and improvements
+% by \href{https://github.com/user202729}{user202729}
+% (\url{https://tex.stackexchange.com/users/250119})
+% and \href{https://github.com/cfr42}{cfr}
+% (\url{https://tex.stackexchange.com/users/39222}). For more details,
+% see the \href{https://github.com/charlesstaats/asypictureB/commits/main/}{commit history on github}.
 % 
 % \StopEventually{^^A
 %    \PrintChanges
@@ -1088,11 +1022,14 @@
 %<*package>
 %\fi
 %    \begin{macrocode}
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{asypictureB}
+  [2025/01/26 v0.4 user-friendly integration of Asymptote into LaTeX]
+
 \RequirePackage{fancyvrb}
 \RequirePackage{graphicx}
 \RequirePackage{pgfkeys}
 
-
 \makeatletter
 
 \def\asy at OutFile{\FV at OutFile}
@@ -1099,22 +1036,31 @@
 
 \RequirePackage{ifplatform}
 
+%    \end{macrocode}
+% Define the |\shell at execute| command. If shell escape is enabled, the
+% command executes its contents in the shell. Otherwise, the command
+% is written to a script for the user to execute.
+%    \begin{macrocode}
 \ifshellescape
     \def\ASYPIC at shell{18}
     \newcommand{\shell at execute}{\immediate\write\ASYPIC at shell}
 \else
-	\newwrite\ASYPIC at shell
-	\ifwindows
-	    \openout\ASYPIC at shell=\jobname-compile_asy.bat\relax
-	\else
-	    \openout\ASYPIC at shell=\jobname-compile_asy.sh\relax
-	\fi
-	\newcommand{\shell at execute}[1]{{%
-		\edef\temp{#1}%
+    \newwrite\ASYPIC at shell
+    \ifwindows
+        \openout\ASYPIC at shell=\jobname-compile_asy.txt\relax
+    \else
+        \openout\ASYPIC at shell=\jobname-compile_asy.sh\relax
+    \fi
+    \newcommand{\shell at execute}[1]{{%
+        \edef\temp{#1}%
         \write\expandafter\ASYPIC at shell\expandafter{\temp}%
-	}}
+    }}
 \fi
 
+%    \end{macrocode}
+% Define the |\copyfile| command, which should work regardless of whether
+% shell escape is enabled. (If shell escape is enabled, it is more efficient.)
+%    \begin{macrocode}
 \ifshellescape
     \newcommand{\copyfile}[2]{%
     \ifwindows%
@@ -1130,6 +1076,12 @@
     }
 \fi
 
+%    \end{macrocode}
+% Define the |\deletefile| command. Unlike |\copyfile|, this command will
+% have no immediate effect if shell escape is not enabled, instead writing
+% a line to the script. (If shell escape \emph{is} enabled, of course the
+% command will immediately delete the file.)
+%    \begin{macrocode}
 \newcommand{\deletefile}[1]{%
     \ifwindows%
         \shell at execute{del #1}%
@@ -1138,7 +1090,10 @@
     \fi%
 }
 
-
+%    \end{macrocode}
+%
+% Set up the key-value system for \packagename{asypictureB} using \packagename{pgfkeys}.
+%    \begin{macrocode}
 \newcommand{\asyset}[1]{\pgfqkeys{/asy}{#1}}
 \newcommand{\@asyerrorfilename}{\@asypicturename_errors.txt}
 \newcounter{@asy at linenumber}
@@ -1148,8 +1103,8 @@
 \asyset{graphic options/.code={}}
 \asyset{set graphic option/.style={graphic options/.append code=#1}}
 %    \end{macrocode}
-%    Unrecognized keys should be passed to the |\includegraphics| command 
-%    using |\setkeys|.
+% Unrecognized keys should be passed to the |\includegraphics| command 
+% using |\setkeys|.
 %    \begin{macrocode}
 \asyset{.unknown/.code = %
     {%
@@ -1176,7 +1131,6 @@
 \asyset{angle/.style = {set graphic option = {\def\asy at angle{#1}}},
     angle/.value required}
 
-
 \newcommand{\getfontsize}{\f at size}
 
 \newif\ifasyfilechanged
@@ -1190,10 +1144,8 @@
 \newcommand{\AsyCompileIfNecessary}{\ASYPIC at flushfalse}
 \AsyCompileIfNecessary
 
-
 \newcommand\clearasyheader{\def\ASYPIC at header{}}
 
-
 \def\ASYPIC at header{}
 
 \def\asyheader{\FV at Environment{}{asyheader}}
@@ -1207,7 +1159,7 @@
          \FV at DefineTabOut
          \def\FV at ProcessLine##1{\g at addto@macro\ASYPIC at header{##1^^J}}%
          \let\FV at FontScanPrep\relax
-         %% DG/SR modification begin - May. 18, 1998 
+         %% DG/SR modification begin - May. 18, 1998
          %% (to avoid problems with ligatures)
          \let\@noligs\relax
          %% DG/SR modification end
@@ -1230,18 +1182,27 @@
 %    \begin{macrocode}
 \def\asypicture{\FV at Environment{}{asypicture}}
 
+%    \end{macrocode}
+%
+% Define the |\ASYPIC%recordname| command. As an example, |\ASYPIC at recordname@foo|
+% in the file |bar.tex| would set |\asylistingfile| to |bar-foo.asy| the first
+% time it is called. A second call to |\ASYPIC at recordname{foo}| would set
+% |\asylistingfile| to |bar-foo__1.asy|, a third to |bar-foo__2.asy|, and so on.
+% The next number to use is stored in the macro |\ASYPIC at name@foo|. (Note that this
+% is a macro, not a counter.)
+%    \begin{macrocode}
 \newcommand{\ASYPIC at recordname}[1]{%
     \edef\tempmacroname{ASYPIC at name@#1}%
     \ifcsname\tempmacroname\endcsname%% if \ASYPIC at name@... is defined
         \edef\oldnum{\csname\tempmacroname\endcsname}%
         \edef\@asypicturename%
-            {\scantokens\expandafter{\jobname\noexpand}-#1__\oldnum}%
+            {\jobname-#1__\oldnum}%
         \expandafter\xdef\csname\tempmacroname\endcsname%
             {\the\numexpr\oldnum+1\relax}%
         \edef\ASYPIC at current@num{\csname\tempmacroname\endcsname}%
     \else%% This is the first time this name is being used.
         \edef\@asypicturename%
-            {\scantokens\expandafter{\jobname\noexpand}-#1}%  
+            {\jobname-#1}%
         \expandafter\gdef\csname\tempmacroname\endcsname{1}%
     \fi%
     \xdef\asylistingfile{\@asypicturename.asy}
@@ -1293,8 +1254,8 @@
                       \@asyrepeatfalse%
                       \asyfilechangedtrue%
                   \else% Not at the end of either file in this case
-                      \read\@asyreadold to \oldfileline%
-                      \read\@asyreadnew to \newfileline%
+                      \readline\@asyreadold to \oldfileline%
+                      \readline\@asyreadnew to \newfileline%
                       \ifx\oldfileline\newfileline%
                           \@asyrepeattrue%
                       \else
@@ -1323,46 +1284,52 @@
     \shell at execute{asy -noV \@asypicturename.asy 2> \@asyerrorfilename}%
     \openin\@asyreadold=\@asyerrorfilename\relax%
     \ifeof\@asyreadold%
+        \closein\@asyreadold% Error log does not exist.
+    \else%
+        \def\@asyerrormessage{^^J}%
+        %Create command to process line of log file to figure
+        %out the Asymptote file line number:
+        \edef\@asy at temp{%
+            \def\noexpand\@asy at processerrorline####1\detokenize\expandafter{%
+                \@asypicturename.asy:%
+            }%
+        }%
+        \@asy at temp##2.##3:\relax{%
+            \xdef\@asy at errorlinenumber{\numexpr##2\relax}}%
+        %
+        \gdef\@asy at errorlinenumber{-5}%
+        {%
+            \endlinechar=-1%
+            \loop\unless\ifeof\@asyreadold%
+                \readline\@asyreadold to \@asyerrorcurrentline%
+                \ifnum\@asy at errorlinenumber=-5%
+                {\expandafter\expandafter\expandafter%
+                 \@asy at processerrorline\expandafter%
+                 % Suffix provides default of -5:
+                 \@asyerrorcurrentline\detokenize\expandafter%
+                     {\@asypicturename.asy:} -5.1:\relax%
+                }%
+                \fi%
+                \expandafter\g at addto@macro\expandafter\@asyerrormessage%
+                \expandafter{\@asyerrorcurrentline^^J}%
+            \repeat%
+        }%
         \closein\@asyreadold%
-    \else%
-        \def\@asyerrormessage{^^JPossible Asymptote error:^^J}%
-        \read\@asyreadold to \@asyerrorfirstline%
-        \g at addto@macro\@asyerrormessage{\@asyerrorfirstline^^J}%
-        \ifeof\@asyreadold%
-            \closein\@asyreadold%
+        \ifnum\@asy at errorlinenumber=-5%  No error
         \else%
-            {\endlinechar=`^^J%
-            \loop%
-                \readline\@asyreadold to \@asytempmessage%
-                \expandafter\g at addto@macro\expandafter%
-                  \@asyerrormessage\expandafter{\@asytempmessage^^J}%
-            \unless\ifeof\@asyreadold\repeat%
-            }%
-            \closein\@asyreadold%
-            \g at addto@macro\@asyerrormessage{^^J}%
-            %Next: Need to process \@asyerrorfirstline to figure 
-            %out the Asymptote file line number
-            \expandafter\def\expandafter\@asy at processerrorline%
-              \expandafter##\expandafter1\@asypicturename.asy:%
-               ##2.##3\relax{\xdef\@asy at errorline{\numexpr##2\relax}}%
-            {\expandafter\expandafter\expandafter%
-                \@asy at processerrorline\expandafter%
-                \@asyerrorfirstline\@asypicturename.asy: -5.\relax%
-            }%  The surrounding braces should prevent too much from 
-             %  being gobbled in case the pattern doesn't match.
             \openin\@asyreadold\@asypicturename.asy\relax%
             \edef\numlinesout{5}
             \setcounter{@asy at linenumber}{\numlinesout}
-            \loop\ifnum\value{@asy at linenumber}<\@asy at errorline%
+            \loop\ifnum\value{@asy at linenumber}<\@asy at errorlinenumber%
                 \readline\@asyreadold to \temp%
                 \stepcounter{@asy at linenumber}%
             \repeat%
             %
-            \addtocounter{@asy at linenumber}{-\numlinesout}
+            \addtocounter{@asy at linenumber}{-\numlinesout}%
             %
             {%
                 \endlinechar=`^^J%
-                \loop\ifnum\value{@asy at linenumber}<\@asy at errorline%
+                \loop\ifnum\value{@asy at linenumber}<\@asy at errorlinenumber%
                     \stepcounter{@asy at linenumber}%
                     \edef\temp/{\arabic{@asy at linenumber}}%
                     \expandafter\g at addto@macro\expandafter%
@@ -1374,12 +1341,12 @@
             }%
             \closein\@asyreadold%
             \PackageError{asypictureB}{\@asyerrormessage}{%
-                The Asymptote run described above 
-                gave a non-empty error log. I have^^J
-                reproduced the error log and attempted 
-                to print the five lines leading^^J
-                up to the error. Press enter or return 
-                to continue, and then fix your^^J
+                The Asymptote run described above
+                gave a non-empty error log. I have^^J%
+                reproduced the error log and attempted
+                to print the five lines leading^^J%
+                up to the error. Press enter or return
+                to continue, and then fix your^^J%
                 Asymptote code when this run is done.
             }%
         \fi%
@@ -1400,7 +1367,7 @@
             {\deletefile{\@asypicturename.pdf}}{}%
         \IfFileExists{\@asypicturename.eps}%
             {\deletefile{\@asypicturename.eps}}{}%
-        \copyfile{\@tempasyfile.asy}{\@asypicturename.asy}
+        \copyfile{\@tempasyfile.asy}{\@asypicturename.asy}%
         \ASYPIC at runasy%
     \fi%
     \asyset{graphic options}%

Modified: trunk/Master/texmf-dist/source/latex/asypictureb/asypictureB.ins
===================================================================
--- trunk/Master/texmf-dist/source/latex/asypictureb/asypictureB.ins	2025-01-27 20:50:21 UTC (rev 73610)
+++ trunk/Master/texmf-dist/source/latex/asypictureb/asypictureB.ins	2025-01-27 20:50:30 UTC (rev 73611)
@@ -1,13 +1,6 @@
-%%
-%% This is file `asypictureB.ins',
-%% generated with the docstrip utility.
-%%
-%% The original source files were:
-%%
-%% asypictureB.dtx  (with options: `install')
 %% ----------------------------------------------------------------
 %% asypictureB --- user-friendly integration of Asymptote into LaTeX
-%% E-mail: cstaats at math.uchicago.edu
+%% E-mail: charles dot staats dot iii at gmail.com
 %% Released under the LaTeX Project Public License v1.3c or later
 %% See http://www.latex-project.org/lppl.txt
 %% ----------------------------------------------------------------
@@ -18,7 +11,7 @@
 \preamble
 ----------------------------------------------------------------
 asypictureB --- user-friendly integration of Asymptote into LaTeX
-E-mail: cstaats at math.uchicago.edu
+E-mail: charles dot staats dot iii at gmail.com
 Released under the LaTeX Project Public License v1.3c or later
 See http://www.latex-project.org/lppl.txt
 ----------------------------------------------------------------
@@ -38,10 +31,10 @@
 This work is "maintained" (as per LPPL maintenance status) by
 Charles Staats III.
 
-This work consists of the file  asypictureB.dtx
-and the derived files           asypictureB.ins,
-                                asypictureB.pdf, and
-                                asypictureB.sty.
+This work consists of the files  asypictureB.dtx and
+                                 asypictureB.ins,
+and the derived files            asypictureB.pdf and
+                                 asypictureB.sty.
 
 \endpostamble
 \usedir{tex/latex/asypictureb}
@@ -62,10 +55,10 @@
 %% This work is "maintained" (as per LPPL maintenance status) by
 %% Charles Staats III.
 %% 
-%% This work consists of the file  asypictureB.dtx
-%% and the derived files           asypictureB.ins,
-%%                                 asypictureB.pdf, and
-%%                                 asypictureB.sty.
+%% This work consists of the files  asypictureB.dtx and
+%%                                  asypictureB.ins,
+%% and the derived files            asypictureB.pdf and
+%%                                  asypictureB.sty.
 %% 
 %%
 %% End of file `asypictureB.ins'.

Modified: trunk/Master/texmf-dist/tex/latex/asypictureb/asypictureB.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/asypictureb/asypictureB.sty	2025-01-27 20:50:21 UTC (rev 73610)
+++ trunk/Master/texmf-dist/tex/latex/asypictureb/asypictureB.sty	2025-01-27 20:50:30 UTC (rev 73611)
@@ -7,7 +7,7 @@
 %% asypictureB.dtx  (with options: `package')
 %% ----------------------------------------------------------------
 %% asypictureB --- user-friendly integration of Asymptote into LaTeX
-%% E-mail: cstaats at math.uchicago.edu
+%% E-mail: charles dot staats dot iii at gmail.com
 %% Released under the LaTeX Project Public License v1.3c or later
 %% See http://www.latex-project.org/lppl.txt
 %% ----------------------------------------------------------------
@@ -14,7 +14,8 @@
 %% 
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesPackage{asypictureB}
-  [2014/04/15 v0.3 user-friendly integration of Asymptote into LaTeX]
+  [2025/01/26 v0.4 user-friendly integration of Asymptote into LaTeX]
+
 \RequirePackage{fancyvrb}
 \RequirePackage{graphicx}
 \RequirePackage{pgfkeys}
@@ -29,16 +30,16 @@
     \def\ASYPIC at shell{18}
     \newcommand{\shell at execute}{\immediate\write\ASYPIC at shell}
 \else
-\newwrite\ASYPIC at shell
-\ifwindows
-    \openout\ASYPIC at shell=\jobname-compile_asy.bat\relax
-\else
-    \openout\ASYPIC at shell=\jobname-compile_asy.sh\relax
-\fi
-\newcommand{\shell at execute}[1]{{%
-\edef\temp{#1}%
+    \newwrite\ASYPIC at shell
+    \ifwindows
+        \openout\ASYPIC at shell=\jobname-compile_asy.txt\relax
+    \else
+        \openout\ASYPIC at shell=\jobname-compile_asy.sh\relax
+    \fi
+    \newcommand{\shell at execute}[1]{{%
+        \edef\temp{#1}%
         \write\expandafter\ASYPIC at shell\expandafter{\temp}%
-}}
+    }}
 \fi
 
 \ifshellescape
@@ -138,13 +139,13 @@
     \ifcsname\tempmacroname\endcsname%% if \ASYPIC at name@... is defined
         \edef\oldnum{\csname\tempmacroname\endcsname}%
         \edef\@asypicturename%
-            {\scantokens\expandafter{\jobname\noexpand}-#1__\oldnum}%
+            {\jobname-#1__\oldnum}%
         \expandafter\xdef\csname\tempmacroname\endcsname%
             {\the\numexpr\oldnum+1\relax}%
         \edef\ASYPIC at current@num{\csname\tempmacroname\endcsname}%
     \else%% This is the first time this name is being used.
         \edef\@asypicturename%
-            {\scantokens\expandafter{\jobname\noexpand}-#1}%
+            {\jobname-#1}%
         \expandafter\gdef\csname\tempmacroname\endcsname{1}%
     \fi%
     \xdef\asylistingfile{\@asypicturename.asy}
@@ -189,8 +190,8 @@
                       \@asyrepeatfalse%
                       \asyfilechangedtrue%
                   \else% Not at the end of either file in this case
-                      \read\@asyreadold to \oldfileline%
-                      \read\@asyreadnew to \newfileline%
+                      \readline\@asyreadold to \oldfileline%
+                      \readline\@asyreadnew to \newfileline%
                       \ifx\oldfileline\newfileline%
                           \@asyrepeattrue%
                       \else
@@ -219,46 +220,52 @@
     \shell at execute{asy -noV \@asypicturename.asy 2> \@asyerrorfilename}%
     \openin\@asyreadold=\@asyerrorfilename\relax%
     \ifeof\@asyreadold%
+        \closein\@asyreadold% Error log does not exist.
+    \else%
+        \def\@asyerrormessage{^^J}%
+        %Create command to process line of log file to figure
+        %out the Asymptote file line number:
+        \edef\@asy at temp{%
+            \def\noexpand\@asy at processerrorline####1\detokenize\expandafter{%
+                \@asypicturename.asy:%
+            }%
+        }%
+        \@asy at temp##2.##3:\relax{%
+            \xdef\@asy at errorlinenumber{\numexpr##2\relax}}%
+        %
+        \gdef\@asy at errorlinenumber{-5}%
+        {%
+            \endlinechar=-1%
+            \loop\unless\ifeof\@asyreadold%
+                \readline\@asyreadold to \@asyerrorcurrentline%
+                \ifnum\@asy at errorlinenumber=-5%
+                {\expandafter\expandafter\expandafter%
+                 \@asy at processerrorline\expandafter%
+                 % Suffix provides default of -5:
+                 \@asyerrorcurrentline\detokenize\expandafter%
+                     {\@asypicturename.asy:} -5.1:\relax%
+                }%
+                \fi%
+                \expandafter\g at addto@macro\expandafter\@asyerrormessage%
+                \expandafter{\@asyerrorcurrentline^^J}%
+            \repeat%
+        }%
         \closein\@asyreadold%
-    \else%
-        \def\@asyerrormessage{^^JPossible Asymptote error:^^J}%
-        \read\@asyreadold to \@asyerrorfirstline%
-        \g at addto@macro\@asyerrormessage{\@asyerrorfirstline^^J}%
-        \ifeof\@asyreadold%
-            \closein\@asyreadold%
+        \ifnum\@asy at errorlinenumber=-5%  No error
         \else%
-            {\endlinechar=`^^J%
-            \loop%
-                \readline\@asyreadold to \@asytempmessage%
-                \expandafter\g at addto@macro\expandafter%
-                  \@asyerrormessage\expandafter{\@asytempmessage^^J}%
-            \unless\ifeof\@asyreadold\repeat%
-            }%
-            \closein\@asyreadold%
-            \g at addto@macro\@asyerrormessage{^^J}%
-            %Next: Need to process \@asyerrorfirstline to figure
-            %out the Asymptote file line number
-            \expandafter\def\expandafter\@asy at processerrorline%
-              \expandafter##\expandafter1\@asypicturename.asy:%
-               ##2.##3\relax{\xdef\@asy at errorline{\numexpr##2\relax}}%
-            {\expandafter\expandafter\expandafter%
-                \@asy at processerrorline\expandafter%
-                \@asyerrorfirstline\@asypicturename.asy: -5.\relax%
-            }%  The surrounding braces should prevent too much from
-             %  being gobbled in case the pattern doesn't match.
             \openin\@asyreadold\@asypicturename.asy\relax%
             \edef\numlinesout{5}
             \setcounter{@asy at linenumber}{\numlinesout}
-            \loop\ifnum\value{@asy at linenumber}<\@asy at errorline%
+            \loop\ifnum\value{@asy at linenumber}<\@asy at errorlinenumber%
                 \readline\@asyreadold to \temp%
                 \stepcounter{@asy at linenumber}%
             \repeat%
             %
-            \addtocounter{@asy at linenumber}{-\numlinesout}
+            \addtocounter{@asy at linenumber}{-\numlinesout}%
             %
             {%
                 \endlinechar=`^^J%
-                \loop\ifnum\value{@asy at linenumber}<\@asy at errorline%
+                \loop\ifnum\value{@asy at linenumber}<\@asy at errorlinenumber%
                     \stepcounter{@asy at linenumber}%
                     \edef\temp/{\arabic{@asy at linenumber}}%
                     \expandafter\g at addto@macro\expandafter%
@@ -271,11 +278,11 @@
             \closein\@asyreadold%
             \PackageError{asypictureB}{\@asyerrormessage}{%
                 The Asymptote run described above
-                gave a non-empty error log. I have^^J
+                gave a non-empty error log. I have^^J%
                 reproduced the error log and attempted
-                to print the five lines leading^^J
+                to print the five lines leading^^J%
                 up to the error. Press enter or return
-                to continue, and then fix your^^J
+                to continue, and then fix your^^J%
                 Asymptote code when this run is done.
             }%
         \fi%
@@ -296,7 +303,7 @@
             {\deletefile{\@asypicturename.pdf}}{}%
         \IfFileExists{\@asypicturename.eps}%
             {\deletefile{\@asypicturename.eps}}{}%
-        \copyfile{\@tempasyfile.asy}{\@asypicturename.asy}
+        \copyfile{\@tempasyfile.asy}{\@asypicturename.asy}%
         \ASYPIC at runasy%
     \fi%
     \asyset{graphic options}%
@@ -329,10 +336,10 @@
 %% This work is "maintained" (as per LPPL maintenance status) by
 %% Charles Staats III.
 %% 
-%% This work consists of the file  asypictureB.dtx
-%% and the derived files           asypictureB.ins,
-%%                                 asypictureB.pdf, and
-%%                                 asypictureB.sty.
+%% This work consists of the files  asypictureB.dtx and
+%%                                  asypictureB.ins,
+%% and the derived files            asypictureB.pdf and
+%%                                  asypictureB.sty.
 %% 
 %%
 %% End of file `asypictureB.sty'.



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