chrmatt / algpseudocodex

LaTeX package for typesetting pseudocode.
38 stars 2 forks source link

Compilation errors when using \includeonly #10

Open plescornet opened 1 year ago

plescornet commented 1 year ago

Hi !

I have a compilation error when using algorithmic environment when using \includeonly{...} to compile my chapters separately. I'm using an up-to-date texlive install with algpseudocodex v1.1.0.

Here is a MWE showing the issue :

\documentclass{scrreprt}

\usepackage{algpseudocodex}

\includeonly{mwe2.tex}

\begin{document}
\include{mwe1.tex}
\include{mwe2.tex}
\end{document}

And mwe1/2.tex contain :

\begin{algorithmic}[1]
  \Function{f}{$G$}
    \State $G$
  \EndFunction
\end{algorithmic}

The first error is :

! LaTeX Error: No counter 'algpx@indentEndPage-0' defined.

Deleting the .aux files removes the error. According to some colleagues, there was no error in the previous version of algpseudocodex.

chrmatt commented 1 year ago

Hi! The code compiles without errors for me. Maybe you have some leftovers from old versions of the package in the aux file. Do you still get an error after cleaning up all auxiliary files?

plescornet commented 1 year ago

Just tried it : cleaned up the aux files, compiled it one time without the includeonly and compiled it another time with it. I still get the error.

chrmatt commented 1 year ago

Hmm, I see. So the reproduce the error, one first needs to compile without the includeonly, and then (without cleaning the aux files) add the includeonly and compile again. I can try to look into it, but an easy fix is to clean up again before compiling...

plescornet commented 1 year ago

Seems a good fix for now, I tested several situations where I thought the lack of auxiliairy files would raise an issue, but it doesn't in my project. Should I close the issue or leave it for now ?

chrmatt commented 1 year ago

If you are happy, feel free to close it. I played a bit around and don't see an easy fix for this. The error is caused by trying to access a reference defined in mwe1.tex, which then does not exist. There may be some ways to work around this, but I have no experience with \includeonly and this particular order of compilations seems to start the execution in an incosistent state...

plescornet commented 1 year ago

Thanks for your work !

leolavaur commented 4 months ago

Hi @chrmatt, sorry for digging out this issue. I am having the same problem, although deleting .aux files between compilations is not a satisfactory solution for my use case. In fact, I need these files to allow cross-referencing in my document (a big thesis manuscript), but without compiling the concerned chapters. Would you mind taking another look at it and reopening the issue so that others might see it as unresolved?

I looked around, and it does not seem that this issue is that common, although using \includeonly and packages that rely on counters is. Maybe there is inspiration to take there? Another thing that surprises me, is why the counter wouldn't exist in the first place? I would assume that since the .aux files are preserved, any counter defined when writing an algorithm in an excluded chapter would be preserved too.

Anyway, I really like this package, but it currently becomes really frustrating! I hope we can find a solution. Thanks again!

chrmatt commented 4 months ago

Hi @phdcybersec! I'm glad you like the package and I'm sorry for your frustration. I'll try to take a look soon, but I can't promise a quick fix. If anybody has an idea how to fix this, please let me know and I'll try to make it work.

tobast commented 2 months ago

If this might help, I've encountered the exact same error message (! LaTeX Error: No counter 'algpx@indentEndPage-0' defined.) in a document where I mistakenly \usepackage'd both algpseudocodex and \algpseudocode.

plescornet commented 3 weeks ago

I don't know how but it seems that my MWE compiles now. If no one opposes, I can close this issue. Thanks for the package !

chrmatt commented 3 weeks ago

I still get the error following the instructions discussed before:

So the reproduce the error, one first needs to compile without the includeonly, and then (without cleaning the aux files) add the includeonly and compile again.

plescornet commented 3 weeks ago

Sorry, I forgot I changed the system-wide algpseudocodex.sty file. Problem's still there.

leolavaur commented 3 weeks ago

Yeah, this is still true today, and like discussed, recompiling the whole document is not always feasible. Please keep the issue open in case someone with more time and/or knowledge comes across it!