Bug in running external program (-shell-escape)

Jürgen Spitzmüller jspitzm at gmail.com
Sun Mar 5 09:37:59 UTC 2023


Am Samstag, dem 04.03.2023 um 18:06 +0100 schrieb Mario D:
> So, to sum up.
> 
> If the file "test.lyx" is in the working directory $HOME/test/ and I
> want all its tikz pictures to be stored in the directory
> "$HOME/test/picts" using the "external" library, then it looks like
> that using the following template
> 
> \usetikzlibrary{external}
> \tikzexternalize[prefix=picts/]
> \usepackage{shellesc}
> \ShellEscape{ln -s $HOME/test/picts picts}
> \usepackage{atveryend}
> \AtVeryEndDocument{\ShellEscape{rm -f picts}}

Yes. But:

> \AtVeryEndDocument{\ShellEscape{rm -f $HOME/test/picts/picts}}

You don't need this if you use

\ShellEscape{rm -f picts ; ln -s $HOME/test/picts picts}

in the first command.

This will remove an existing link before attempting to create a new
one, thus avoiding the creation of the link in the target dir (in some
ln implementations, there is the -n option which could also be used,
but this is not globally available and also implementation-specific).

I am surprised that this can happen, as we remove the link anyway after
compilation, but anyways ...

> For what I am concerned, I am happy with this workaround. 
> 
> Maybe it is worth to be noted somewhere in Lyx documentation, when it
> debates the use of shell-escape and/or the external library,

I think the wiki is a good place for this. I have added some
documentation:
https://wiki.lyx.org/Tips/UsingTikZ-PGF

> 
> Thank you SO much!!

You're welcome.

-- 
Jürgen


More information about the lyx-devel mailing list