1

The following MWE works like a charm:

% test.tex
\documentclass{article}
\usepackage[subpreambles]{standalone}
\usepackage{filecontents}
\usepackage{glossaries}
%
\begin{filecontents}{stdalone}
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\newglossaryentry{cafe}
{
    name={cafe},
    % name={café},
    description={beverage that makes you sleep if you don't drink it}
}
\begin{document}
Foo.
\end{document}
\end{filecontents}
%
\begin{document}
\input{stdalone}
\end{document}

But, as soon as name={cafe} is replaced by some string containing accents, e.g. name={café}, the standalone input file's content is ignored with the following warning:

Package standalone Warning: Sub-preamble of file 'stdalone.tex' has changed.
Content will be ignored. Please rerun LaTeX! on input line 14.

The sub-preamble of file stdalone.tex is stored in the file test.sta and, AFAICS, it doesn't change between compilations (from the 2nd one).

Do you see what's going on?

11
  • 3
    It works if you add \usepackage[utf8]{inputenc} to the main file, so it is probably a catcode issue. Apr 8, 2016 at 20:13
  • 1
    Note that glossaries is not fully functional if entries are defined after \begin{document} and it is strongly recommended that all entries be defined in the preamble (or in files loaded there etc.). Also glossaries provides its own method for loading files of entries and it would almost certainly be better to make use of that facility.
    – cfr
    Apr 8, 2016 at 21:35
  • @UlrikeFischer In fact, I simplified too much my real use case for the MWE above: in my real use case, both the standalone and the inputenc packages are loaded in the main but through a personal class, and the trouble still occurs. But your comment made me realize the former was loaded before the latter, which wasn't in any case a good idea. Interchanging the order solved this issue :) Apr 8, 2016 at 21:49
  • 1
    @cfr The .sta contains all is in the preamble of the subfile(s), for instance the \usepackage and the \newglossaryentry commands. If it would not be input in the preamble of the main file; compilations would fail because of the \usepackage commands. Apr 9, 2016 at 14:54
  • 1
    @cfr That depends whether the option subpreambles is used or not (and subsequent other options sort, print, etc.). Apr 9, 2016 at 21:26

0

You must log in to answer this question.

Browse other questions tagged .