LaTeX forum ⇒ General\string command behavior - Plain TeX Topic is solved

LaTeX specific issues not fitting into one of the other forums of this category.
User avatar
renyalvarado
Posts: 3
Joined: Mon Jun 04, 2012 6:16 pm

\string command behavior - Plain TeX

Postby renyalvarado » Sun Feb 03, 2013 6:36 pm

Hi, I would like to learn Plain TeX and I'm reading Knuth's "The TeXBook".At Chapter 7, Knuth talks about the \string command and how it converts control sequences into lists of characters tokens. Why when I typed \string\TeX I got "TeX, but when I wrote {\tt \string\TeX} I got \TeX?

I guess it's something related to \escapechar, because when I changed this control sequence the output changed too:
  1. \escapechar=`^
  2. \string\TeX

generates
^TeX

Link:
BBcode:
HTML:
Hide post links
Show post links

User avatar
Stefan Kottwitz
Site Admin
Posts: 7804
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:

Postby Stefan Kottwitz » Sun Feb 03, 2013 8:11 pm

Run this code (or click Open in writeLaTeX), and you can see that the backslash \ from the typewriter font is replaced by " in the font table of the roman font - at place '134 (92):

  1. \documentclass{article}
  2. \usepackage{fonttable}
  3. \begin{document}
  4. \fonttable{cmr8}
  5. \fonttable{cmtt8}
  6. \end{document}


cmr.png
cmr.png (21.84 KiB) Viewed 2137 times

cmtt.png
cmtt.png (16.63 KiB) Viewed 2137 times


You may notice further differences regarding special symbols. In typewriter font, most used special symbols are different to those required in standard text.

Stefan
Site admin

Link:
BBcode: Topic is solved[/url]" title="Click to select post's link in BBcode format" onclick="this.focus();this.select();" />
HTML: Topic is solved</a>" title="Click to select post's link in HTML format" onclick="this.focus();this.select();" />
Hide post links
Show post links

User avatar
cgnieder
Site Moderator
Posts: 1948
Joined: Sat Apr 16, 2011 7:27 pm
Location: Germany
Contact:

Postby cgnieder » Sun Feb 03, 2013 8:27 pm

See also the same question on TeX.sx with currently two answers.

Regards
Clemens
------------------------------
New German Q&A site about TeX: http://texwelt.de/wissen

Link:
BBcode:
HTML:
Hide post links
Show post links


Return to “General”

Who is online

Users browsing this forum: No registered users and 5 guests