1CTWILL(1)                   General Commands Manual                  CTWILL(1)
2
3
4

NAME

6       ctwill, ctwill-refsort, ctwill-twinx - translate CWEB to TeX with mini-
7       indexes
8

SYNOPSIS

10       ctwill [options] webfile[.w] [{changefile[.ch]|-} [outfile[.tex]]]
11       ctwill-refsort < indexfile.ref > indexfile.sref
12       ctwill-twinx outfile.tex [outfile.tex ...]  > index.tex
13

DESCRIPTION

15       The ctwill program converts a CWEB source document into a TeX file that
16       may  be  formatted  and printed in the usual way.  It takes appropriate
17       care of typographic details like page layout and the  use  of  indenta‐
18       tion,  italics,  boldface,  etc., and it supplies extensive cross-index
19       information that it gathers automatically.
20
21       CWEB allows you to prepare a single document containing all the  infor‐
22       mation that is needed both to produce a compilable C/C++ program and to
23       produce a well-formatted document describing the program in as much de‐
24       tail  as  the writer may desire.  The user of CWEB ought to be familiar
25       with TeX as well as C/C++.
26

USAGE

28       The command line should have one, two, or three names on it.  The first
29       is  taken as the CWEB input file (and .w is added if there is no exten‐
30       sion).  If there is a second name, it is a  change  file  (and  .ch  is
31       added  if  there  is no extension).  The change file overrides parts of
32       the CWEB file, as described in the documentation.  If there is a  third
33       name,  it overrides the default name of the output file, which is ordi‐
34       narily the same as the name of the input file (but on the  current  di‐
35       rectory)  with the extension .tex.  If you just want to change the out‐
36       put file name, but don’t have a change file to apply, you can  use  `-'
37       as the second argument.
38
39       ctwill is exactly like cweave except that it produces much better docu‐
40       mentation, for which you must work much harder.  You should run  ctwill
41       twice,  once  to  prime the pump and once to get decent answers.  More‐
42       over, you must run the output twice through TeX.
43
44       After tex foo you will have output that looks like final  pages  except
45       that  the entries of mini-indexes won’t be alphabetized.  The first run
46       produces a weird file called foo.ref.  Say ctwill-refsort <  foo.ref  >
47       foo.sref and then another tex foo will produce alphabetized output.
48
49       The  ctwill-twinx  program compiles a master index for a set of related
50       programs that have been processed by ctwill (not by cweave, mind you!).
51       The  individual  programs  should define their names with a line of the
52       form \def\title{NAME}.  For your convenience,  ctwill-twinx  grabs  the
53       first  “word”  in  \title and turns it into uppercase form.  You should
54       adapt file twinx-startup.tex for the first page of the master index.
55
56       The mini-indexes list identifiers that are used but not defined on each
57       two-page  spread.   At the end of each section, ctwill gives TeX a list
58       of identifiers used in that section and information  about  where  they
59       are defined.
60
61       The  current  meaning  of every identifier is initially \uninitialized.
62       Then ctwill reads the .aux file for your job, if any.
63
64       Before reading the .aux file, ctwill actually looks for a  file  called
65       system.bux,  which will be read if present.  And after foo.aux, a third
66       possibility is foo.bux.  The general convention is to  put  definitions
67       of system procedures such as printf into system.bux, and to put defini‐
68       tions found in specifically foo-ish header files  into  foo.bux.   Like
69       the .aux files, .bux files should contain only @$ specifications.
70
71       The  meaning  specified  by  @$...@>  generally has four components: an
72       identifier (followed by space), a program name (enclosed in braces),  a
73       section number (followed by space), and a TeX part.
74
75       A  special proofmode is provided so that you can check ctwill’s conclu‐
76       sions about cross-references.  Run ctwill with the  flag  +P,  and  TeX
77       will  produce  a specially formatted document (without mini-indexes) in
78       which you can check that your specifications are correct.
79
80       More details how to use ctwill can be found in the  first  sections  of
81       its source code, respectively the change file cweav-twill.ch applicable
82       to the cweave.w source.  A complete example with all bells and whistles
83       is  described  in  Mini-Indexes for Literate Programs, pages 225–245 of
84       Knuth’s Digital Typography.
85

DIFFERENCES TO ORIGINAL CTWILL

87       The present incarnation of ctwill and its utilities tries hard to be  a
88       drop-in  replacement  for  the original package.  There are, however, a
89       few differences worth noting:
90
91       • This version is based on the most recent version of CWEB (4.8).
92
93       • In TeX Live the utility programs are prefixed with  ctwill-  and  the
94         macro files with ct for technical reasons.
95
96       • Options  --help, --quiet, --verbose, --version, and flags +c, -i, -o,
97         and +lX are new in CWEBbin and TeX Live.
98
99       • Option +lX is accompanied by example wrapper  files  for  ctwimac.tex
100         and ctproofmac.tex with translated captions for German (+ld).
101
102       • Option +lX is also accompanied by an extended pdfctwimac.tex for pro‐
103         duction of PDF output with active hyperlinks (+lpdf).
104
105ctwill in TeX Live operates silently by default;  use  the  --verbose
106         option to get the original behavior.
107
108       • File  lookup  with the environment variable CWEBINPUTS is extended to
109         permit several, colon-separated, paths; see ENVIRONMENT below.
110
111       • If properly configured, the main program ctwill is localized with the
112         “GNU gettext utilities”.
113

OPTIONS

115       Options  on the command line may be either turned off with `-' (if they
116       are on by default) or turned on with `+' (if they are off by  default).
117       In  fact,  the  options are processed from left to right, so a sequence
118       like --verbose -h will only show the banner line (+b) and the  progress
119       report (+p), but leave out the happy message (-h).
120
121+b: print banner line on terminal
122
123+h: print success message on completion
124
125+p: print progress report messages
126
127+q/-q: shortcut for -bhp; also --quiet (default)
128
129+v/-v: shortcut for +bhp; also --verbose
130
131+c: check temporary output for changes
132
133-e: do not enclose C/C++ material in \PB{...}
134
135-f: do not force a newline after every C/C++ statement in output
136
137-i: suppress indentation of parameter declarations
138
139-o: suppress separation of declarations and statements
140
141-x: omit indices, section names, table of contents
142
143+P: \input ctproofmac.tex instead of ctwimac.tex
144
145+lX/-lX: use macros for language X as of X{ctwimac|ctproofmac}.tex
146
147+s: print usage statistics
148
149+t: treat typename in a template like typedef
150
151--help: display help message and exit
152
153--version: output version information and exit
154

ENVIRONMENT

156       The  environment  variable  CWEBINPUTS  is used to search for the input
157       files, or the system default if CWEBINPUTS is not set.  See tex(1)  for
158       the  details  of the searching.  To avoid conflicts with other programs
159       that also use the CWEBINPUTS environment, you can be more specific  and
160       use CWEBINPUTS_cweb for special requirements in CWEB.
161
162       If  prepared  for  NLS support, ctwill like ctangle and cweave uses the
163       environment variable TEXMFLOCALEDIR to configure the  parent  directory
164       where the “GNU gettext utilities” search for translation catalogs.
165
166       These variables are preconfigured in TeX Live’s texmf.cnf.
167

FILES

169       The location of the files mentioned below varies from system to system.
170       Use the kpsewhich utility to find their locations.
171
172ctwimac.tex: The default TeX macros \input in the first line  of  the
173         output file.
174
175ctproofmac.tex:  If  ctwill  is  invoked  with the +P option, it will
176         change the first line of the output file to \input ctproofmac.tex.
177
178       In both cases you can request some prefix X with the +lX option,  e.g.,
179       +ld  will  \input dctwimac.tex and +Pld will \input dctproofmac.tex.  A
180       special application is  the  use  of  option  +lpdf  that  will  \input
181       pdfctwimac.tex for production of PDF output with active hyperlinks.
182
183webfile.bux: Reference definitions to resolve from other modules.
184
185system.bux:  Reference definitions to resolve from C/C++ standard li‐
186         brary header files like <stdio.h>.
187
188       Other auxiliary files with  references  are  created  automatically  by
189       ctwill and the actual index files are created by TeX.
190
191cwebman.tex:  The  CWEB  user  manual,  available  in  PDF  from CTAN
192         (https://ctan.org/pkg/cweb).
193

SEE ALSO

195       • The CWEB System of Structured Documentation: by Donald  E. Knuth  and
196         Silvio  Levy  (hardcopy  version  of  cwebman.tex and the source code
197         listings of common.w, ctangle.w, and cweave.w).
198
199       • Digital Typography: by D. E. Knuth.
200
201       • Literate Programming: by D. E. Knuth.
202
203       • Weaving a Program: by Wayne Sewell.
204
205       cweb(1), tex(1), cc(1)
206

AUTHORS

208       Don Knuth wrote ctwill based on cweave by Silvio Levy and Knuth.
209       Contemporary development on https://github.com/ascherer/cwebbin.
210
211
212
213Web2c 2023                       June 5, 2022                        CTWILL(1)
Impressum