TransWikia.com

"Improper alphabetic constant" error when input standalone subfile

TeX - LaTeX Asked by LXH on May 17, 2021

Upgrade to TexLive2020 recently, and get "Improper alphabetic constant" error when input a subfile with the standalone pkg. There’s no problem if the subfile contents are directly put in the main file. There seems also no problem if the subfile is regular without begin{document}...end{document}.

The file compiled fine with old TexLive2019. It seems if I change the class to article, it goes fine. But I write in Chinese, the ctexart class is much more convenient. Please help.

Here’s a MWE.
Main file:

% !TeX encoding = UTF-8
documentclass{ctexart}

usepackage{standalone}

usepackage{tikz}

begin{document}
    input{G105}

    begin{tikzpicture}
        coordinate (O) at (0,0);
        coordinate (A) at (1,1);
        fill[gray] (O) |- (A) -- cycle;
    end{tikzpicture}
end{document}

Subfile: G105.tex

% !TeX encoding = UTF-8
documentclass[class=ctexart]{standalone}
usepackage{tikz}

begin{document}
    begin{tikzpicture}
    coordinate (O) at (0,0);
    coordinate (A) at (1,1);
    fill[gray] (O) |- (A) -- cycle;
    end{tikzpicture}
end{document}

One Answer

That is a similar problem as in https://tex.stackexchange.com/a/568498/2388 but here with standalone and not subfiles.

By emptying the hook before loading the file you can avoid the problem (I had to use the fandol fontset, as the default errors for me):

documentclass[fontset=fandol]{ctexart}

usepackage{standalone}

usepackage{tikz}

begin{document}
%ShowHook{env/document/before}
RemoveFromHook{env/document/before}[xeCJK] 
    input{G105}

    begin{tikzpicture}
        coordinate (O) at (0,0);
        coordinate (A) at (1,1);
        fill[gray] (O) |- (A) -- cycle;
    end{tikzpicture}
end{document}

Correct answer by Ulrike Fischer on May 17, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP