File: strhack.nw

package info (click to toggle)
noweb 2.13-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,540 kB
  • sloc: sh: 2,580; ansic: 1,829; makefile: 903; perl: 781; lisp: 757; awk: 174; csh: 3
file content (32 lines) | stat: -rw-r--r-- 954 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
\documentstyle[11pt,noweb]{article}
\noweboptions{longchunks,noidentxref,smallcode}
\pagestyle{noweb}

\def\noweb/{{\tt noweb}}

\title{A Hack for Typesetting Strings in \noweb/\thanks{This
code is hereby placed in the public domain.}}
\author{Lee Wittenberg\\Kean College of New Jersey\\Union, NJ
07083\\\tt leew@pilot.njin.net}

\begin{document}
\maketitle

The following macros adjust things so that \noweb/ will use 
``visible spaces'' in double-quoted strings within code chunks. 
The same effect can be 
achieved for single-quoted strings by replacing each occurrence 
of `[["]]', below, with `[[']]'.
It doesn't work within \verb"[["~\ldots~\verb"]]" (although I 
can't figure out why).
<<*>>=
\global\let\xsetup=\setupcode
\bgroup
	\catcode`\"=\active\gdef\setupcode{\xsetup
	\catcode`\"=\active\def"##1"{\char`\"\xxx{##1}\char`\"}}%
\egroup
\bgroup
	\catcode`\ =\active\gdef\xxx#1{{\catcode`\ =\active\chardef ='40#1}}%
\egroup
@
\end{document}