How does one insert a backslash or a tilde (~) into LaTeX?How do I draw a tilde in math mode?How can I write...

Is King K. Rool's down throw to up-special a true combo?

Want to switch to tankless, but can I use my existing wiring?

Is all copper pipe pretty much the same?

Can "semicircle" be used to refer to a part-circle that is not a exact half-circle?

It's a yearly task, alright

Making a sword in the stone, in a medieval world without magic

Life insurance that covers only simultaneous/dual deaths

A curious inequality concerning binomial coefficients

What to do when during a meeting client people start to fight (even physically) with each others?

Prove that the total distance is minimised (when travelling across the longest path)

Why do Australian milk farmers need to protest supermarkets' milk price?

Confusion with the nameplate of an induction motor

Potentiometer like component

Time dilation for a moving electronic clock

Block storage rewrites

Silly Sally's Movie

Gravity alteration as extermination tool viable?

Provisioning profile doesn't include the application-identifier and keychain-access-groups entitlements

How to discourage/prevent PCs from using door choke-points?

What is the definition of "Natural Selection"?

Time travel short story where dinosaur doesn't taste like chicken

Is a lawful good "antagonist" effective?

Is "history" a male-biased word ("his+story")?

How is the Swiss post e-voting system supposed to work, and how was it wrong?



How does one insert a backslash or a tilde (~) into LaTeX?


How do I draw a tilde in math mode?How can I write tilde ~ in math mode?How to insert LaTeX symbols?Trouble inserting “~” (not equivalent to sim}print the backslash in the pdf documentHow to use special symbols in LaTeX, such as @, ~How do I get a literal ~ in math mode?How to express ~ (tilde)How can I generate the ~ symbol in LaTeX?How can I write backslash “” in text?How do I lower the widetilde accent, i.e., move it closer to the variable?Typesetting of negative versus minus?Can I get a widebar without using the mathabx package?How to insert LaTeX symbols?How to express ~ (tilde)How to use special symbols in LaTeX, such as @, ~How can I write tilde ~ in math mode?How do you get a lower or higher tilde/~?Printing backslash from a luacode* environmentHow to insert a dashed line over a bigwedge symbol so that the dashed line behaves like overline would?













730
















  • How does one insert a "" (backslash) into the text of a LaTeX document?

  • And how does one insert a "~" (tilde)? (If you insert ~, it will give you a tilde as an accent over the following letter.)


I believe backslash may be used in math formulae, but not into text itself. Lamport's, Kopka's, and Mittelbach's texts have said as much (but no more), and so left me hanging on how to get a backslash into regular text.










share|improve this question















migrated from stackoverflow.com Jan 20 '11 at 17:54


This question came from our site for professional and enthusiast programmers.














  • 1





    For the special case where a backslash or tilde must be written to an auxiliary file or shell escape see: How can I provide a verbatim (unescaped) commandline for executing with write18?

    – Martin Scharrer
    Apr 13 '12 at 10:28








  • 4





    For future reference, this is a great resource for finding out what to do to accomplish a given character.

    – Parthian Shot
    Feb 12 '15 at 21:42













  • For MathJax use simply sim.

    – Kai Noack
    Feb 15 at 12:57
















730
















  • How does one insert a "" (backslash) into the text of a LaTeX document?

  • And how does one insert a "~" (tilde)? (If you insert ~, it will give you a tilde as an accent over the following letter.)


I believe backslash may be used in math formulae, but not into text itself. Lamport's, Kopka's, and Mittelbach's texts have said as much (but no more), and so left me hanging on how to get a backslash into regular text.










share|improve this question















migrated from stackoverflow.com Jan 20 '11 at 17:54


This question came from our site for professional and enthusiast programmers.














  • 1





    For the special case where a backslash or tilde must be written to an auxiliary file or shell escape see: How can I provide a verbatim (unescaped) commandline for executing with write18?

    – Martin Scharrer
    Apr 13 '12 at 10:28








  • 4





    For future reference, this is a great resource for finding out what to do to accomplish a given character.

    – Parthian Shot
    Feb 12 '15 at 21:42













  • For MathJax use simply sim.

    – Kai Noack
    Feb 15 at 12:57














730












730








730


161







  • How does one insert a "" (backslash) into the text of a LaTeX document?

  • And how does one insert a "~" (tilde)? (If you insert ~, it will give you a tilde as an accent over the following letter.)


I believe backslash may be used in math formulae, but not into text itself. Lamport's, Kopka's, and Mittelbach's texts have said as much (but no more), and so left me hanging on how to get a backslash into regular text.










share|improve this question

















  • How does one insert a "" (backslash) into the text of a LaTeX document?

  • And how does one insert a "~" (tilde)? (If you insert ~, it will give you a tilde as an accent over the following letter.)


I believe backslash may be used in math formulae, but not into text itself. Lamport's, Kopka's, and Mittelbach's texts have said as much (but no more), and so left me hanging on how to get a backslash into regular text.







symbols






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 18 '13 at 22:38









Scott H.

8,18222463




8,18222463










asked Nov 2 '08 at 3:06









Brian M. HuntBrian M. Hunt

5,77742237




5,77742237




migrated from stackoverflow.com Jan 20 '11 at 17:54


This question came from our site for professional and enthusiast programmers.









migrated from stackoverflow.com Jan 20 '11 at 17:54


This question came from our site for professional and enthusiast programmers.










  • 1





    For the special case where a backslash or tilde must be written to an auxiliary file or shell escape see: How can I provide a verbatim (unescaped) commandline for executing with write18?

    – Martin Scharrer
    Apr 13 '12 at 10:28








  • 4





    For future reference, this is a great resource for finding out what to do to accomplish a given character.

    – Parthian Shot
    Feb 12 '15 at 21:42













  • For MathJax use simply sim.

    – Kai Noack
    Feb 15 at 12:57














  • 1





    For the special case where a backslash or tilde must be written to an auxiliary file or shell escape see: How can I provide a verbatim (unescaped) commandline for executing with write18?

    – Martin Scharrer
    Apr 13 '12 at 10:28








  • 4





    For future reference, this is a great resource for finding out what to do to accomplish a given character.

    – Parthian Shot
    Feb 12 '15 at 21:42













  • For MathJax use simply sim.

    – Kai Noack
    Feb 15 at 12:57








1




1





For the special case where a backslash or tilde must be written to an auxiliary file or shell escape see: How can I provide a verbatim (unescaped) commandline for executing with write18?

– Martin Scharrer
Apr 13 '12 at 10:28







For the special case where a backslash or tilde must be written to an auxiliary file or shell escape see: How can I provide a verbatim (unescaped) commandline for executing with write18?

– Martin Scharrer
Apr 13 '12 at 10:28






4




4





For future reference, this is a great resource for finding out what to do to accomplish a given character.

– Parthian Shot
Feb 12 '15 at 21:42







For future reference, this is a great resource for finding out what to do to accomplish a given character.

– Parthian Shot
Feb 12 '15 at 21:42















For MathJax use simply sim.

– Kai Noack
Feb 15 at 12:57





For MathJax use simply sim.

– Kai Noack
Feb 15 at 12:57










9 Answers
9






active

oldest

votes


















739














The Comprehensive LaTeX Symbol List is your friend.



textbackslash and textasciitilde are found in Table 2 of the list, and page 101 has some other options for the tilde:



$sim$ and texttildelow from the textcomp package, possibly using some font other than Computer Modern to get a nice vertically centered tilde



It also suggests using the url package if you are typesetting URL's or Unix file names.



In case you use these in a text, do like so: bartextasciitilde{}foo.






