Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

External library spawns figures inside math environment #759

Open
Turgon-Aran-Gondolin opened this issue Oct 25, 2019 · 7 comments
Open
Labels

Comments

@Turgon-Aran-Gondolin
Copy link

Turgon-Aran-Gondolin commented Oct 25, 2019

I was using the following code to externalize the tikz-feynman diagrams

\usepackage{shellesc}
\usetikzlibrary{external}
\tikzexternalize[
    shell escape=-enable-write18,
    prefix=./,
    system call={lualatex \tikzexternalcheckshellescape -halt-on-error -interaction=batchmode -jobname "\image" "\texsource"},
    up to date check=md5,
]

When the diagrams are in figure environment everything works fine. But those in align environment were generated twice. So my working dir is now filled with duplicated figures. While the md5 of those duplicated figures are exactly the same, they continue to exist and the compiling effort is doubled. Is there any way to resolve this?

@Mo-Gul
Copy link
Contributor

Mo-Gul commented Oct 25, 2019

It would be nice if you could add a full working minimal example (MWE) which will make it much easier to see the issue and than hopefully provide a solution or fix.

@Turgon-Aran-Gondolin
Copy link
Author

Turgon-Aran-Gondolin commented Oct 25, 2019

This should reproduce what I described:

\documentclass{article}
\usepackage{amsmath}
\usepackage[compat=1.1.0]{tikz-feynman}
\usepackage{shellesc}
\usetikzlibrary{external}
\tikzexternalize[shell escape=-enable-write18,prefix=./,system call={lualatex \tikzexternalcheckshellescape -halt-on-error -interaction=batchmode -jobname "\image" "\texsource"},up to date check=md5]

\begin{document}
\begin{align}
    \begin{tikzpicture}
        \begin{feynman}
            \node[dot] (a);
            \node[right=1 in of a,dot] (b);
            \diagram*{
                (a) -- (b);
            };
        \end{feynman}
    \end{tikzpicture}
\end{align}
\end{document}

@davidcarlisle
Copy link
Member

align (like all AMS environments) evaluates its body twice, with \ifmeasuring@ being true the first time and false the second, so probably you want to avoid the external calls on the second pass.

@Turgon-Aran-Gondolin
Copy link
Author

Thanks for pointing this out. Do you have a solution for this? I'm not really familiar with options of the external library and I'm not sure which one can achieve this.

@hmenke hmenke added this to the 3.1.5 milestone Nov 3, 2019
hmenke added a commit to hmenke/pgf that referenced this issue Dec 14, 2019
hmenke added a commit to hmenke/pgf that referenced this issue Dec 15, 2019
@hmenke hmenke closed this as completed Dec 15, 2019
@Turgon-Aran-Gondolin
Copy link
Author

Turgon-Aran-Gondolin commented Jan 7, 2020

After updated to 3.15a, there's a new problem. If there're multiple figures in one math environment, the first one will get evaluated every single pass despite it remains unchanged.

MWE:

\RequirePackage{luatex85}
\documentclass{article}
\usepackage{amsmath}
\usepackage[compat=1.1.0]{tikz-feynman}
\usetikzlibrary{external}
\tikzexternalize[shell escape=-enable-write18,prefix=./,system call={lualatex \tikzexternalcheckshellescape -halt-on-error -interaction=batchmode -jobname "\image" "\texsource"},up to date check=diff]
\begin{document}

\begin{align}
	\feynmandiagram{
	a -- b[dot];
	};\qquad                               & \int \qquad
	\feynmandiagram{
	a[dot] -- b;
	};
\end{align}
\end{document}

@hmenke hmenke reopened this Jan 7, 2020
@Turgon-Aran-Gondolin
Copy link
Author

Also all figures inside one math environment got merged into the first figure file (one figure per page). And all except the first figure files are still generated normally.

@hmenke
Copy link
Member

hmenke commented Jan 7, 2020

Okay, it looks like this has become unusable. I will revert the fix and publish a new release.

hmenke added a commit to hmenke/pgf that referenced this issue Jan 7, 2020
@hmenke hmenke modified the milestones: 3.1.5, 3.1.6 Jan 7, 2020
@hmenke hmenke removed this from the 3.1.6 milestone Aug 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

4 participants