2

Let's say I want to type:

Hi, my name is {Mika}

When I use $$ on both sides:

$$ Hi, my name is {Mika} $$

It would be italicize and the brackets {} would go away. How can I prevent that?

5
  • 3
    $$ <...> $$ is Plain-TeX syntax for display math mode (hence the italics). What are you trying to achieve with $$? – Paul Gessler Feb 16 '15 at 7:33
  • 4
    Load amsmath and use \[ \text{Hi, my name is \{Mika\}} \]. Do not use $$...$$ in LaTeX. – karlkoeller Feb 16 '15 at 7:33
  • BTW: Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. – karlkoeller Feb 16 '15 at 7:34
  • 2
    You can prevent that by not using $$ on both sides ;-) – Harald Feb 16 '15 at 9:45
  • If you wish to italicize text, then using the math mode is absolutely wrong. Just go for \textit{Hi, my name is \{John Doe\}}. – Claudio Fiandrino Feb 16 '15 at 9:45
7

{ and } are special. You need to escape them to use them properly - \{ and \}. And, for the setting you seem to be attempting, it may be better to use the center environment:

enter image description here

\documentclass{article}
\begin{document}
\begin{center}
  Hi, my name is \{John Doe\}
\end{center}
\end{document}

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.