share|improve this answer





















  • 27





    This is pretty awesome and helped me a lot. I just want to add that in case you use these in a text, do like so: bartextasciitilde{}foo.

    – Till
    May 14 '11 at 20:53






  • 4





    When Zotero exports a bibtex file, it replaces some tildes with {textasciitilde}. When using biblatex (using the bibtex backend in texlive2007 [don't ask]), this causes an error (Missing $ inserted). The workaround is to use {textasciitilde{}}.

    – naught101
    Jul 18 '12 at 3:38






  • 9





    There's also detexify.

    – beatgammit
    Sep 7 '12 at 3:23






  • 2





    And there is write-math.com. I've just tried it: Tilde and backslash. It works :-) (it's my bachelors thesis - currently still in progress)

    – Martin Thoma
    May 19 '14 at 18:54



















261














Canonical answer



There’s now an extensive discussion with a canonical answer on this website. Use the solution described there. The text below should be considered obsolete.



Old answer, preserved for posteriority



textcomp’s texttildelow is actually quite a bad choice: it’s too low for most fonts.



A much better rendering can be achieved by the following, which tweaks the appearance of the (otherwise too wide) $sim$:



{raise.17exhbox{$scriptstylesim$}}


This was taken from the Arbitrary LateX reference … the page also provides a good comparison sheet:



Different tilde renderings



When used in texttt, I would add a mathtt around the tilde, to make it fit the font better:



{raise.17exhbox{$scriptstylemathtt{sim}$}}


The difference is small but noticeable.






share|improve this answer





















  • 1





    I'm trying to get a backslash in a monospaced font. texttt{textbackslash} is giving me the wrong glyph. Do you have any suggestions?

    – nnyby
    Mar 11 '10 at 4:35








  • 3





    @nnyby: The best solution for that is to use the “raw” glyph, i.e. texttt{char`\}.

    – Konrad Rudolph
    Mar 11 '10 at 9:42








  • 122





    all of this: {raise.17exhbox{$scriptstylesim$}} just to type a proper ~. And LaTeX is supposed to be allow you to focus on contents...

    – Vivi
    Jun 6 '10 at 9:15








  • 34





    @Vivi: The point of (La)TeX is that you can focus on content by defining macros. You never need to (or should!) type the above – except once, in a macro definition. You could even define an active character so that ~ will actually insert a proper tilde. That said, you’re certainly right about this particular instance: not providing a 1:1 mapping to all Unicode characters (heck, not even ASCII) is a major weakness of LaTeX.

    – Konrad Rudolph
    Jun 6 '10 at 9:50






  • 16





    This was a great solution. Thank you. Though I would recommend putting it into its own new command like: newcommand{mytilde}{raise.17exhbox{$scriptstylemathtt{sim}$}} so you can simple write mytilde.

    – Matthew Sowders
    Jul 29 '11 at 3:25





















66














You can also use the "plain TeX" method of indexing the actual ascii character in the current font:



char`\
char`~


I often use the former for writing macros that need the backslash in the typewriter font; textbackslash will sometimes still use the roman font depending on the font setup. Of course, if you're using these a lot you should define your own macro for them:



newcommandSLASH{char`\}





share|improve this answer





















  • 1





    rather newcommand{backslash}{char`\}

    – Svante
    Nov 3 '08 at 0:39








  • 17





    Eh? The macro name can be whatever you like. The braces around it are optional. And backslash is already defined as a math entity.

    – Will Robertson
    Nov 3 '08 at 22:17








  • 2





    This is my preferred solution for backslash, as it suits the font of the surrounding environment (for example, you can use it in texttt).

    – mgiuca
    Sep 30 '11 at 3:21



















58














I occurs to me that you might be trying to type URLs. In that case, the url package takes care of everything for you:



usepackage{url}
...
url{somewherehome~will}


For paths (i.e., local files), there is path, working the same way as url, just providing the correct links in case hyperref is loaded.



If you are loading hyperref there is no reason to load url as well.






share|improve this answer


























  • Thank you Will, I was trying to typeset teletype backslash (thick one) in new command. I've found way how to solve it but using url package is much more elegant.

    – Crowley
    Jun 2 '11 at 11:38













  • Unfortunately the produced output is not clickable anymore, neither in DVI nor PDF. Any way to make it clickable?

    – Dmitri Zaitsev
    Dec 3 '17 at 19:50











  • @DmitriZaitsev — I don't know what you mean by clickable. Are you loading the hyperref package? You don't need to load url separately in that case.

    – Will Robertson
    Dec 4 '17 at 4:35











  • @WillRobertson Thank you for clarifying, I have managed to make it clickable (so that clicking on it opens the page in a browser) by loading the hyperref package instead of the url package but still using url{...} rather than href{...}

    – Dmitri Zaitsev
    Dec 4 '17 at 13:05





















47














Well if that isn't annoying:



 textbackslash
texttt{char`~} or $sim$


Thank for reading. :)



Edit: added code for tilde.






share|improve this answer


























  • BMH or someone else: please edit if you have better answers for the tilde.

    – Federico Ramponi
    Nov 2 '08 at 4:27






  • 2





    Don't use verb, because it will break in fragile arguments. texttt{char`~} would be the better choice. (See my answer elsewhere on this page.)

    – Will Robertson
    Jan 21 '11 at 0:32













  • @Will: Fixed that.

    – Brian M. Hunt
    Jan 21 '11 at 0:47



















15














Hmm; textbackslash (mentioned by others) isn't in my reference book (Kopka and Daly).



At any rate, math mode provides sim, backslash, and setminus (the latter two appear to look the same and differ only by spacing in math mode).



My LaTeX book – which, as you would expect, features the extensively – seems to use the verbatim environment. For example, this code:



begin{verbatim}
addtocounter{footnote}{-1}footnotetext{Small insects}
stepcounter{footnote}footnoteext{Large mammals}
end{verbatim}


Produces this text in the book:



 addtocounter{footnote}{-1}footnotetext{Small insects}
stepcounter{footnote}footnoteext{Large mammals}


The verb command is similar, but the argument must be on one line only. The first character after the b is the delimiter; for example:



verb=emph{stuff}=


will produce



emph{stuff}


So you could presumably get your backslash by typing:



verb==


You can also add a * – i.e. verb* or begin{verbatim*} – to make whitespace visible.



It is interesting to speculate how you would get an example of a verbatim environment into a document..
(using verb to do the last line, I guess)






share|improve this answer





















  • 4





    I guess the problem with using verb is that it breaks inside macro arguments. You can't write section{verb=~=}, for example.

    – Will Robertson
    Nov 3 '08 at 22:20













  • Kopka's LaTeX books are very old. Originally they were written for LaTeX 2.09 and the later editions are only less modified for LaTeX2e. So they are not the best description of LaTeX2e and at least not of packages available for LaTeX2e. textbackslash for example has been described at LaTeX2e for authors by the LaTeX team.

    – Schweinebacke
    Nov 20 '11 at 13:01











  • textbackslash is on page 536 of the fourth edition of Kopka and Daly

    – Phil Molyneux
    Jul 25 '15 at 10:50



















8














For the tilde, you can use empty curly brace pair. That puts the "over the letter" tilde over an "empty" letter, so it's placed upward.



My tilde~{}here





share|improve this answer



















  • 1





    I guess it depends what the OP is intending to do with the tilde. Sometimes a "naked" tilde is a little unobtrusive.

    – Will Robertson
    Nov 3 '08 at 22:19



















5














From https://faculty.math.illinois.edu/~hildebr/tex/bibliographies.html




"... tilde symbol (~), which without
special coding gets interpreted as a
blank space, and therefore needs to be
escaped by a backslash (~) or
replaced by the math "twiddle" symbol
$sim$. Fortunately, there is a
package, url, that provides a
painless way to typeset URL's. To use
this package available, add



usepackage{url}


near the beginning of the document,
and enclose any web and email
addresses in the document in
url{...}:



