leo-colisson / robust-externalize

A LaTeX library to cache pictures (including tikz, python code, and more) in a robust, customizable, and pure way.
7 stars 2 forks source link

Infinite compilation if file not found #36

Open dflvunoooooo opened 3 months ago

dflvunoooooo commented 3 months ago

If I cache a tex file with ´CacheMe´ and do not specify to look in the parent dircetory of robust-extrenalize, the file is not found. This leads to an infinite compilation process which deosn't stop. If compilation is aborted, one can find the hint in the robust-externalize log, that the file wasn't found.

\documentclass{scrreport}

\usepackage{robust-externalize}

\begin{filecontents}{test2.tex}   
    \chapter{Test1}
    Test bla Test.   
\end{filecontents}

\begin{document}

\begin{CacheMe}{latex}
    \input{test2.tex}
\end{CacheMe}

\end{document}
tobiasBora commented 3 months ago

Hum, good point. Note that copy file to cache or ( __ROBEXT_WAY_BACK___ + add dependencies) is the proper way to solve this issue, but the error is not great, I should find a latex compilation option not to wait infinitely if there is an error, I'll try to solve that when I've some time.

dflvunoooooo commented 3 months ago

Thank you for the hint. Can I add the __ROBEXT_WAY_BACK__ to my own preset? It is working with \input{__ROBEXT_WAY_BACK__test2.tex}.

dflvunoooooo commented 3 months ago

Another occurrence of infinite compilation is with this:

\documentclass{scrreport}

\usepackage{robust-externalize}
%\runHereAndInPreambleOfCachedFiles{\usepackage{robust-externalize}}
\usepackage{pdfpages}

\robExtConfigure{
    new preset={latex scrreport}{
        latex, 
        set documentclass={scrreport},
        set latex options={fontsize=11pt},
        add to preamble={\usepackage{robust-externalize}},
        set placeholder={__ROBEXT_LATEX_MAIN_CONTENT_WRAPPED__}{__ROBEXT_MAIN_CONTENT__},
        custom include command={\includepdf{\robExtAddCachePathAndName{\robExtFinalHash.pdf}}}
    },
}

\begin{filecontents}{test2.tex}   
    \chapter{Test1}
    Test bla Test. 
    \begin{figure}
        \centering
        \begin{CacheMeCode}{python}
            import matplotlib.pyplot as plt
            import matplotlib
            matplotlib.use('pgf')
            year = [2014, 2015, 2016, 2017, 2018, 2019]
            tutorial_count = [39, 117, 111, 110, 67, 29]
            plt.plot(year, tutorial_count, color="#6c3376", linewidth=2)
            plt.title("Simple plot")
            plt.xlabel('Year')
            plt.ylabel('Number of futurestud.io Tutorials')
            print(get_filename_from_extension(".pgf"))
            plt.savefig("__ROBEXT_OUTPUT_PDF__")
        \end{CacheMeCode}
        \caption{test}%
        \label{py:test}
    \end{figure}  
\end{filecontents}

\begin{document}

\cacheMe[latex scrreport]{\input{__ROBEXT_WAY_BACK__test2.tex}}

\end{document}