# How to output a curly brace, which is interpreted only as a character? [duplicate]

Possible Duplicate:
Writing { and } to a file with LaTeX

I want to output a curly brace, which will not be interpreted as a group delimiter. My attempt does not work:

\def\aa{\string}}


I want that calling \aa will output }.

EDIT As egreg mentionned, my aim is to have a brace that can be later on written into a file. The proposed solution \{ outputs correctly a brace, but attempting to write it in a file fails :

\newwrite\tempfile
\immediate\openout\tempfile="nico.txt"
\def\aa{\{}
\immediate\write\tempfile{blabla blabla \a blabla}


## marked as duplicate by egreg, clemens, Stefan Kottwitz♦Jul 5 '12 at 21:58

• You probably should clarify the purpose of this question, which I believe is not printing a brace, but outputting it when writing a file. – egreg Jul 5 '12 at 12:53
• Have you tried \def\aa{\}} ? – N3buchadnezzar Jul 5 '12 at 12:55
• @egreg : you read in my mind ... ;) – nicolas roy Jul 5 '12 at 21:37
• @nicolasroy Please look at the linked probable duplicate. – egreg Jul 5 '12 at 21:44
• @egreg : yes, it is exactly a duplicate. Can i close the question officially ? – nicolas roy Jul 5 '12 at 21:46

Just use \}

This is probably a duplicate question.

Edit: I should also say; putting a backslash \ before nearly any special character in TeX will cause LaTeX to treat it as non-special (and vice versa).

You can either use \} directly, or just put it inside the macro definition:

\def\aa{\}}

• The I should say part is wrong. Try \texttt{\{}. Compare that to \verb|{| – Clément Nov 18 '16 at 4:16
• @Clément \verb is a special command, naturally the rules do not apply to it. – codebeard Nov 18 '16 at 4:26
• I don't think you understand what I meant. I meant that, unless you use use T1 with inputenc, you won't get a monospace { by using \{ inside of \texttt. – Clément Nov 18 '16 at 6:12
• I see... Well feel free to update the answer to your liking, it's not as though it's relevant to the asker's updated question and it's a dupe anyhow. – codebeard Nov 18 '16 at 7:32