url{http://www.math.drofnats.edu/~gauss}
url{gauss@math.drofnats.edu}


..."




I hope this could help you in typewriting a regular tilde character.






share|improve this answer

































    4














    Personally, I learned more actually changing the catcodes myself :)



    begingroup
    catcode `~=11
    gdefmytilde{~}
    catcode `|=0
    catcode `\=11
    |gdef|mybs{}
    |endgroup


    and then something like



    This is a tilde: mytilde
    This is a backslash: mybs





    share|improve this answer





















    • 2





      defmybs{char092} does the same for the backslash

      – Herbert
      Aug 29 '12 at 15:03











    • @Herbert: True, but more cryptic ...

      – Jonathan
      Aug 29 '12 at 15:23






    • 1





      ok, then we use string for non cryptic ...

      – Herbert
      Aug 29 '12 at 15:38


















    9 Answers
    9






    active

    oldest

    votes








    9 Answers
    9






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    739














    The Comprehensive LaTeX Symbol List is your friend.



    textbackslash and textasciitilde are found in Table 2 of the list, and page 101 has some other options for the tilde:



    $sim$ and texttildelow from the textcomp package, possibly using some font other than Computer Modern to get a nice vertically centered tilde



    It also suggests using the url package if you are typesetting URL's or Unix file names.



    In case you use these in a text, do like so: bartextasciitilde{}foo.






    share|improve this answer





















    • 27





      This is pretty awesome and helped me a lot. I just want to add that in case you use these in a text, do like so: bartextasciitilde{}foo.

      – Till
      May 14 '11 at 20:53






    • 4





      When Zotero exports a bibtex file, it replaces some tildes with {textasciitilde}. When using biblatex (using the bibtex backend in texlive2007 [don't ask]), this causes an error (Missing $ inserted). The workaround is to use {textasciitilde{}}.

      – naught101
      Jul 18 '12 at 3:38






    • 9





      There's also detexify.

      – beatgammit
      Sep 7 '12 at 3:23






    • 2





      And there is write-math.com. I've just tried it: Tilde and backslash. It works :-) (it's my bachelors thesis - currently still in progress)

      – Martin Thoma
      May 19 '14 at 18:54
















    739














    The Comprehensive LaTeX Symbol List is your friend.



    textbackslash and textasciitilde are found in Table 2 of the list, and page 101 has some other options for the tilde:



    $sim$ and texttildelow from the textcomp package, possibly using some font other than Computer Modern to get a nice vertically centered tilde



    It also suggests using the url package if you are typesetting URL's or Unix file names.



    In case you use these in a text, do like so: bartextasciitilde{}foo.






    share|improve this answer





















    • 27





      This is pretty awesome and helped me a lot. I just want to add that in case you use these in a text, do like so: bartextasciitilde{}foo.

      – Till
      May 14 '11 at 20:53






    • 4





      When Zotero exports a bibtex file, it replaces some tildes with {textasciitilde}. When using biblatex (using the bibtex backend in texlive2007 [don't ask]), this causes an error (Missing $ inserted). The workaround is to use {textasciitilde{}}.

      – naught101
      Jul 18 '12 at 3:38






    • 9





      There's also detexify.

      – beatgammit
      Sep 7 '12 at 3:23






    • 2





      And there is write-math.com. I've just tried it: Tilde and backslash. It works :-) (it's my bachelors thesis - currently still in progress)

      – Martin Thoma
      May 19 '14 at 18:54














    739












    739








    739







    The Comprehensive LaTeX Symbol List is your friend.



    textbackslash and textasciitilde are found in Table 2 of the list, and page 101 has some other options for the tilde:



    $sim$ and texttildelow from the textcomp package, possibly using some font other than Computer Modern to get a nice vertically centered tilde



    It also suggests using the url package if you are typesetting URL's or Unix file names.



    In case you use these in a text, do like so: bartextasciitilde{}foo.






    share|improve this answer















    The Comprehensive LaTeX Symbol List is your friend.



    textbackslash and textasciitilde are found in Table 2 of the list, and page 101 has some other options for the tilde:



    $sim$ and texttildelow from the textcomp package, possibly using some font other than Computer Modern to get a nice vertically centered tilde



    It also suggests using the url package if you are typesetting URL's or Unix file names.



    In case you use these in a text, do like so: bartextasciitilde{}foo.







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited 8 mins ago









    samcarter

    91.4k7104296




    91.4k7104296










    answered Nov 2 '08 at 7:15









    Jouni K. SeppänenJouni K. Seppänen

    8,37511310




    8,37511310








    • 27





      This is pretty awesome and helped me a lot. I just want to add that in case you use these in a text, do like so: bartextasciitilde{}foo.

      – Till
      May 14 '11 at 20:53






    • 4





      When Zotero exports a bibtex file, it replaces some tildes with {textasciitilde}. When using biblatex (using the bibtex backend in texlive2007 [don't ask]), this causes an error (Missing $ inserted). The workaround is to use {textasciitilde{}}.

      – naught101
      Jul 18 '12 at 3:38






    • 9





      There's also detexify.

      – beatgammit
      Sep 7 '12 at 3:23






    • 2





      And there is write-math.com. I've just tried it: Tilde and backslash. It works :-) (it's my bachelors thesis - currently still in progress)

      – Martin Thoma
      May 19 '14 at 18:54














    • 27





      This is pretty awesome and helped me a lot. I just want to add that in case you use these in a text, do like so: bartextasciitilde{}foo.

      – Till
      May 14 '11 at 20:53






    • 4





      When Zotero exports a bibtex file, it replaces some tildes with {textasciitilde}. When using biblatex (using the bibtex backend in texlive2007 [don't ask]), this causes an error (Missing $ inserted). The workaround is to use {textasciitilde{}}.

      – naught101
      Jul 18 '12 at 3:38






    • 9





      There's also detexify.

      – beatgammit
      Sep 7 '12 at 3:23






    • 2





      And there is write-math.com. I've just tried it: Tilde and backslash. It works :-) (it's my bachelors thesis - currently still in progress)

      – Martin Thoma
      May 19 '14 at 18:54








    27




    27





    This is pretty awesome and helped me a lot. I just want to add that in case you use these in a text, do like so: bartextasciitilde{}foo.

    – Till
    May 14 '11 at 20:53





    This is pretty awesome and helped me a lot. I just want to add that in case you use these in a text, do like so: bartextasciitilde{}foo.

    – Till
    May 14 '11 at 20:53




    4




    4





    When Zotero exports a bibtex file, it replaces some tildes with {textasciitilde}. When using biblatex (using the bibtex backend in texlive2007 [don't ask]), this causes an error (Missing $ inserted). The workaround is to use {textasciitilde{}}.

    – naught101
    Jul 18 '12 at 3:38





    When Zotero exports a bibtex file, it replaces some tildes with {textasciitilde}. When using biblatex (using the bibtex backend in texlive2007 [don't ask]), this causes an error (Missing $ inserted). The workaround is to use {textasciitilde{}}.

    – naught101
    Jul 18 '12 at 3:38




    9




    9





    There's also detexify.

    – beatgammit
    Sep 7 '12 at 3:23





    There's also detexify.

    – beatgammit
    Sep 7 '12 at 3:23




    2




    2





    And there is write-math.com. I've just tried it: Tilde and backslash. It works :-) (it's my bachelors thesis - currently still in progress)

    – Martin Thoma
    May 19 '14 at 18:54





    And there is write-math.com. I've just tried it: Tilde and backslash. It works :-) (it's my bachelors thesis - currently still in progress)

    – Martin Thoma
    May 19 '14 at 18:54











    261














    Canonical answer



    There’s now an extensive discussion with a canonical answer on this website. Use the solution described there. The text below should be considered obsolete.



    Old answer, preserved for posteriority



    textcomp’s texttildelow is actually quite a bad choice: it’s too low for most fonts.



    A much better rendering can be achieved by the following, which tweaks the appearance of the (otherwise too wide) $sim$:



    {raise.17exhbox{$scriptstylesim$}}


    This was taken from the Arbitrary LateX reference … the page also provides a good comparison sheet:



    Different tilde renderings



    When used in texttt, I would add a mathtt around the tilde, to make it fit the font better:



    {raise.17exhbox{$scriptstylemathtt{sim}$}}


    The difference is small but noticeable.






    share|improve this answer





















    • 1





      I'm trying to get a backslash in a monospaced font. texttt{textbackslash} is giving me the wrong glyph. Do you have any suggestions?

      – nnyby
      Mar 11 '10 at 4:35








    • 3





      @nnyby: The best solution for that is to use the “raw” glyph, i.e. texttt{char`\}.

      – Konrad Rudolph
      Mar 11 '10 at 9:42








    • 122





      all of this: {raise.17exhbox{$scriptstylesim$}} just to type a proper ~. And LaTeX is supposed to be allow you to focus on contents...

      – Vivi
      Jun 6 '10 at 9:15








    • 34





      @Vivi: The point of (La)TeX is that you can focus on content by defining macros. You never need to (or should!) type the above – except once, in a macro definition. You could even define an active character so that ~ will actually insert a proper tilde. That said, you’re certainly right about this particular instance: not providing a 1:1 mapping to all Unicode characters (heck, not even ASCII) is a major weakness of LaTeX.

      – Konrad Rudolph
      Jun 6 '10 at 9:50






    • 16





      This was a great solution. Thank you. Though I would recommend putting it into its own new command like: newcommand{mytilde}{raise.17exhbox{$scriptstylemathtt{sim}$}} so you can simple write mytilde.

      – Matthew Sowders
      Jul 29 '11 at 3:25


















    261














    Canonical answer



    There’s now an extensive discussion with a canonical answer on this website. Use the solution described there. The text below should be considered obsolete.



    Old answer, preserved for posteriority



    textcomp’s texttildelow is actually quite a bad choice: it’s too low for most fonts.



    A much better rendering can be achieved by the following, which tweaks the appearance of the (otherwise too wide) $sim$:



    {raise.17exhbox{$scriptstylesim$}}


    This was taken from the Arbitrary LateX reference … the page also provides a good comparison sheet:



    Different tilde renderings



    When used in texttt, I would add a mathtt around the tilde, to make it fit the font better:



    {raise.17exhbox{$scriptstylemathtt{sim}$}}


    The difference is small but noticeable.






    share|improve this answer





















    • 1





      I'm trying to get a backslash in a monospaced font. texttt{textbackslash} is giving me the wrong glyph. Do you have any suggestions?

      – nnyby
      Mar 11 '10 at 4:35








    • 3





      @nnyby: The best solution for that is to use the “raw” glyph, i.e. texttt{char`\}.

      – Konrad Rudolph
      Mar 11 '10 at 9:42








    • 122





      all of this: {raise.17exhbox{$scriptstylesim$}} just to type a proper ~. And LaTeX is supposed to be allow you to focus on contents...

      – Vivi
      Jun 6 '10 at 9:15








    • 34





      @Vivi: The point of (La)TeX is that you can focus on content by defining macros. You never need to (or should!) type the above – except once, in a macro definition. You could even define an active character so that ~ will actually insert a proper tilde. That said, you’re certainly right about this particular instance: not providing a 1:1 mapping to all Unicode characters (heck, not even ASCII) is a major weakness of LaTeX.

      – Konrad Rudolph
      Jun 6 '10 at 9:50






    • 16





      This was a great solution. Thank you. Though I would recommend putting it into its own new command like: newcommand{mytilde}{raise.17exhbox{$scriptstylemathtt{sim}$}} so you can simple write mytilde.

      – Matthew Sowders
      Jul 29 '11 at 3:25
















    261












    261








    261







    Canonical answer



    There’s now an extensive discussion with a canonical answer on this website. Use the solution described there. The text below should be considered obsolete.



    Old answer, preserved for posteriority



    textcomp’s texttildelow is actually quite a bad choice: it’s too low for most fonts.



    A much better rendering can be achieved by the following, which tweaks the appearance of the (otherwise too wide) $sim$:



    {raise.17exhbox{$scriptstylesim$}}


    This was taken from the Arbitrary LateX reference … the page also provides a good comparison sheet:



    Different tilde renderings



    When used in texttt, I would add a mathtt around the tilde, to make it fit the font better:



    {raise.17exhbox{$scriptstylemathtt{sim}$}}


    The difference is small but noticeable.






    share|improve this answer















    Canonical answer



    There’s now an extensive discussion with a canonical answer on this website. Use the solution described there. The text below should be considered obsolete.



    Old answer, preserved for posteriority



    textcomp’s texttildelow is actually quite a bad choice: it’s too low for most fonts.



    A much better rendering can be achieved by the following, which tweaks the appearance of the (otherwise too wide) $sim$:



    {raise.17exhbox{$scriptstylesim$}}


    This was taken from the Arbitrary LateX reference … the page also provides a good comparison sheet:



    Different tilde renderings



    When used in texttt, I would add a mathtt around the tilde, to make it fit the font better:



    {raise.17exhbox{$scriptstylemathtt{sim}$}}


    The difference is small but noticeable.







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Apr 13 '17 at 12:35









    Community

    1




    1










    answered Jan 10 '10 at 14:47









    Konrad RudolphKonrad Rudolph

    26.9k1786140




    26.9k1786140








    • 1





      I'm trying to get a backslash in a monospaced font. texttt{textbackslash} is giving me the wrong glyph. Do you have any suggestions?

      – nnyby
      Mar 11 '10 at 4:35








    • 3





      @nnyby: The best solution for that is to use the “raw” glyph, i.e. texttt{char`\}.

      – Konrad Rudolph
      Mar 11 '10 at 9:42








    • 122





      all of this: {raise.17exhbox{$scriptstylesim$}} just to type a proper ~. And LaTeX is supposed to be allow you to focus on contents...

      – Vivi
      Jun 6 '10 at 9:15








    • 34





      @Vivi: The point of (La)TeX is that you can focus on content by defining macros. You never need to (or should!) type the above – except once, in a macro definition. You could even define an active character so that ~ will actually insert a proper tilde. That said, you’re certainly right about this particular instance: not providing a 1:1 mapping to all Unicode characters (heck, not even ASCII) is a major weakness of LaTeX.

      – Konrad Rudolph
      Jun 6 '10 at 9:50






    • 16





      This was a great solution. Thank you. Though I would recommend putting it into its own new command like: newcommand{mytilde}{raise.17exhbox{$scriptstylemathtt{sim}$}} so you can simple write mytilde.

      – Matthew Sowders
      Jul 29 '11 at 3:25
















    • 1





      I'm trying to get a backslash in a monospaced font. texttt{textbackslash} is giving me the wrong glyph. Do you have any suggestions?

      – nnyby
      Mar 11 '10 at 4:35








    • 3





      @nnyby: The best solution for that is to use the “raw” glyph, i.e. texttt{char`\}.

      – Konrad Rudolph
      Mar 11 '10 at 9:42








    • 122





      all of this: {raise.17exhbox{$scriptstylesim$}} just to type a proper ~. And LaTeX is supposed to be allow you to focus on contents...

      – Vivi
      Jun 6 '10 at 9:15








    • 34





      @Vivi: The point of (La)TeX is that you can focus on content by defining macros. You never need to (or should!) type the above – except once, in a macro definition. You could even define an active character so that ~ will actually insert a proper tilde. That said, you’re certainly right about this particular instance: not providing a 1:1 mapping to all Unicode characters (heck, not even ASCII) is a major weakness of LaTeX.

      – Konrad Rudolph
      Jun 6 '10 at 9:50






    • 16





      This was a great solution. Thank you. Though I would recommend putting it into its own new command like: newcommand{mytilde}{raise.17exhbox{$scriptstylemathtt{sim}$}} so you can simple write mytilde.

      – Matthew Sowders
      Jul 29 '11 at 3:25










    1




    1





    I'm trying to get a backslash in a monospaced font. texttt{textbackslash} is giving me the wrong glyph. Do you have any suggestions?

    – nnyby
    Mar 11 '10 at 4:35







    I'm trying to get a backslash in a monospaced font. texttt{textbackslash} is giving me the wrong glyph. Do you have any suggestions?

    – nnyby
    Mar 11 '10 at 4:35






    3




    3





    @nnyby: The best solution for that is to use the “raw” glyph, i.e. texttt{char`\}.

    – Konrad Rudolph
    Mar 11 '10 at 9:42







    @nnyby: The best solution for that is to use the “raw” glyph, i.e. texttt{char`\}.

    – Konrad Rudolph
    Mar 11 '10 at 9:42






    122




    122





    all of this: {raise.17exhbox{$scriptstylesim$}} just to type a proper ~. And LaTeX is supposed to be allow you to focus on contents...

    – Vivi
    Jun 6 '10 at 9:15







    all of this: {raise.17exhbox{$scriptstylesim$}} just to type a proper ~. And LaTeX is supposed to be allow you to focus on contents...

    – Vivi
    Jun 6 '10 at 9:15






    34




    34





    @Vivi: The point of (La)TeX is that you can focus on content by defining macros. You never need to (or should!) type the above – except once, in a macro definition. You could even define an active character so that ~ will actually insert a proper tilde. That said, you’re certainly right about this particular instance: not providing a 1:1 mapping to all Unicode characters (heck, not even ASCII) is a major weakness of LaTeX.

    – Konrad Rudolph
    Jun 6 '10 at 9:50





    @Vivi: The point of (La)TeX is that you can focus on content by defining macros. You never need to (or should!) type the above – except once, in a macro definition. You could even define an active character so that ~ will actually insert a proper tilde. That said, you’re certainly right about this particular instance: not providing a 1:1 mapping to all Unicode characters (heck, not even ASCII) is a major weakness of LaTeX.

    – Konrad Rudolph
    Jun 6 '10 at 9:50




    16




    16





    This was a great solution. Thank you. Though I would recommend putting it into its own new command like: newcommand{mytilde}{raise.17exhbox{$scriptstylemathtt{sim}$}} so you can simple write mytilde.

    – Matthew Sowders
    Jul 29 '11 at 3:25







    This was a great solution. Thank you. Though I would recommend putting it into its own new command like: newcommand{mytilde}{raise.17exhbox{$scriptstylemathtt{sim}$}} so you can simple write mytilde.

    – Matthew Sowders
    Jul 29 '11 at 3:25













    66














    You can also use the "plain TeX" method of indexing the actual ascii character in the current font:



    char`\
    char`~


    I often use the former for writing macros that need the backslash in the typewriter font; textbackslash will sometimes still use the roman font depending on the font setup. Of course, if you're using these a lot you should define your own macro for them:



    newcommandSLASH{char`\}





    share|improve this answer





















    • 1





      rather newcommand{backslash}{char`\}

      – Svante
      Nov 3 '08 at 0:39








    • 17





      Eh? The macro name can be whatever you like. The braces around it are optional. And backslash is already defined as a math entity.

      – Will Robertson
      Nov 3 '08 at 22:17








    • 2





      This is my preferred solution for backslash, as it suits the font of the surrounding environment (for example, you can use it in texttt).

      – mgiuca
      Sep 30 '11 at 3:21
















    66














    You can also use the "plain TeX" method of indexing the actual ascii character in the current font:



    char`\
    char`~


    I often use the former for writing macros that need the backslash in the typewriter font; textbackslash will sometimes still use the roman font depending on the font setup. Of course, if you're using these a lot you should define your own macro for them:



    newcommandSLASH{char`\}





    share|improve this answer





















    • 1





      rather newcommand{backslash}{char`\}

      – Svante
      Nov 3 '08 at 0:39








    • 17





      Eh? The macro name can be whatever you like. The braces around it are optional. And backslash is already defined as a math entity.

      – Will Robertson
      Nov 3 '08 at 22:17








    • 2





      This is my preferred solution for backslash, as it suits the font of the surrounding environment (for example, you can use it in texttt).

      – mgiuca
      Sep 30 '11 at 3:21














    66












    66








    66







    You can also use the "plain TeX" method of indexing the actual ascii character in the current font:



    char`\
    char`~


    I often use the former for writing macros that need the backslash in the typewriter font; textbackslash will sometimes still use the roman font depending on the font setup. Of course, if you're using these a lot you should define your own macro for them:



    newcommandSLASH{char`\}





    share|improve this answer















    You can also use the "plain TeX" method of indexing the actual ascii character in the current font:



    char`\
    char`~


    I often use the former for writing macros that need the backslash in the typewriter font; textbackslash will sometimes still use the roman font depending on the font setup. Of course, if you're using these a lot you should define your own macro for them:



    newcommandSLASH{char`\}






    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Jul 14 '17 at 13:42









    samcarter

    91.4k7104296




    91.4k7104296










    answered Nov 3 '08 at 0:14









    Will RobertsonWill Robertson

    58.9k13157202




    58.9k13157202








    • 1





      rather newcommand{backslash}{char`\}

      – Svante
      Nov 3 '08 at 0:39








    • 17





      Eh? The macro name can be whatever you like. The braces around it are optional. And backslash is already defined as a math entity.

      – Will Robertson
      Nov 3 '08 at 22:17








    • 2





      This is my preferred solution for backslash, as it suits the font of the surrounding environment (for example, you can use it in texttt).

      – mgiuca
      Sep 30 '11 at 3:21














    • 1





      rather newcommand{backslash}{char`\}

      – Svante
      Nov 3 '08 at 0:39








    • 17





      Eh? The macro name can be whatever you like. The braces around it are optional. And backslash is already defined as a math entity.

      – Will Robertson
      Nov 3 '08 at 22:17








    • 2





      This is my preferred solution for backslash, as it suits the font of the surrounding environment (for example, you can use it in texttt).

      – mgiuca
      Sep 30 '11 at 3:21








    1




    1





    rather newcommand{backslash}{char`\}

    – Svante
    Nov 3 '08 at 0:39







    rather newcommand{backslash}{char`\}

    – Svante
    Nov 3 '08 at 0:39






    17




    17





    Eh? The macro name can be whatever you like. The braces around it are optional. And backslash is already defined as a math entity.

    – Will Robertson
    Nov 3 '08 at 22:17







    Eh? The macro name can be whatever you like. The braces around it are optional. And backslash is already defined as a math entity.

    – Will Robertson
    Nov 3 '08 at 22:17






    2




    2





    This is my preferred solution for backslash, as it suits the font of the surrounding environment (for example, you can use it in texttt).

    – mgiuca
    Sep 30 '11 at 3:21





    This is my preferred solution for backslash, as it suits the font of the surrounding environment (for example, you can use it in texttt).

    – mgiuca
    Sep 30 '11 at 3:21











    58














    I occurs to me that you might be trying to type URLs. In that case, the url package takes care of everything for you:



    usepackage{url}
    ...
    url{somewherehome~will}


    For paths (i.e., local files), there is path, working the same way as url, just providing the correct links in case hyperref is loaded.



    If you are loading hyperref there is no reason to load url as well.






    share|improve this answer


























    • Thank you Will, I was trying to typeset teletype backslash (thick one) in new command. I've found way how to solve it but using url package is much more elegant.

      – Crowley
      Jun 2 '11 at 11:38













    • Unfortunately the produced output is not clickable anymore, neither in DVI nor PDF. Any way to make it clickable?

      – Dmitri Zaitsev
      Dec 3 '17 at 19:50











    • @DmitriZaitsev — I don't know what you mean by clickable. Are you loading the hyperref package? You don't need to load url separately in that case.

      – Will Robertson
      Dec 4 '17 at 4:35











    • @WillRobertson Thank you for clarifying, I have managed to make it clickable (so that clicking on it opens the page in a browser) by loading the hyperref package instead of the url package but still using url{...} rather than href{...}

      – Dmitri Zaitsev
      Dec 4 '17 at 13:05


















    58














    I occurs to me that you might be trying to type URLs. In that case, the url package takes care of everything for you:



    usepackage{url}
    ...
    url{somewherehome~will}


    For paths (i.e., local files), there is path, working the same way as url, just providing the correct links in case hyperref is loaded.



    If you are loading hyperref there is no reason to load url as well.






    share|improve this answer


























    • Thank you Will, I was trying to typeset teletype backslash (thick one) in new command. I've found way how to solve it but using url package is much more elegant.

      – Crowley
      Jun 2 '11 at 11:38













    • Unfortunately the produced output is not clickable anymore, neither in DVI nor PDF. Any way to make it clickable?

      – Dmitri Zaitsev
      Dec 3 '17 at 19:50











    • @DmitriZaitsev — I don't know what you mean by clickable. Are you loading the hyperref package? You don't need to load url separately in that case.

      – Will Robertson
      Dec 4 '17 at 4:35











    • @WillRobertson Thank you for clarifying, I have managed to make it clickable (so that clicking on it opens the page in a browser) by loading the hyperref package instead of the url package but still using url{...} rather than href{...}

      – Dmitri Zaitsev
      Dec 4 '17 at 13:05
















    58












    58








    58







    I occurs to me that you might be trying to type URLs. In that case, the url package takes care of everything for you:



    usepackage{url}
    ...
    url{somewherehome~will}


    For paths (i.e., local files), there is path, working the same way as url, just providing the correct links in case hyperref is loaded.



    If you are loading hyperref there is no reason to load url as well.






    share|improve this answer















    I occurs to me that you might be trying to type URLs. In that case, the url package takes care of everything for you:



    usepackage{url}
    ...
    url{somewherehome~will}


    For paths (i.e., local files), there is path, working the same way as url, just providing the correct links in case hyperref is loaded.



    If you are loading hyperref there is no reason to load url as well.







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Dec 4 '17 at 4:35

























    answered Nov 3 '08 at 22:23









    Will RobertsonWill Robertson

    58.9k13157202




    58.9k13157202













    • Thank you Will, I was trying to typeset teletype backslash (thick one) in new command. I've found way how to solve it but using url package is much more elegant.

      – Crowley
      Jun 2 '11 at 11:38













    • Unfortunately the produced output is not clickable anymore, neither in DVI nor PDF. Any way to make it clickable?

      – Dmitri Zaitsev
      Dec 3 '17 at 19:50











    • @DmitriZaitsev — I don't know what you mean by clickable. Are you loading the hyperref package? You don't need to load url separately in that case.

      – Will Robertson
      Dec 4 '17 at 4:35











    • @WillRobertson Thank you for clarifying, I have managed to make it clickable (so that clicking on it opens the page in a browser) by loading the hyperref package instead of the url package but still using url{...} rather than href{...}

      – Dmitri Zaitsev
      Dec 4 '17 at 13:05





















    • Thank you Will, I was trying to typeset teletype backslash (thick one) in new command. I've found way how to solve it but using url package is much more elegant.

      – Crowley
      Jun 2 '11 at 11:38













    • Unfortunately the produced output is not clickable anymore, neither in DVI nor PDF. Any way to make it clickable?

      – Dmitri Zaitsev
      Dec 3 '17 at 19:50











    • @DmitriZaitsev — I don't know what you mean by clickable. Are you loading the hyperref package? You don't need to load url separately in that case.

      – Will Robertson
      Dec 4 '17 at 4:35











    • @WillRobertson Thank you for clarifying, I have managed to make it clickable (so that clicking on it opens the page in a browser) by loading the hyperref package instead of the url package but still using url{...} rather than href{...}

      – Dmitri Zaitsev
      Dec 4 '17 at 13:05



















    Thank you Will, I was trying to typeset teletype backslash (thick one) in new command. I've found way how to solve it but using url package is much more elegant.

    – Crowley
    Jun 2 '11 at 11:38







    Thank you Will, I was trying to typeset teletype backslash (thick one) in new command. I've found way how to solve it but using url package is much more elegant.

    – Crowley
    Jun 2 '11 at 11:38















    Unfortunately the produced output is not clickable anymore, neither in DVI nor PDF. Any way to make it clickable?

    – Dmitri Zaitsev
    Dec 3 '17 at 19:50





    Unfortunately the produced output is not clickable anymore, neither in DVI nor PDF. Any way to make it clickable?

    – Dmitri Zaitsev
    Dec 3 '17 at 19:50













    @DmitriZaitsev — I don't know what you mean by clickable. Are you loading the hyperref package? You don't need to load url separately in that case.

    – Will Robertson
    Dec 4 '17 at 4:35





    @DmitriZaitsev — I don't know what you mean by clickable. Are you loading the hyperref package? You don't need to load url separately in that case.

    – Will Robertson
    Dec 4 '17 at 4:35













    @WillRobertson Thank you for clarifying, I have managed to make it clickable (so that clicking on it opens the page in a browser) by loading the hyperref package instead of the url package but still using url{...} rather than href{...}

    – Dmitri Zaitsev
    Dec 4 '17 at 13:05







    @WillRobertson Thank you for clarifying, I have managed to make it clickable (so that clicking on it opens the page in a browser) by loading the hyperref package instead of the url package but still using url{...} rather than href{...}

    – Dmitri Zaitsev
    Dec 4 '17 at 13:05













    47














    Well if that isn't annoying:



     textbackslash
    texttt{char`~} or $sim$


    Thank for reading. :)



    Edit: added code for tilde.






    share|improve this answer


























    • BMH or someone else: please edit if you have better answers for the tilde.

      – Federico Ramponi
      Nov 2 '08 at 4:27






    • 2





      Don't use verb, because it will break in fragile arguments. texttt{char`~} would be the better choice. (See my answer elsewhere on this page.)

      – Will Robertson
      Jan 21 '11 at 0:32













    • @Will: Fixed that.

      – Brian M. Hunt
      Jan 21 '11 at 0:47
















    47














    Well if that isn't annoying:



     textbackslash
    texttt{char`~} or $sim$


    Thank for reading. :)



    Edit: added code for tilde.






    share|improve this answer


























    • BMH or someone else: please edit if you have better answers for the tilde.

      – Federico Ramponi
      Nov 2 '08 at 4:27






    • 2





      Don't use verb, because it will break in fragile arguments. texttt{char`~} would be the better choice. (See my answer elsewhere on this page.)

      – Will Robertson
      Jan 21 '11 at 0:32













    • @Will: Fixed that.

      – Brian M. Hunt
      Jan 21 '11 at 0:47














    47












    47








    47







    Well if that isn't annoying:



     textbackslash
    texttt{char`~} or $sim$


    Thank for reading. :)



    Edit: added code for tilde.






    share|improve this answer















    Well if that isn't annoying:



     textbackslash
    texttt{char`~} or $sim$


    Thank for reading. :)



    Edit: added code for tilde.







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Jan 21 '11 at 0:46

























    answered Nov 2 '08 at 3:11









    Brian M. HuntBrian M. Hunt

    5,77742237




    5,77742237













    • BMH or someone else: please edit if you have better answers for the tilde.

      – Federico Ramponi
      Nov 2 '08 at 4:27






    • 2





      Don't use verb, because it will break in fragile arguments. texttt{char`~} would be the better choice. (See my answer elsewhere on this page.)

      – Will Robertson
      Jan 21 '11 at 0:32













    • @Will: Fixed that.

      – Brian M. Hunt
      Jan 21 '11 at 0:47



















    • BMH or someone else: please edit if you have better answers for the tilde.

      – Federico Ramponi
      Nov 2 '08 at 4:27






    • 2





      Don't use verb, because it will break in fragile arguments. texttt{char`~} would be the better choice. (See my answer elsewhere on this page.)

      – Will Robertson
      Jan 21 '11 at 0:32













    • @Will: Fixed that.

      – Brian M. Hunt
      Jan 21 '11 at 0:47

















    BMH or someone else: please edit if you have better answers for the tilde.

    – Federico Ramponi
    Nov 2 '08 at 4:27





    BMH or someone else: please edit if you have better answers for the tilde.

    – Federico Ramponi
    Nov 2 '08 at 4:27




    2




    2





    Don't use verb, because it will break in fragile arguments. texttt{char`~} would be the better choice. (See my answer elsewhere on this page.)

    – Will Robertson
    Jan 21 '11 at 0:32







    Don't use verb, because it will break in fragile arguments. texttt{char`~} would be the better choice. (See my answer elsewhere on this page.)

    – Will Robertson
    Jan 21 '11 at 0:32















    @Will: Fixed that.

    – Brian M. Hunt
    Jan 21 '11 at 0:47





    @Will: Fixed that.

    – Brian M. Hunt
    Jan 21 '11 at 0:47











    15














    Hmm; textbackslash (mentioned by others) isn't in my reference book (Kopka and Daly).



    At any rate, math mode provides sim, backslash, and setminus (the latter two appear to look the same and differ only by spacing in math mode).



    My LaTeX book – which, as you would expect, features the extensively – seems to use the verbatim environment. For example, this code:



    begin{verbatim}
    addtocounter{footnote}{-1}footnotetext{Small insects}
    stepcounter{footnote}footnoteext{Large mammals}
    end{verbatim}


    Produces this text in the book:



     addtocounter{footnote}{-1}footnotetext{Small insects}
    stepcounter{footnote}footnoteext{Large mammals}


    The verb command is similar, but the argument must be on one line only. The first character after the b is the delimiter; for example:



    verb=emph{stuff}=


    will produce



    emph{stuff}


    So you could presumably get your backslash by typing:



    verb==


    You can also add a * – i.e. verb* or begin{verbatim*} – to make whitespace visible.



    It is interesting to speculate how you would get an example of a verbatim environment into a document..
    (using verb to do the last line, I guess)






    share|improve this answer





















    • 4





      I guess the problem with using verb is that it breaks inside macro arguments. You can't write section{verb=~=}, for example.

      – Will Robertson
      Nov 3 '08 at 22:20













    • Kopka's LaTeX books are very old. Originally they were written for LaTeX 2.09 and the later editions are only less modified for LaTeX2e. So they are not the best description of LaTeX2e and at least not of packages available for LaTeX2e. textbackslash for example has been described at LaTeX2e for authors by the LaTeX team.

      – Schweinebacke
      Nov 20 '11 at 13:01











    • textbackslash is on page 536 of the fourth edition of Kopka and Daly

      – Phil Molyneux
      Jul 25 '15 at 10:50
















    15














    Hmm; textbackslash (mentioned by others) isn't in my reference book (Kopka and Daly).



    At any rate, math mode provides sim, backslash, and setminus (the latter two appear to look the same and differ only by spacing in math mode).



    My LaTeX book – which, as you would expect, features the extensively – seems to use the verbatim environment. For example, this code:



    begin{verbatim}
    addtocounter{footnote}{-1}footnotetext{Small insects}
    stepcounter{footnote}footnoteext{Large mammals}
    end{verbatim}


    Produces this text in the book:



     addtocounter{footnote}{-1}footnotetext{Small insects}
    stepcounter{footnote}footnoteext{Large mammals}


    The verb command is similar, but the argument must be on one line only. The first character after the b is the delimiter; for example:



    verb=emph{stuff}=


    will produce



    emph{stuff}


    So you could presumably get your backslash by typing:



    verb==


    You can also add a * – i.e. verb* or begin{verbatim*} – to make whitespace visible.



    It is interesting to speculate how you would get an example of a verbatim environment into a document..
    (using verb to do the last line, I guess)






    share|improve this answer





















    • 4





      I guess the problem with using verb is that it breaks inside macro arguments. You can't write section{verb=~=}, for example.

      – Will Robertson
      Nov 3 '08 at 22:20













    • Kopka's LaTeX books are very old. Originally they were written for LaTeX 2.09 and the later editions are only less modified for LaTeX2e. So they are not the best description of LaTeX2e and at least not of packages available for LaTeX2e. textbackslash for example has been described at LaTeX2e for authors by the LaTeX team.

      – Schweinebacke
      Nov 20 '11 at 13:01











    • textbackslash is on page 536 of the fourth edition of Kopka and Daly

      – Phil Molyneux
      Jul 25 '15 at 10:50














    15












    15








    15







    Hmm; textbackslash (mentioned by others) isn't in my reference book (Kopka and Daly).



    At any rate, math mode provides sim, backslash, and setminus (the latter two appear to look the same and differ only by spacing in math mode).



    My LaTeX book – which, as you would expect, features the extensively – seems to use the verbatim environment. For example, this code:



    begin{verbatim}
    addtocounter{footnote}{-1}footnotetext{Small insects}
    stepcounter{footnote}footnoteext{Large mammals}
    end{verbatim}


    Produces this text in the book:



     addtocounter{footnote}{-1}footnotetext{Small insects}
    stepcounter{footnote}footnoteext{Large mammals}


    The verb command is similar, but the argument must be on one line only. The first character after the b is the delimiter; for example:



    verb=emph{stuff}=


    will produce



    emph{stuff}


    So you could presumably get your backslash by typing:



    verb==


    You can also add a * – i.e. verb* or begin{verbatim*} – to make whitespace visible.



    It is interesting to speculate how you would get an example of a verbatim environment into a document..
    (using verb to do the last line, I guess)






    share|improve this answer















    Hmm; textbackslash (mentioned by others) isn't in my reference book (Kopka and Daly).



    At any rate, math mode provides sim, backslash, and setminus (the latter two appear to look the same and differ only by spacing in math mode).



    My LaTeX book – which, as you would expect, features the extensively – seems to use the verbatim environment. For example, this code:



    begin{verbatim}
    addtocounter{footnote}{-1}footnotetext{Small insects}
    stepcounter{footnote}footnoteext{Large mammals}
    end{verbatim}


    Produces this text in the book:



     addtocounter{footnote}{-1}footnotetext{Small insects}
    stepcounter{footnote}footnoteext{Large mammals}


    The verb command is similar, but the argument must be on one line only. The first character after the b is the delimiter; for example:



    verb=emph{stuff}=


    will produce



    emph{stuff}


    So you could presumably get your backslash by typing:



    verb==


    You can also add a * – i.e. verb* or begin{verbatim*} – to make whitespace visible.



    It is interesting to speculate how you would get an example of a verbatim environment into a document..
    (using verb to do the last line, I guess)







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Apr 5 '12 at 12:52









    yo'

    39.6k8124232




    39.6k8124232










    answered Nov 3 '08 at 2:25







    John Fouhy















    • 4





      I guess the problem with using verb is that it breaks inside macro arguments. You can't write section{verb=~=}, for example.

      – Will Robertson
      Nov 3 '08 at 22:20













    • Kopka's LaTeX books are very old. Originally they were written for LaTeX 2.09 and the later editions are only less modified for LaTeX2e. So they are not the best description of LaTeX2e and at least not of packages available for LaTeX2e. textbackslash for example has been described at LaTeX2e for authors by the LaTeX team.

      – Schweinebacke
      Nov 20 '11 at 13:01











    • textbackslash is on page 536 of the fourth edition of Kopka and Daly

      – Phil Molyneux
      Jul 25 '15 at 10:50














    • 4





      I guess the problem with using verb is that it breaks inside macro arguments. You can't write section{verb=~=}, for example.

      – Will Robertson
      Nov 3 '08 at 22:20













    • Kopka's LaTeX books are very old. Originally they were written for LaTeX 2.09 and the later editions are only less modified for LaTeX2e. So they are not the best description of LaTeX2e and at least not of packages available for LaTeX2e. textbackslash for example has been described at LaTeX2e for authors by the LaTeX team.

      – Schweinebacke
      Nov 20 '11 at 13:01











    • textbackslash is on page 536 of the fourth edition of Kopka and Daly

      – Phil Molyneux
      Jul 25 '15 at 10:50








    4




    4





    I guess the problem with using verb is that it breaks inside macro arguments. You can't write section{verb=~=}, for example.

    – Will Robertson
    Nov 3 '08 at 22:20







    I guess the problem with using verb is that it breaks inside macro arguments. You can't write section{verb=~=}, for example.

    – Will Robertson
    Nov 3 '08 at 22:20















    Kopka's LaTeX books are very old. Originally they were written for LaTeX 2.09 and the later editions are only less modified for LaTeX2e. So they are not the best description of LaTeX2e and at least not of packages available for LaTeX2e. textbackslash for example has been described at LaTeX2e for authors by the LaTeX team.

    – Schweinebacke
    Nov 20 '11 at 13:01





    Kopka's LaTeX books are very old. Originally they were written for LaTeX 2.09 and the later editions are only less modified for LaTeX2e. So they are not the best description of LaTeX2e and at least not of packages available for LaTeX2e. textbackslash for example has been described at LaTeX2e for authors by the LaTeX team.

    – Schweinebacke
    Nov 20 '11 at 13:01













    textbackslash is on page 536 of the fourth edition of Kopka and Daly

    – Phil Molyneux
    Jul 25 '15 at 10:50





    textbackslash is on page 536 of the fourth edition of Kopka and Daly

    – Phil Molyneux
    Jul 25 '15 at 10:50











    8














    For the tilde, you can use empty curly brace pair. That puts the "over the letter" tilde over an "empty" letter, so it's placed upward.



    My tilde~{}here





    share|improve this answer



















    • 1





      I guess it depends what the OP is intending to do with the tilde. Sometimes a "naked" tilde is a little unobtrusive.

      – Will Robertson
      Nov 3 '08 at 22:19
















    8














    For the tilde, you can use empty curly brace pair. That puts the "over the letter" tilde over an "empty" letter, so it's placed upward.



    My tilde~{}here





    share|improve this answer



















    • 1





      I guess it depends what the OP is intending to do with the tilde. Sometimes a "naked" tilde is a little unobtrusive.

      – Will Robertson
      Nov 3 '08 at 22:19














    8












    8








    8







    For the tilde, you can use empty curly brace pair. That puts the "over the letter" tilde over an "empty" letter, so it's placed upward.



    My tilde~{}here





    share|improve this answer













    For the tilde, you can use empty curly brace pair. That puts the "over the letter" tilde over an "empty" letter, so it's placed upward.



    My tilde~{}here






    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Nov 3 '08 at 2:37









    hayalcihayalci

    2,68792115




    2,68792115








    • 1





      I guess it depends what the OP is intending to do with the tilde. Sometimes a "naked" tilde is a little unobtrusive.

      – Will Robertson
      Nov 3 '08 at 22:19














    • 1





      I guess it depends what the OP is intending to do with the tilde. Sometimes a "naked" tilde is a little unobtrusive.

      – Will Robertson
      Nov 3 '08 at 22:19








    1




    1





    I guess it depends what the OP is intending to do with the tilde. Sometimes a "naked" tilde is a little unobtrusive.

    – Will Robertson
    Nov 3 '08 at 22:19





    I guess it depends what the OP is intending to do with the tilde. Sometimes a "naked" tilde is a little unobtrusive.

    – Will Robertson
    Nov 3 '08 at 22:19











    5














    From https://faculty.math.illinois.edu/~hildebr/tex/bibliographies.html




    "... tilde symbol (~), which without
    special coding gets interpreted as a
    blank space, and therefore needs to be
    escaped by a backslash (~) or
    replaced by the math "twiddle" symbol
    $sim$. Fortunately, there is a
    package, url, that provides a
    painless way to typeset URL's. To use
    this package available, add



    usepackage{url}


    near the beginning of the document,
    and enclose any web and email
    addresses in the document in
    url{...}:



    url{http://www.math.drofnats.edu/~gauss}
    url{gauss@math.drofnats.edu}


    ..."




    I hope this could help you in typewriting a regular tilde character.






    share|improve this answer






























      5














      From https://faculty.math.illinois.edu/~hildebr/tex/bibliographies.html




      "... tilde symbol (~), which without
      special coding gets interpreted as a
      blank space, and therefore needs to be
      escaped by a backslash (~) or
      replaced by the math "twiddle" symbol
      $sim$. Fortunately, there is a
      package, url, that provides a
      painless way to typeset URL's. To use
      this package available, add



      usepackage{url}


      near the beginning of the document,
      and enclose any web and email
      addresses in the document in
      url{...}:



      url{http://www.math.drofnats.edu/~gauss}
      url{gauss@math.drofnats.edu}


      ..."




      I hope this could help you in typewriting a regular tilde character.






      share|improve this answer




























        5












        5








        5







        From https://faculty.math.illinois.edu/~hildebr/tex/bibliographies.html




        "... tilde symbol (~), which without
        special coding gets interpreted as a
        blank space, and therefore needs to be
        escaped by a backslash (~) or
        replaced by the math "twiddle" symbol
        $sim$. Fortunately, there is a
        package, url, that provides a
        painless way to typeset URL's. To use
        this package available, add



        usepackage{url}


        near the beginning of the document,
        and enclose any web and email
        addresses in the document in
        url{...}:



        url{http://www.math.drofnats.edu/~gauss}
        url{gauss@math.drofnats.edu}


        ..."




        I hope this could help you in typewriting a regular tilde character.






        share|improve this answer















        From https://faculty.math.illinois.edu/~hildebr/tex/bibliographies.html




        "... tilde symbol (~), which without
        special coding gets interpreted as a
        blank space, and therefore needs to be
        escaped by a backslash (~) or
        replaced by the math "twiddle" symbol
        $sim$. Fortunately, there is a
        package, url, that provides a
        painless way to typeset URL's. To use
        this package available, add



        usepackage{url}


        near the beginning of the document,
        and enclose any web and email
        addresses in the document in
        url{...}:



        url{http://www.math.drofnats.edu/~gauss}
        url{gauss@math.drofnats.edu}


        ..."




        I hope this could help you in typewriting a regular tilde character.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Jan 3 at 7:11









        Saphar Koshet

        1362215




        1362215










        answered Mar 19 '11 at 16:41







        user4325






























            4














            Personally, I learned more actually changing the catcodes myself :)



            begingroup
            catcode `~=11
            gdefmytilde{~}
            catcode `|=0
            catcode `\=11
            |gdef|mybs{}
            |endgroup


            and then something like



            This is a tilde: mytilde
            This is a backslash: mybs





            share|improve this answer





















            • 2





              defmybs{char092} does the same for the backslash

              – Herbert
              Aug 29 '12 at 15:03











            • @Herbert: True, but more cryptic ...

              – Jonathan
              Aug 29 '12 at 15:23






            • 1





              ok, then we use string for non cryptic ...

              – Herbert
              Aug 29 '12 at 15:38
















            4














            Personally, I learned more actually changing the catcodes myself :)



            begingroup
            catcode `~=11
            gdefmytilde{~}
            catcode `|=0
            catcode `\=11
            |gdef|mybs{}
            |endgroup


            and then something like



            This is a tilde: mytilde
            This is a backslash: mybs





            share|improve this answer





















            • 2





              defmybs{char092} does the same for the backslash

              – Herbert
              Aug 29 '12 at 15:03











            • @Herbert: True, but more cryptic ...

              – Jonathan
              Aug 29 '12 at 15:23






            • 1





              ok, then we use string for non cryptic ...

              – Herbert
              Aug 29 '12 at 15:38














            4












            4








            4







            Personally, I learned more actually changing the catcodes myself :)



            begingroup
            catcode `~=11
            gdefmytilde{~}
            catcode `|=0
            catcode `\=11
            |gdef|mybs{}
            |endgroup


            and then something like



            This is a tilde: mytilde
            This is a backslash: mybs





            share|improve this answer















            Personally, I learned more actually changing the catcodes myself :)



            begingroup
            catcode `~=11
            gdefmytilde{~}
            catcode `|=0
            catcode `\=11
            |gdef|mybs{}
            |endgroup


            and then something like



            This is a tilde: mytilde
            This is a backslash: mybs






            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Aug 29 '12 at 14:54

























            answered Aug 29 '12 at 14:12









            JonathanJonathan

            1,7101527




            1,7101527








            • 2





              defmybs{char092} does the same for the backslash

              – Herbert
              Aug 29 '12 at 15:03











            • @Herbert: True, but more cryptic ...

              – Jonathan
              Aug 29 '12 at 15:23






            • 1





              ok, then we use string for non cryptic ...

              – Herbert
              Aug 29 '12 at 15:38














            • 2





              defmybs{char092} does the same for the backslash

              – Herbert
              Aug 29 '12 at 15:03











            • @Herbert: True, but more cryptic ...

              – Jonathan
              Aug 29 '12 at 15:23






            • 1





              ok, then we use string for non cryptic ...

              – Herbert
              Aug 29 '12 at 15:38








            2




            2





            defmybs{char092} does the same for the backslash

            – Herbert
            Aug 29 '12 at 15:03





            defmybs{char092} does the same for the backslash

            – Herbert
            Aug 29 '12 at 15:03













            @Herbert: True, but more cryptic ...

            – Jonathan
            Aug 29 '12 at 15:23





            @Herbert: True, but more cryptic ...

            – Jonathan
            Aug 29 '12 at 15:23




            1




            1





            ok, then we use string for non cryptic ...

            – Herbert
            Aug 29 '12 at 15:38





            ok, then we use string for non cryptic ...

            – Herbert
            Aug 29 '12 at 15:38



            Popular posts from this blog

            Installing LyX: “No textclass is found.”LyX installation error- text class not found- 'Reconfigure' or...

            (1602) Indiana Índice Designación y nombre Características orbitales Véase...

            Universidad Autónoma de Occidente Índice Historia Campus Facultades Programas Académicos Medios de...