chirun-ncl / chirun

A Python package providing the command line interface for building flexible and accessible content with Chirun.
https://chirun.org.uk/
Other
29 stars 4 forks source link

Sometimes chirun hangs without telling the user #135

Closed prowlett closed 5 months ago

prowlett commented 1 year ago

I had a situation where chirun hung. I ran chirun and it just reported "Running chirun for directory /home/.../" indefinitely.

The particular problem with my code isn't massively important but boils down to this: I started a beamer doc, called xcolor, defined a colour and used it in a TikZ picture. The fix was to not call xcolor (Beamer already does this anyway; I did it because I moved some code from an article to a beamer doc). There are known weird interactions between beamer and xcolor, obviously out of scope here. My point is to identify that sometimes chirun hangs and it isn't immediately obvious whether it's processing or stalled. Is there a way of identifying when the LaTeX complier has hung and ending the process, reporting this to the user?

My code was equivalent to this:

\documentclass{beamer} 
\usepackage{xcolor}
\usepackage{tikz}
\definecolor{lightkhaki}{rgb}{0.94, 0.9, 0.55}

\begin{document}
    \begin{frame}
        \begin{tikzpicture}
            \node[fill=lightkhaki] at (0,0) {Hello};
        \end{tikzpicture}
    \end{frame}
\end{document}

This causes a problem, I think because beamer already called xcolor and somehow the second call messes up the \definecolor. TikZ is a factor here, because this code doesn't produce the same issue:

\documentclass{beamer} 
\usepackage{xcolor}
\definecolor{lightkhaki}{rgb}{0.94, 0.9, 0.55}

\begin{document}
    \textcolor{lightkhaki}{Hello}
\end{document}

Anyway, the problem is solved by removing the line \usepackage{xcolor}. I worked this out by running chirun -vv and seeing this at the end of the output:

[imager:compileLatex:629] ! Package xcolor Error: Undefined color `lightkhaki'.
[imager:compileLatex:629] 
[imager:compileLatex:629] See the xcolor package documentation for explanation.
[imager:compileLatex:629] Type  H <return>  for immediate help.
[imager:compileLatex:629] ...
[imager:compileLatex:629] 
[imager:compileLatex:629] l.17 ...  \node[fill=lightkhaki] at (0,0) {Hello};
[imager:compileLatex:629] 
[imager:compileLatex:629] 
[imager:compileLatex:629] ! Package xcolor Error: Undefined color `pgffillcolor'.
[imager:compileLatex:629] 
[imager:compileLatex:629] See the xcolor package documentation for explanation.
[imager:compileLatex:629] Type  H <return>  for immediate help.
[imager:compileLatex:629] ...
[imager:compileLatex:629] 
[imager:compileLatex:629] l.17 ...  \node[fill=lightkhaki] at (0,0) {Hello};
[imager:compileLatex:629] 
[imager:compileLatex:629] 
[imager:compileLatex:629] ! Package xcolor Error: Undefined color `pgffillcolor'.
[imager:compileLatex:629] 
[imager:compileLatex:629] See the xcolor package documentation for explanation.
[imager:compileLatex:629] Type  H <return>  for immediate help.
[imager:compileLatex:629] ...
[imager:compileLatex:629] 
[imager:compileLatex:629] l.17 ...  \node[fill=lightkhaki] at (0,0) {Hello};
[imager:compileLatex:629] 
[imager:compileLatex:629] 
[imager:compileLatex:629] ! Package pgf Error: Unsupported color model `'. Sorry.
[imager:compileLatex:629] 
[imager:compileLatex:629] See the pgf package documentation for explanation.
[imager:compileLatex:629] Type  H <return>  for immediate help.
[imager:compileLatex:629] ...
[imager:compileLatex:629] 
[imager:compileLatex:629] l.17 ...  \node[fill=lightkhaki] at (0,0) {Hello};
[imager:compileLatex:629] 
[imager:compileLatex:629] 
[imager:compileLatex:629] ! Package xcolor Error: Undefined color `lightkhaki'.
[imager:compileLatex:629] 
[imager:compileLatex:629] See the xcolor package documentation for explanation.
[imager:compileLatex:629] Type  H <return>  for immediate help.
[imager:compileLatex:629] ...
[imager:compileLatex:629] 
[imager:compileLatex:629] l.17 ...  \node[fill=lightkhaki] at (0,0) {Hello};
[imager:compileLatex:629] 
[imager:compileLatex:629] 
[imager:compileLatex:629] ! Package xcolor Error: Undefined color `pgffillcolor'.
[imager:compileLatex:629] 
[imager:compileLatex:629] See the xcolor package documentation for explanation.
[imager:compileLatex:629] Type  H <return>  for immediate help.
[imager:compileLatex:629] ...
[imager:compileLatex:629] 
[imager:compileLatex:629] l.17 ...  \node[fill=lightkhaki] at (0,0) {Hello};
[imager:compileLatex:629] 
[imager:compileLatex:629] 
[imager:compileLatex:629] ! Package xcolor Error: Undefined color `pgffillcolor'.
[imager:compileLatex:629] 
[imager:compileLatex:629] See the xcolor package documentation for explanation.
[imager:compileLatex:629] Type  H <return>  for immediate help.
[imager:compileLatex:629] ...
[imager:compileLatex:629] 
[imager:compileLatex:629] l.17 ...  \node[fill=lightkhaki] at (0,0) {Hello};
[imager:compileLatex:629] 
[imager:compileLatex:629] ! Missing \endcsname inserted.
[imager:compileLatex:629] <to be read again>
[imager:compileLatex:629] \let
[imager:compileLatex:629] l.17 ...  \node[fill=lightkhaki] at (0,0) {Hello};
[imager:compileLatex:629] 
[imager:compileLatex:629] )
[imager:compileLatex:629] ! Incomplete \ifx; all text was ignored after line 17.
[imager:compileLatex:629] <inserted text>
[imager:compileLatex:629] \fi
[imager:compileLatex:629] <*> images.tex
[imager:compileLatex:629] 
[imager:compileLatex:629]