chrmatt / algpseudocodex

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

Compilation errors when using \includeonly #10

Open tippex-ls opened 1 year ago

tippex-ls 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?

tippex-ls 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...

tippex-ls 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...

tippex-ls commented 1 year ago

Thanks for your work !

leolavaur commented 2 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 2 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 1 month 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.