Re: [LaTeX] How to tell the user that the document wasn't compiled with -shell-escape flag?

Liste des GroupesRevenir à ct tex 
Sujet : Re: [LaTeX] How to tell the user that the document wasn't compiled with -shell-escape flag?
De : ud.usenetcorrespondence (at) *nospam* web.de (Ulrich D i e z)
Groupes : comp.text.tex
Date : 23. Aug 2024, 01:35:25
Autres entêtes
Message-ID : <va8lge$1j9de$1@solani.org>
References : 1 2
User-Agent : Mozilla/5.0 (X11; Linux i686 on x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0
Stefan Ram wrote:

Annada Behera <segfault@tilde.green> wrote or quoted:
Anybody has any idea how that can be done. Thank you.
 
  Lately, the newer versions of "shellesc" (like since 2020?)

shellesc.dtx says the command \ShellEscapeStatus is a TeX <number>
quantity of the kind \chardef-token and was introduced in
version v1.0a of the shellesc package, released 2019/10/13 .

\ShellEscapeStatus is defined by the following lines:

\chardef\ShellEscapeStatus
  \ifx\pdfshellescape\@undefined
    \ifx\shellescape\@undefined
      \ifx\directlua\@undefined
        \z@
      \else
        \directlua{%
          tex.sprint((status.shell_escape or os.execute()) .. " ")}
      \fi
    \else
      \shellescape
    \fi
  \else
    \pdfshellescape
  \fi

You also find an example for querying which does with \ifcase:

\ifcase\ShellEscapeStatus
  \PackageWarning{shellesc}{Shell escape disabled}
\or
  \PackageInfo   {shellesc}{Unrestricted shell escape enabled}
\else
  \PackageInfo   {shellesc}{Restricted shell escape enabled}
\fi

  are said to define "ShellEscapeStatus." So, you could totally
  do something like this:
 
\usepackage{shellesc}
 
\ifnum\ShellEscapeStatus=1 \else
\PackageError{mypackage}{use shell escape}{or else}
\fi

If you neither want to load the package nor want to define the
chardef-token you can do s.th. like

\makeatletter
\ifcase
  \ifx\pdfshellescape\@undefined
    \ifx\shellescape\@undefined
      \ifx\directlua\@undefined
        \z@
      \else
        \directlua{%
          tex.sprint((status.shell_escape or os.execute()) .. " ")}
      \fi
    \else
      \shellescape
    \fi
  \else
    \pdfshellescape
  \fi
  \PackageWarning{shellesc}{Shell escape disabled}
\or
  \PackageInfo   {shellesc}{Unrestricted shell escape enabled}
\else
  \PackageInfo   {shellesc}{Restricted shell escape enabled}
\fi
\makeatother

  But since I'm rocking an older version, I can't check this out
  myself!

For checking out you can
- look at the documentation of most recent releases of packages at CTAN.
- test with a rathher recent TeX Live release via Overleaf -
  https://de.overleaf.com/
- try the test page (https://texlive.net/run) of the
  The TeXLive.net Server,  https://texlive.net/ .

Ulrich

Date Sujet#  Auteur
22 Aug 24 * [LaTeX] How to tell the user that the document wasn't compiled with -shell-escape flag?5Annada Behera
22 Aug 24 +- Re: [LaTeX] How to tell the user that the document wasn't compiled with -shell-escape flag?1Ulrich D i e z
22 Aug 24 `* Re: [LaTeX] How to tell the user that the document wasn't compiled with -shell-escape flag?3Stefan Ram
23 Aug 24  +- Re: [LaTeX] How to tell the user that the document wasn't compiled with -shell-escape flag?1Ulrich D i e z
23 Aug 24  `- Re: [LaTeX] How to tell the user that the document wasn't compiled with -shell-escape flag?1Annada Behera

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal