I managed to produce strange interference between nested \import and superscripts, made accessible for LuaTeX by realscripts.sty.

My document organisation depends on the comfortable, path-agnostic behaviour of \import (or something equivalent). Once ago, when I started nesting \imports, I wondered if this would break some day. It has worked remarkably well most of the time---except for an extreme case I stumbled on now:

The package realscripts makes the superscript alphabets of well-equipped OpenType fonts available as default \textsuperscript and footnote marks, as a drop-in for use alongside fontspec. This normally works well, and it looks very nice to have some kind of optical sizes for single-size OTF fonts, as the font I use (Junicode) has.

Now this is no problem within the main document itself, and it also works when I include another document with footnotes via \import. BUT when this document contains another \import itself (second nesting level), footnote marks are prepended (both in the main and the footnote text) with a lot of file path/font name babble, which reads like kind of fontspec searching for the fonts in the directory of the second nesting.

MWE (TeX Live 2015, LuaTeX, Version beta-0.80.0 (Web2C 2015) (rev 5238) on both Linux and FreeBSD):


\subimport{}{importdirect.ltx} % This works

\subimport{}{importindirect.ltx} % This looks very strange




Minimal broken example\footnote{footnote}
and \textsuperscript{textsuperscript}

Then run lualatex main (You can imagine how things break when I have underscores and such nasty things in my real paths and filenames). Note that the superscripts themselves are typeset correctly!

This is font-dependent. It happens to {Junicode} and {Linux Libertine O}, and possibly others. TeX Gyre fonts seem to be immune. It seems unrelated to lualatex does not work with import/subimport when used in standalone setup (at least, the first nesting level works without problems, and changing \pdftexversion didn't do the trick).

XeLaTeX deals with this case without any problem.

My question, variant 1: This seems to be a bug, either in fontspec's LuaTeX interna, or in LuaTeX itself. What to do? (If it were of realscripts's fault, XeTeX would break, too, wouldn't it?)

My question, variant 2: Is there a way to redefine superscript text (or footnote marks) so that they do not eat up the details offontspec dealing with font selection?

My question, variant 3: Things break with nested \imports. What is wrong with import.sty (for TeXnical curiosity, or a fix), and/or (as a workaround) are there alternative import logics for external documents?

My question, variant 4: Things break with realscripts. Is there a (more) canonical way to load OpenType superscript styles, e. g. with fontspec itself? Why is LuaTeX affected and XeTeX not?

[EDIT] The result, produced with a fresh TeX Live 2015 install:

The resulting main.pdf (compressed) with buggy footnote references

  • I've tried to replicate this on my system (TL2015, mostly updated), and with a prerelease version of fontspec, and I don't see the same problems… Jan 27 '16 at 12:28
  • Hrm. With current TL16pretest (luatex-0.95.0, fontspec 2016/02/01 v2.5a), the issue still persists. May 13 '16 at 20:10

Your Answer

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

Browse other questions tagged or ask your own question.