6

After a recent tlmgr update, the code below no longer compiles:

\documentclass{article}

\usepackage{xfrac}

\DeclareCollectionInstance{smallLetterFrac}{xfrac}{default}{text}
  {phantom=c, scale-factor=1.0, slash-left-kern=-.05em}
\newcommand{\smallLetterFrac}[2]{%
  {\UseCollection{xfrac}{smallLetterFrac}\sfrac{#1}{#2}}}

\begin{document}
\smallLetterFrac{a}{c}

\end{document}

With pdflatex I get the following error:

! Undefined control sequence.
l.5 \DeclareCollectionInstance
                              {smallLetterFrac}{xfrac}{default}{text}

While searching I do not see many usages of \DeclareCollectionInstance, so perhaps it was deprecated? From what I can see, it is/was defined in xtemplate.sty.

There was a recent question about \sfrac (Undefined control sequence when using \sfrac) but it does not seem related, to my novice eyes.

Should \DeclareCollectionInstance be replaced by something else? Note that this is not my code, and I don't know much LaTeX to understand it, but we use this code in LyX so my goal is to adapt the code that LyX generates to prevent compilation failures for users.

4
  • 1
    We reached the conclusion that collections don't really work, so they were removed before finalising the template concept. I'm wondering where this is popping up in LyX.
    – Joseph Wright
    Commented Jun 14 at 16:49
  • It was introduced here: git.lyx.org/gitweb/…
    – scottkosty
    Commented Jun 14 at 17:00
  • @g-milde trying to ping Günter in case they happen to see this.
    – scottkosty
    Commented Jun 14 at 17:01
  • The code was introduced to address lyx.org/trac/ticket/5220. As for why the code uses \DeclareCollectionInstance, I don't know.
    – scottkosty
    Commented Jun 14 at 17:03

1 Answer 1

6

We removed collections from the documented part of xtemplate some time ago, and have now removed it entirely. Prior to removal, the documentation discussed why we had made this decision. Essentially, collections do not really work: for example, in the example from the question, any attempt to make an alternative collection (e.g. a minipage) apply would have resulted in only one 'winning'.

As such, the recommendation at present is simply to drop the collection entirely, so here

\NewCommandCopy\smallLetterFrac\sfrac

would be my choice (unless you can simply drop \smallLetterFrac entirely.)

If you want the updated defaults to apply, you could add

\EditTemplateDefaults{xfrac}{text}
  {phantom=c, scale-factor=1.0, slash-left-kern=-.05em}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .