Closed PharmTeX closed 2 weeks ago
Your test file produces the message
! Package latexbug Error: Third-party file(s)
(latexbug)
(latexbug) This test file uses third-party file(s)
(latexbug)
(latexbug) ==============
(latexbug) perltex.sty
(latexbug) ==============
(latexbug)
(latexbug) So you should contact the authors
(latexbug) of these files, not the LaTeX Team!
The error that you show is a perl error not a tex one, the latex team has no involvement in the maintenance of perltex and no write access to that code. As the message says, you need to contact the author, we can not help here, sorry.
That said if I remove the latexbug
package your example runs without error in a current texlive release producing
Dear David,
Thank you for a swift reply. Might I inquire if you were running in Windows or Linux when you were able to compile successfully? I am using PerlTeX for a framework that quite a few people use for pharmaceutical scientific reports in LaTeX, and I have been unable to update to the latest LaTex distributions for the last two years due to the issue (running Windows 10 on several different PCs).
Thank you in advance.
Kind regards,
Christian
I used the current latex sources with both cygwin texlive and linux texlive, which confirmed that there is no issue with the latex code. There may be an issue with the perl version you are using not accepting the perl in the perltex code, but that's an issue with perltex, or the perl or the miktex packaging but we have no control over any of those things. The requirement to use latexbug
is explictly to avoid this issue tracker getting issues for code we do not control and can not fix. Is your perl newer than 5.03 ? if so perhaps it is checking something that my perl does not check, but that is perl code producing a syntax error, so you would need to contact the perltex author.
I can confirm that it dies on windows both in miktex and texlive, but as David said, you should contact the author about it.
Thank you both, this input is very helpful. I have tried to reach out to Scott Pakin, but it is always difficult to know if I have the right contact info. I suspect the challenge might be with the distro packaging for Windows in Tex live and MiKTeX, since pre-2023 versions work fine. I will also see if I can get a Cygwin portable version up and running with PerlTex for PharmTeX for Windows users since this might give us some of the Linux stability and speed for LaTeX.
Thanks again,
Christian
perl --version says I used 5.36 on cygwin and 5.34 on wsl2/ubuntu linux (and apt says 5.34 is the latest they have in that distribution) so it may fail with newer perl (Ulrike had windows 5.38 perl so that may be the crucial difference, but I don't want to do a major system upgrade just to get a newer perl)
My built-in perl has version This is perl 5, version 36, subversion 0 (v5.36.0)
. And when I force texlive to use that is fails in the same way.
The problem seems to be this part of the code which doesn't produce the expected variables:
my ($optag, $macroname, @otherstuff) =
map {chomp; $_} split "$separator\n", $entirefile;
probably the windows perl version's newline handling rather than the perl version, see this 20 year old comp.text.tex thread on same error message on a different line
https://comp.text.tex.narkive.com/K4iaUiyq/miktex-and-perltex
... I think you need a real Windows Perl. I get the same error as you if I use the perl coming with MSYS. If I use ActiveState Perl the example works.
Hi Ulrike,
Thank you very much for your effort in testing this. I can get any perl version I have tested working with Tex Live 2022 to compile the example, including the latest Strawberry version 5.40.0.1. But they all fail with Tex Live 2023 and 2024 as well as associated MiKTeX versions. The perltex.pl script and the PerlTeX packafe is the same in all the LaTeX distros, so some kind of incompatibility may have occured in 2023/2024. The main difference I noticed from 2022 to 2023 is that Tex Live went from 32 bit to 64 bit.
Christian
@PharmTeX It looks like a timing problem, imho some file is deleted too fast for the code. When I add a delay it compiles for me:
\documentclass{article}
\ExplSyntaxOn
\newcommand\delay{\int_step_inline:nn{10000}{\let\blblbl\blblbl}}
\ExplSyntaxOff
\usepackage[optional]{perltex}
\makeatletter
\renewcommand{\plmac@write@perl@i}[1]{%
\immediate\openout\plmac@outfile=\plmac@tofile\relax
\let\protect=\noexpand
\def\begin{\noexpand\begin}%
\def\end{\noexpand\end}%
\immediate\write\plmac@outfile{#1}%
\immediate\closeout\plmac@outfile
\endgroup
\delay
\immediate\openout\plmac@outfile=\plmac@toflag\relax
\immediate\closeout\plmac@outfile
\plmac@await@existence\plmac@fromflag
\immediate\openout\plmac@outfile=\plmac@tofile\relax
\immediate\closeout\plmac@outfile
\plmac@await@existence\plmac@doneflag
\input\plmac@fromfile\relax
}
\makeatother
\begin{document}
\perlnewcommand{\perlversion}{$]}
You are running Perl version \perlversion.
\end{document}
@u-fischer you are a magician :-) I cannot thank you enough. I can confirm it works now in Tex Live 2024. I will implement this in my own code for PharmTeX, but for wider implementation, would this be something that should be performed by the package developer? And if I cannot reach him, can I somehow do or request the implementation for this package despite not being the package owner? Thank you again so much!
I don't see a reason why you shouldn't be able to reach the maintainer.
Let's hope you are right :-) have a nice rest of your weekend and thank you again for your help!
Interesting, spinning waiting for a file to appear is exactly what the
\plmac@await@existence\plmac@fromflag
on the following lines does so (probably as I can't test as it works for me anyway)
\plmac@await@existence\plmac@tofile
would work instead of your \delay
@davidcarlisle yes, \plmac@await@existence\plmac@toflag
works for me.
Hi both. Adding "\plmac@await@existence\plmac@toflag" instead of "\delay" at the same point causes my run to hang. Or did I misunderstand?
No you understood, but testing untested code (I couldn't test as I can't get the original fail)...I'm not sure quite how that can happen but this is playing with tex and perl's interaction with the operating system filesystem buffering so timing is a dark art.
Ulrike's \delay
always delays (even on systems that don't need it) the existing ..await
macro doesn't have any guard it spins until the requested file appears so if it doesn't appear it will hang (I don't quite understand how it can not appear if the delay works, but still)
So \delay
is safer and do that for now if it works for you but if you report to the perltex maintainer linking to this discussion I suspect the final fix will be closer to using \plmac@await@existence
but maybe with additional guards.
Thank you. In that case I will use \delay and report the issue and this thread to the package maintainer.
Brief outline of the bug
Dear LaTeX2e Team,
Since 2023 (Tex Live 2023, 2024 and similar MiKTeX versions) I have been unable to get PerlTeX working (Windows) no watter which examples I test. The attached example and many other runs fine in Tex Live 2022 and earlier versions (executed with "perltex -nosafe -latex=pdflatex test.tex") and prints the Perl version, but the example and all others fails in later versions with several error messages referring to perltex.pl:
Use of uninitialized value $macroname in substitution (s///) at C:/Users/username/AppData/Local/Programs/MiKTeX/scripts/perltex/perltex.pl line 181.
The PerlTeX package is unchanged since 2019 and the file C:/Users/username/AppData/Local/Programs/MiKTeX/scripts/perltex/perltex.pl is identical whether I look at the pre- or post-2023 versions of the LaTeX distributions.
I have tried setting "TEXLIVE_WINDOWS_TRY_EXTERNAL_PERL = 1" in texmf.cnf to use an external Strawberry Perl installation (which also worked fine in pre-2023 versions), but with the same result.
Christian hove Claussen
Minimal example showing the bug
Log file (required) and possibly PDF file