This question is related to a previous question of mine Increasing nesting level for parameters and global xparse macros?
I use a modified version of \defsym as given by egreg in this answer to the second question above. However I have the problem that the nomenclature definition fails on occasions, so some symbols are missing. For a MWE check egreg's answer together with the code snippets below.
I do neither understand when exactly it fails nor can I think of a solution how to fix it. It seems to happen when the first use of the symbol is invisible in some way, e.g. \phantom{\Ak} or
\begin{align}
\Uk[j]
\end{align}
The align environment seems to probe the line for the length, therefore the first use is invisible. This can be seen using a \typeout in the symbol definition which will then appear twice in the log.
Inserting one of those snippets above after \begin{document} in egreg's MWE causes the symbols to disappear from the nomenclature.
- I'd like to understand why
\nomenclaturedoes not work e.g. in the following pointless example$\phantom{\nomenclature{$\alpha$}{Foo}}$. I don't understand why writing something to a file fails in this example. - Is there some systematic when it fails?
- How to fix it? Is it possible to check if
\nomenclaturedid successfully write the symbol to the nlo file?
