# Escape “> and <”

I have the following piece of text which I want to output literally: <<"Welcome">>. However it's converted to those funky quotations. I've been trying all sorts of things with \ mostly but to no avail.

\verb=!<<"Welcome">>! kind of works, or gets the job done, but then it loses all other formatting (font face, size, etc.) as well.

-
–  Stefan Kottwitz Feb 13 '11 at 20:13
@stephan, your \! does not appear.. –  Yossi Farjoun Feb 14 '11 at 14:54

A quick solution would be to use inline math mode: $<<$Welcome''$>>$

edit: if you want to preserve formatting, have you considered \textgreater and \textless ?

-
No I haven't, but I'll google what they are about! –  Till Feb 13 '11 at 21:10
Thanks again for the quick help! –  Till Feb 13 '11 at 21:14

I don't think the less-than and greater-than signs are that pretty here. You might try instead:

• $\langle\langle$Welcome''$\rangle\rangle$ for angle brackets that are narrower and taller than the mathematical relations.
• ![\guillemotleftWelcome''\guillemotright][1] for french quotation marks. Make sure you also have \usepackage[T1]{fontenc} in the preamble.

To be honest I don't think any of those look that pretty, but it is what you asked for. :-D

-
And $\ll$, $\gg$ –  Leo Liu Feb 13 '11 at 20:12
@Leo Liu: good one. I added it to my answer. –  Matthew Leingang Feb 13 '11 at 20:23
It's a code listing. I have pretty much no control over what it says and I need to display it. Thanks though, I learned a lot! –  Till Feb 13 '11 at 21:10

This may be what you want:

\documentclass{article}
\usepackage[T1]{fontenc}

\begin{document}

\guillemotleftWelcome''\guillemotright

\end{document}


For code listing, you can use listings package:

\documentclass{article}
\usepackage[T1]{fontenc}

\usepackage{listings}
\lstset{
basicstyle=\ttfamily,
columns=fixed,
literate={<<}{\guillemotleft}1 {>>}{\guillemotright}1
}

\begin{document}

\lstinline!<<"Welcome">>!

\end{document}


You can modify the literate as you wish.

-
Looks pretty sweet and I salute you for you fu! Unfortunately, it's a code listing. But I will keep this in mind! –  Till Feb 13 '11 at 21:09
@Till: You didn't mention that. My previous solution use lisings package especially for code listing. But I thought it's normal text and deleteted it. You may have a look at the edit history of this question (click the time after edited). –  Leo Liu Feb 13 '11 at 21:31
I recovered the previous solution. –  Leo Liu Feb 13 '11 at 21:34
Thanks for editing and extending your answer. I'll make sure to provide more details next time. –  Till Feb 13 '11 at 22:35