I would like to create an inline verbatim text for a regular expression. The verbdef package does not like when I put curly braces into its second argument. I tried with escaping backslashes but that did not work.




What is the meaning of the \re2 regular expression?


I got the following error message:


! Too many }'s.

l.4 \verbdef{\re2}{([^/]*/){3}}

I looked for a long name of curly brace like \curlybraceleft but did not find one.

How can I solve this typesetting problem?

  • Welcome to TeX.sx! A tip: If you indent lines by 4 spaces or enclose words in backticks `, they'll be marked as code, as can be seen in my edit. You can also highlight the code and click the "code" button (with "{}" on it).
    – nickpapior
    Mar 17, 2013 at 18:55
  • Thanks, both the welcoming and the typesetting tip. And the edit.
    – Gergely
    Mar 17, 2013 at 18:59
  • You are welcome, please edit the question adding where the \begin{document} should be placed, I am not familiar with the verbdef package and whether \verbdef must only be called in the preamble? :)
    – nickpapior
    Mar 17, 2013 at 19:06
  • zeroth, I made a minimal example that showed the error message and the problem. When you want to use that inline verbatim text, you simply use the \re macro that was being defined in the preamble.
    – Gergely
    Mar 17, 2013 at 19:18
  • No, I meant that your MWE is missing a \begin{document} in the example. I do not know where to place it (albeit I now do) :)
    – nickpapior
    Mar 17, 2013 at 19:20

1 Answer 1


The documentation of verbdef is indeed rather scanty. Your attempt has two issues.

First of all you can't define a command that has digit and letters in its name: either the name is a single digit or letters only.

Second issue: if the text to be stored verbatim has braces in it, you have to use a syntax like the ordinary \verb command, so for instance


where the delimiter character (here |) does not appear in the verbatim text.

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.