Bug in running external program (-shell-escape)
Mario D
egalua at gmail.com
Sat Mar 4 17:06:59 UTC 2023
Il giorno sab 4 mar 2023 alle ore 15:40 Jürgen Spitzmüller <
jspitzm at gmail.com> ha scritto:
> Am Samstag, dem 04.03.2023 um 15:21 +0100 schrieb Mario D:
> > Nevertheless, it looks like a bit weird, as workaround: it results in
> > a symlink pointing to himself which gives a sort of infinite
> > recursion into itself!
>
> Granted. It's a workaround.
>
> > What I don't like of this hack, apart from this "recursion", is that
> > it creates a symlink in the tmp dir of the file which prevent the lyx
> > root temp dir in /tmp to be removed when lyx is closed.
>
> That's annoying, I agree. However, with the following addition, the
> subdir is removed after the file is being processed, which then also
> makes LyX remove the tmp dir:
>
> \usepackage{atveryend}
> \AtVeryEndDocument{%
> \ShellEscape{rm -f picts}
> }
>
Great!
I didn't know about this package.
>
> > Moreover, it doesn't save pictures permanently, as it should be in
> > the intended use of external, so that every time you open again the
> > file pictures have to be recompiled from source the first time you
> > compile.
>
> I don't think so. As far as I can see, LyX (LaTeX) sees the pictures in
> the working directory (in picts/) and reads them. New versions should
> only be created if they differ from the old ones. And in that case,
> through the symlink, the updated versions are permanently stored. Or do
> you have evidence that the files are always re-created from scratch?
>
I don't know: I made a second test and it works as you said, while in my
first test pictures were not saved.
I'm not aware to have changed anything: I'm a bit puzzled.
Anyway, it works! And that's what matters!
Moreover: using the package atveryend I can also get rid of the symlink.
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}}
\AtVeryEndDocument{\ShellEscape{rm -f $HOME/test/picts/picts}}
is a trick that makes Lyx behave in the intended way.
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,
Thank you SO much!!
Cheers.
M
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lyx.org/pipermail/lyx-devel/attachments/20230304/a8ed72ef/attachment-0001.html>
More information about the lyx-devel
mailing list