I am getting two times the error:

Package currfile Warning: File stack underflow! on input line xxx.

I am not explicitly loading currfile, but standalone seems to do.

I am getting this warning once after I load \usepackage{standalone} on a line, where a working if-directive is written (\ifclolor ... \fi) and once in the standalone.sty after \RequirePackage{currfile} on the line \ifsa@subpreambles.

I don't know, what that warning means, so I don't know, what to search for. This message is not treated anywhere so far.

Edit: After some searching I found out that it appears when loading unicode-math AND standalone

% arara: lualatex
  • 2
    currfile maintains a stack for referring to the file currently being read. I guess that the warning is issued if the macros try to access the stack and find it empty. Without an example showing the issue not much more can be said. – egreg Sep 27 '13 at 11:15
  • 1
    I get no warning if I load currfile (or standalone) before unicode-math. – egreg Sep 27 '13 at 13:39
  • 1
    @egreg, LaRiFaRi: I will have a look at it once I find time. I – Martin Scharrer Sep 29 '13 at 22:52
  • 1
    @MartinScharrer Is there a general feature of package loading sequences which might cause this error? I'm getting it though I'm not using unicode-math. I guess I need to load standalone earlier but I'd like to figure out earlier than what because the 'what' is a wrapper around beamer.cls so it means some messing around. – cfr May 8 '14 at 23:43
  • 2
    @LaRiFaRi: I guess the scrreport class is changing the definition of \input or related macros. Our workaround to load the package with \RequirePackage{currfile} before the \documentclass is a good way to avoid it. I will try to debug that, but in general there is no 100% solution to have it working as everyone can overwrite everything ;-) – Martin Scharrer Nov 19 '15 at 10:15

This warning is caused by currfile in an at-end hook because it tried to restore the parent file name which was not available. This is the case if currfile is loaded by another package and not in the main file.

currfile requires filehook and installs corresponding at-begin and at-end hooks for all files. If filehook is not already loaded before the hooks will only be affected by all files opened afterwards. However, if it is already loaded, the at-end hooks of currfile and the package which loads it, and the package which loads that package, and so on, are executed while the at-begin hooks are already executed before currfile patched them. This leads to a stack underflow.

A workaround is to load currfile very early yourself in the preamble, before filehook is loaded by any package or class.

As I see no real way to avoid the stack underflow in this case and it is not a problem and no underflow should occur in any other case, I now remove the warning altogether. In that case the \currfilename macros where always empty. I now changed them to hold the main file name. I will publish these changes as a new version soon.

See the official bug ticket for further information.

  • Submitted currfile v0.7c 2015/04/23 now to CTAN. Should be there in a day or two. Mirrors might need an extra day. Distributions like MikTeX and TeXLive will update it usually in one week after that. – Martin Scharrer Apr 23 '16 at 18:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.