gsalzer / subfiles

class and package for multi-file projects in LaTeX
LaTeX Project Public License v1.3c
25 stars 1 forks source link

Probrem with using LuaLaTeX and LuaTeX-ja and subfiles #11

Closed yuishin-kikuchi closed 3 years ago

yuishin-kikuchi commented 3 years ago

(This problem have been solved. Please delete this message. This was a bug in LuaTeX-ja.)

Hi, gsalzer.

(It is not a bug report of subfiles because I know there's something wrong with L3 kernel.)

Thanks for providing subfiles. Before, I reported some problems with using LuaLaTeX and subfiles, and the problem was in L3 kernel, now the behavior has corrected.

Do you know LuaTeX-ja? It is a package for Lua(La)TeX and it allows to input CJK language. LuaTeX-ja hacks LuaTeX system with Lua codes.

Please see the following codes for LuaLaTeX:

test.tex

\documentclass{article}
\usepackage{luatexja}
\usepackage{subfiles}
\begin{document}
\subfile{testsec}
\end{document}

testsec.tex

\documentclass[test]{subfiles}
\begin{document}
abc
\end{document}

Compiling test.tex leads to produce the error "Can be used only in preamble." I already have reported the problem to the LuaTeX-ja author. The author said, LuaTeX-ja uses hooks to before entering document environment, and the codes for hook contain commands for preamble. When reading \begin{document} in testsec.tex, the hook is processed. But it's strange because it's entered {document} environment in test.tex already. I think it's not a bug in subfiles nor in LuaTeX-ja.

However, I don't know much about LaTeX hook system. I'd like to report to L3 developers but I cannot. Could you please report the problem to L3 developers?

Thanks.

gsalzer commented 3 years ago

Well, if you want to blame someone, it is probably subfiles. I expected this problem to appear, but the solution that I have implemented (not yet on github) may break something else. Have to test a bit more.

Thanks for reporting the issue.

gsalzer commented 3 years ago

There is a new version in the top level directory of the repository, subfiles.sty and subfiles.cls that handles your example correctly (at least I think so). If you don't mind, please try it and report whether there are still any issues.