TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
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). – zeroth Mar 17 '13 at 18:55
Thanks, both the welcoming and the typesetting tip. And the edit. – Gergely Mar 17 '13 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? :) – zeroth Mar 17 '13 at 19:06
Thanks, egreg, it made it work. – Gergely Mar 17 '13 at 19:15
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 '13 at 19:18
up vote 3 down vote accepted

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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