0

I'd like to make an \interrobang macro for my personal package of useful macros that prints the character (otherwise known as interrobang). However, some fonts don't have this character, and in that case I'd like to silently fall back to printing simply !?. Is there a way to do this?

What I get when I type the Unicode character in a macro and then use the macro in the document when the character is not available is:

! Undefined control sequence.
\u-default-8253 #1->\textinterrobang
  • 1
    Related: Can I define a fallback character in pdfLaTeX? – Alan Munn Oct 17 '16 at 15:17
  • The u-default-xxx naming that you are using is non standard so you are presumably using some contributed package to set up characters. The answer will depend on that package mostly. – David Carlisle Oct 17 '16 at 15:17
  • @DavidCarlisle: The only packages I'm using are: memoir (documentclass), [utf8x]{inputenc}, [T1]{fontenc}, mathpazo, berasans, microtype, tabularx, and my own package of macros (which does not itself load any packages). And I defined the interrobang macro as `\newcommand{\interrobang}{‽}. What in there might be causing the nonstandard notation? – scorchgeek Oct 17 '16 at 15:23
  • yes it's utf8x (I'd use the standard utf8 unless there is something that really doesn't work in that case) (although utf8x is called as a package option to inputenc it is effectively a completely different package that redefines most of the original – David Carlisle Oct 17 '16 at 16:08
  • 1
    It turned out that the OP’s problem was actually another one, but the sheer answer to the question as it is asked in the title is: exploit the \iffontcher conditional provide by e-TeX. – GuM Oct 17 '16 at 18:48
1

The particular error that you show is unrelated to the font (tex never got that far) simply that the command is undefined, you can define

\providecommand\textinterrobang{!?}

then the error will go, and if any other font package defines this command to access a character in a font then \providecommand will do nothing.

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.