24

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.

Caramdir
  • 89,023
  • 26
  • 255
  • 291
Till
  • 343
  • 1
  • 2
  • 6

4 Answers4

17

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

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

JorgeGT
  • 1,602
  • 12
  • 14
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.
  • \guillemotleft``Welcome''\guillemotright for french quotation marks. Make sure you also have \usepackage[T1]{fontenc} in the preamble.

enter image description here

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

smonff
  • 103
Matthew Leingang
  • 44,937
  • 14
  • 131
  • 195
8

This may be what you want:

enter image description here

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

\begin{document}

\guillemotleft``Welcome''\guillemotright

\end{document}

For code listing, you can use listings package:

enter image description here

\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.

Leo Liu
  • 77,365
  • 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
3

You can simply use brackets around one of your < or > symbol to avoid merging it with the second one. For example <{<}My text{>}>.

Miix
  • 31