<div dir="ltr"><div dir="ltr"><br><div>Thanks Herb.</div><div><br></div><div>I shall do as you say and use</div><div>% !TEX parameter</div><div>when needed.</div><div><br></div><div>Still, there seems to be a flaw in the logic flow.</div><div><br></div><div>Thanks also for the tip about the latexmk engines typesetting twice.</div><div><br></div><div>Best,</div><div><br></div><div>Guillermo</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, 20 Mar 2022 at 21:14, Herbert Schulz <<a href="mailto:herbs@wideopenwest.com" target="_blank">herbs@wideopenwest.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">> On Mar 20, 2022, at 2:21 PM, G. M.-S. <<a href="mailto:lists.gms@gmail.com" target="_blank">lists.gms@gmail.com</a>> wrote:<br>
><br>
> Hi Herb.<br>
> <br>
> Everything (TeXShop and TeX Live) is up to date.<br>
> <br>
> After some experimenting, I think I found the conditions for this to happen.<br>
> 1) In TeXShop > Preferences > Engine, add the option --shell-escape and tick Shell Escape Warning.<br>
> 2) Create a new file beginning with % !TEX TS-program = pdflatexmk.<br>
> 3) Typeset it.  TeXShop will ask about using shell escape.  Whichever the answer it will ignore the program to use.<br>
> <br>
> It seems to me that on first typeset TeXShop puts a flag in the file saying if shell escape is to be used or not, but then it forgets the !TEX TS-program part.<br>
> <br>
> Guillermo<br>
> <br>
> On Sun, 20 Mar 2022 at 18:11, Herbert Schulz <<a href="mailto:herbs@wideopenwest.com" target="_blank">herbs@wideopenwest.com</a>> wrote:<br>
> > On Mar 20, 2022, at 11:52 AM, G. M.-S. <<a href="mailto:lists.gms@gmail.com" target="_blank">lists.gms@gmail.com</a>> wrote:<br>
> ><br>
> > Hello.<br>
> > <br>
> > Something must be misconfigured on my side, but I have been unable to find where.<br>
> > <br>
> > The first time I typeset a new LaTeX file test.tex containing<br>
> > <br>
> > % !TEX TS-program = pdflatexmk<br>
> > \documentclass{article}<br>
> > \begin{document}<br>
> > Test.<br>
> > \begin{equation}<br>
> > \label{eq}<br>
> > 2+2=4<br>
> > \end{equation}<br>
> > As seen in \ref{eq}.<br>
> > \end{document}<br>
> > <br>
> > with TeXShop I get<br>
> > <br>
> > This is pdfTeX, Version 3.141592653-2.6-1.40.23 (TeX Live 2022/dev) (preloaded format=pdflatex)<br>
> >  restricted \write18 enabled.<br>
> > entering extended mode<br>
> > (./test.tex<br>
> > LaTeX2e <2021-11-15> patch level 1<br>
> > L3 programming layer <2022-02-24><br>
> > (/usr/local/texlive/2021/texmf-dist/tex/latex/base/article.cls<br>
> > Document Class: article 2021/10/04 v1.4n Standard LaTeX document class<br>
> > (/usr/local/texlive/2021/texmf-dist/tex/latex/base/size10.clo))<br>
> > (/usr/local/texlive/2021/texmf-dist/tex/latex/l3backend/l3backend-pdftex.def)<br>
> > No file test.aux.<br>
> > <br>
> > LaTeX Warning: Reference `eq' on page 1 undefined on input line 29.<br>
> > <br>
> > [1{/usr/local/texlive/2021/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]<br>
> > (./test.aux)<br>
> > <br>
> > LaTeX Warning: There were undefined references.<br>
> > <br>
> > <br>
> > LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right.<br>
> > <br>
> >  )</usr/local/texlive/2021/texmf-dist/fonts/type1/public/amsfonts/cm/cmbx10.pfb<br>
> > ></usr/local/texlive/2021/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb><br>
> > Output written on test.pdf (1 page, 23320 bytes).<br>
> > SyncTeX written on test.synctex.<br>
> > Transcript written on test.log.<br>
> > <br>
> > If I typeset again, latexmk is called and everything works as expected.<br>
> > <br>
> > So this seems to be related to the fact that there is only one file called test.*.<br>
> > <br>
> > Guillermo<br>
> <br>
> Howdy,<br>
> <br>
> This is very strange. What version of TeXShop are you using? When you say `first time' do you mean first time ever (i.e., you are a new user of TeXShop) or does this happen with any file using the pdflatexmk engine the first time you typeset? What is the console output when pdflatexmk is actually used?<br>
> <br>
> Good Luck,<br>
> <br>
> Herb Schulz<br>
> <a href="mailto:herbs@wideopenwest.com" target="_blank">herbs@wideopenwest.com</a><br>
<br>
Howdy,<br>
<br>
Do you really want shell-escape to be enabled all the time? That's rather dangerous. I haven't checked that possibility and won't. So uncheck that option and remove the --shell-escape you added to the command(s) in the Engine tab of TeXShop preferences. PS: do you really want to go through a warning on every compile using pdflatex?<br>
<br>
If you want to use the pdflatexmk engine (or any of the latexmk based engines) the best way to enable shell-escape on a file by file basis is to use the TeXShop directive<br>
<br>
% !TEX parameter = -shell-escape<br>
<br>
for that file. That keeps things safe.<br>
<br>
There also is the sepdflatexmk engine whcih is like the pdflatexmk engine but with -shell-escape enabled. This method is still available but is deprecated.<br>
<br>
Finally, on a completely separate issue... with the 2020/10/01 update of LaTeX using and of the latexmk based engines for simple files that only need a single typeset run (i.e., no cross-references, bibliography or indexes) suddenly started to typeset twice. Usually one uses the latexmk based engines for more complex jobs but I'm lazy and often use it even for these ``trivial'' typesetting jobs (I go back to a time when it took almost a minute to typeset a single page so the extra second or so to use the latexmk based engine is meaningless to me) but the extra typesetting run was disconcerting. There is a solution: go to <<a href="https://herbs.github.io" rel="noreferrer" target="_blank">https://herbs.github.io</a>> and download the LaTeX2020-10-01AndLatexmk.pdf.zip file for information on what is happening and how to solve the problem.<br>
<br>
Good Luck,<br>
<br>
Herb Schulz<br>
<a href="mailto:herbs@wideopenwest.com" target="_blank">herbs@wideopenwest.com</a></blockquote><div> </div></div></div>