4

I keep getting a strange error when I load adforn with my documents. It boils down to fontspec changing the encoding from U to TU, and then it throws me an error and automatically updated the encoding with defaults.

I have solved this by making a new file in my texmf called TUOrnementsADF.fd containing the same content as the Uornements one. I was wondering if there's a better way to solve this. (Or if this would have the maintainer fix the problem).

This only really bothers me because I use vim-latexsuite, and that automatically registers this as an error and takes me to the file the error comes from. Just an aside.

An MWE:

\documentclass{article}
\usepackage{adforn}
\usepackage{fontspec}

\begin{document}

Hi\adfast{1}
\end{document}
7
  • Load adforn after fontspec.
    – egreg
    Commented Oct 3, 2017 at 14:18
  • I didn't think about that. It usually gets loaded automatically for me by polyglossia.
    – A Gold Man
    Commented Oct 3, 2017 at 14:19
  • polyglossia also loads fontspec; in this case load adforn after polyglossia.
    – egreg
    Commented Oct 3, 2017 at 14:24
  • I think the best approach would really be to use the OTF fonts provided by the font designer, rather than the type1 versions supported via the traditional font mechanism. The package isn't really intended for use with fontspec, frankly. It is rather a hack to allow the fonts to be accessed using traditional engines. If you aren't restricted to fonts accessible in that way, because you aren't using such an engine, there's no reason to use adforn. @egreg
    – cfr
    Commented Oct 4, 2017 at 4:08
  • @cfr There's a convenience to the package in that the symbols have commands set up for them already. Unless that's available without your package?
    – A Gold Man
    Commented Oct 4, 2017 at 5:30

1 Answer 1

8

The problem is a small bug in adforn.sty, which does, at the beginning,

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{adforn}[2010/07/25 v1.0 adforn CFR]
\RequirePackage{pifont}
\Pifont{OrnementsADF}

but the last call should be braced. The effect is that OrnementsADF becomes the current font and fontspec tries to load it with the TU encoding, failing at the task. Calls of \adforn or \adfast in the document are not affected.

Workaround: load adforn after fontspec (or other packages that depend on it, such as polyglossia), but the quirk should be fixed like

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{adforn}[2010/07/25 v1.0 adforn CFR]
\RequirePackage{pifont}
{\Pifont{OrnementsADF}}

so the change in the current font, which is only necessary to load the .fd file, is not carried along at group end.

The same strategy is adopted at the end of pifont.sty:

[...]
\newcommand{\ding}{\Pisymbol{pzd}}
\def\dingfill#1{\Pifill{pzd}{#1}}
\def\dingline#1{\Piline{pzd}{#1}}
\newenvironment{dinglist}[1]{\begin{Pilist}{pzd}{#1}}%
  {\end{Pilist}}
\newenvironment{dingautolist}[1]{\begin{Piautolist}{pzd}{#1}}%
  {\end{Piautolist}}
{\Pifont{pzd}}
{\Pifont{psy}}
\endinput
%%
%% End of file `pifont.sty'.
0

You must log in to answer this question.

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