4

Been looking around and everywhere it tells me to use \textbackslash in LaTeX.

However if I write a text "yadayadayada in \textbackslash c \textbackslash f we have...."

A demonstration or so would be highly apprectiated. Thanks for helping a noob.

Martin Scharrer
  • 262,582
  • 2
    A demonstration of what? What are you trying to achieve? Please describe your problem. – Gonzalo Medina Apr 12 '11 at 16:56
  • Ah sorry.. what happens is that I get a warning and it doesn't work. I was thinking that I wanted a demonstration in the correct form to write something like "\hi" <- without the "" in LaTeX. Thank you for your comment. –  Apr 12 '11 at 17:00
  • 2
    If you are trying to write verbatim short text, you can use \verb+\hi+. – Gonzalo Medina Apr 12 '11 at 17:04
  • @Gonzalo: This should be an answer. – Caramdir Apr 12 '11 at 17:19

2 Answers2

3

If you are trying to write verbatim short text, you can use \verb+\hi+; for longer verbatim texts you can use the verbatim environment; for further customizable possibilities you can use, for example, the fancyvrb package.

Gonzalo Medina
  • 505,128
3

If you want to write

\hi

in normal text (not verbatim) use \textbackslash{}hi or \textbackslash hi. (I'm not sure if there's any real difference between the two.)

doncherry
  • 54,637
  • use \def\CS#1{\texttt{\textbackslash#1}} and \CS{hi} –  Apr 12 '11 at 18:55
  • @Herbert I don't quite understand what you're responding to. Your solution gives me a macro for outputting Typewriter style text preceeded by a backslash; I was, however, proposing a solution in normal font style since I didn't see Donut saying that they wanted Typewriter/verbatim style (nor that a macro was needed?). – doncherry Apr 12 '11 at 19:36
  • @donherry: it is more or less common to set commands in typewriter font –  Apr 12 '11 at 20:06
  • http://tex.stackexchange.com/questions/109968/my-mathcalu-turns-out-to-be-curvy-different-than-default#comment241396_109968 ... :) – doncherry May 09 '13 at 22:38
  • I do not understand what you want to say? –  May 10 '13 at 05:30
  • @Herbert That wasn’t directed at you; I just wanted to point to the origin of the downvote to this answer since I consider it ... extraordinary. – doncherry May 10 '13 at 07:54