I have some problems using the exclamation mark symbol explicitly, so I have to find another way to print it on math mode. I tried to use \usepackage[utf8]{inputenc} but apparently I have to define a new macro and I really don't want to do that. Any advice would be great.

Edit: I have an application that generates a .tex file as output, the input is another file that I have to parse, and ! is as reserved symbol, so I can't put it explicitly.

  • 2
    what is wrong with using ! that is the normal way. Feb 17, 2016 at 15:40
  • 1
    Welcome to TeX.SX! Normally $n!$ works fine
    – egreg
    Feb 17, 2016 at 15:42
  • Thanks. I will add more information about the reason that I can't use the symbol explicitly.
    – 6c656c
    Feb 17, 2016 at 15:45
  • \newcommand*\bang{!} then $n\bang\bang$.
    – Manuel
    Feb 17, 2016 at 15:51
  • 1
    @Manuel youtube.com/watch?v=T5Xl0Qry-hA
    – Johannes_B
    Feb 17, 2016 at 15:54

1 Answer 1


! is at position hex 21 so you can use ^^21 which will make a ! token just as if a ! had been in the input.


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.