0

I have defined the following switches in the document's preamble:

\newcommand{\lin}{\addfontfeature{Numbers=Lining}}
\newcommand{\old}{\addfontfeature{Numbers=OldStyle}}

I appear to be getting an 'Undefined control sequence' error when I code:

\textbf{\old1432\lin. — Blah...}

My impression is that xelatex reads my custom control sequence as '\old1432' (rather than the intended '\old' + '1432' with no intervening space — intended result: 1234. — Blah...).

The syntax highlighter (see above) apparently believes the same... that I coded two control sequences in succession... the first of which is '\old1432' immediately followed by '\lin'.

What would be the correct way to code this so that xelatex can read it and so there is no leading space before 1234 and no space between '1234' and the ensuing period in the output?

IOW, do I need to add a specific terminator after these control sequences so xelatex can figure out where exactly they end and separates from the ensuing text?

2
  • 1
    no, with the default settings \old1234 is \old 1234 If you want help with an error message please provide the exact error that you got (from the log file) and a small test case. The error message will show which command is undefined. Commented Oct 29, 2020 at 21:53
  • Never mind... the latex code is generated from markdown and the yaml block that creates the preamble contained an error. Fixed.
    – T F
    Commented Oct 29, 2020 at 23:26

1 Answer 1

2

You did not provide a test document but

\documentclass{article}

%\usepackage{fontspec}
\newcommand{\lin}{\addfontfeature{Numbers=Lining}}
\newcommand{\old}{\addfontfeature{Numbers=OldStyle}}
\begin{document}


\textbf{\old1432\lin. — Blah...}

\end{document}

produces the error

! Undefined control sequence.
\old ->\addfontfeature 
                       {Numbers=OldStyle}
l.9 \textbf{\old1432\lin. — Blah...}
                                    
? 

showing that \addfontfeature is undefined.

Adding fontspec by uncommenting the \usepackage it runs without error (although with warnings that this does not apply to the default font)

1
  • Correct. The syntax error in the yaml block I mentioned above resulted in pandoc's latex conversion only using the defaults from the template. I did not notice it at first because I was focused on a performance issue with the pandoc compilation taking forever. and that's where I started wondering whether my code was in error when the cause of the problem was just that the \\old and \\lin switches were not defined in the generated latex file's preamble. Changed my compilation to keep the intermediate latex file that gets processed by xelatex and the cause of the problem was obvious.
    – T F
    Commented Oct 30, 2020 at 23:06

You must log in to answer this question.

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