I am trying to create a very basic package for use with a font called HEJI2 (which provides some music symbols to use in-line). My code looks like this:

\ProvidesPackage{heji}[2019/12/9 v1.0]
\RequirePackage{fontspec}[2018/07/30 vv2.6h]


\newcommand*{\fsize}{\dimexpr\f@size pt\relax}

\newcommand{\heji}[2]{\mbox{#1\hspace{0.3mm}\raisebox{0.25\fsize}{\large\HEfont #2}}}

    \renewcommand{\heji}[2]{\mbox{\raisebox{0.25\fsize}{\large\HEfont #2}#1}}



Using the package seems to work, however when I compile it, I get the following (nonfatal) errors:

! Missing = insterted for \ifnum.
<to be read again>

! Missing number, treated as zero.
<to be read again>

Not sure what this means exactly. I appear to be able to return through the messages and I get a properly formatted .pdf in the end according to my package specifications. Would appreciate any help! (Compiling with Lualatex)

  • Replace [2019/12/9 v1.0] by [2019/12/09 v1.0]... Dec 9 '19 at 1:31
  • Thank you! Didn't even occur to me Dec 9 '19 at 1:35
  • You're welcome! Some places (for instance texdoc usrguide) tell that this date should be in the format YYYY/MM/DD (which is now deprecated and should actually be in the ISO format YYYY-MM-DD), but it actually must be in this format. I wonder if this should be made a bit more flexible... Dec 9 '19 at 1:40

You can find, for example, in LaTeX2ε for authors (texdoc usrguide), section 3.2 Preamble commands:

The optional argument <code><release-date></code> can be used to specify the earliest desired release date of the class file; it should contain a date in the format <code>yyyy/mm/dd</code>. If a version of the class older than this date is found, a warning is issued.

That paragraph actually describes the second optional argument to \documentclass, but the date parser is the same. In The LaTeX2ε sources (texdoc source2e), section 68.2 Package name and version there is more or less the same paragraph about \ProvidesPackage.

Firstly, that date format is (still supported but) deprecated, and now the ISO format YYYY-MM-DD should be used instead.

And that requirement is not entirely true. Specifically the day field must be DD, while the other two can even be empty (common sense advises not to ;-), so for example \ProvidesPackage{heji}[1/1/09 v1.0] would've worked. You were unfortunate enough to remove the leading zero from the wrong place ;-)

  • Thanks so much for your help! Will try my luck with another question, which is more general. If I use fontspec to choose a system font (HEJI.ttf), is there some way I can make sure the package looks in the right directory on anyone's system, independent of OS etc, provided they have installed it? On windows, for instace, the files seem to be in a couple of locations...not only c:\windows\fonts, but also in some \users\local folder as well... wondering if you know anything/have any ideas on this? Dec 10 '19 at 15:31
  • @ThomasNicholson Glad it helped :-) I'm not a font expert, so I may not be the best person to help you with this. Usually, if you are writing a font package, the font files will go in the fonts folder of your TeX distribution's directory tree, and TeX will look for them there. If it's not for a package (by package, I mean installed by your TeX distribution), then I think it gets trickier. I suggest you mark this question as solved and ask a new one, so that someone with more experience with fonts than me can help you :-) Dec 11 '19 at 20:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.