# man > ctwill-refsort(1)

---
type: CommandReference
command: ctwill
mode: man
section: 1
source: man-pages
---

## Quick Reference

- `ctwill foo.w` — translate CWEB file `foo.w` to `foo.tex`
- `ctwill foo.w bar.ch` — apply change file `bar.ch` to `foo.w`
- `ctwill foo.w - out.tex` — no change file, output to `out.tex`
- `ctwill +P foo.w` — produce proofmode document (without mini-indexes)
- `ctwill-refsort < foo.ref > foo.sref` — sort reference file for alphabetized mini-indexes
- `ctwill-twinx outfile.tex ... > index.tex` — compile master index from multiple ctwill outputs
- `ctwill --verbose` — show progress and success messages
- `ctwill +lpdf foo.w` — produce PDF output with active hyperlinks

## Name

`ctwill`, `ctwill-refsort`, `ctwill-twinx` — translate CWEB to TeX with mini-indexes

## Synopsis

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

## Options

Options are turned on with `+` or off with `-`. Processed left to right.

- `+b` — print banner line on terminal
- `+h` — print success message on completion
- `+p` — print progress report messages
- `+q` / `-q` — shortcut for `-bhp` (quiet mode, default)
- `+v` / `-v` — shortcut for `+bhp` (verbose mode)
- `-c` — ignore temporary output irrespective of changes
- `-e` — do not enclose C/C++ material in `\PB{...}`
- `-f` — do not force a newline after every C/C++ statement in output
- `-i` — suppress indentation of parameter declarations
- `-o` — suppress separation of declarations and statements
- `-x` — omit indices, section names, table of contents
- `+P` — `\input` `ctproofmac.tex` instead of `ctwimac.tex` (proofmode)
- `+lX` / `-lX` — use macros for language _X_, e.g., `+ld` for German, `+lpdf` for PDF hyperlinks
- `+s` — print usage statistics
- `+t` — treat `typename` in a template like `typedef`
- `--help` — display help message and exit
- `--version` — output version information and exit

## Examples

Translate a CWEB file with no change file:

shell
ctwill foo.w
Apply a change file:

shell
ctwill foo.w bar.ch
Specify a custom output file name (no change file):

shell
ctwill foo.w - output.tex
Produce proofmode output for checking cross-references:

shell
ctwill +P foo.w
Sort reference file for alphabetized mini-indexes (run after first `ctwill` and first `tex`):

shell
ctwill-refsort < foo.ref > foo.sref
Create a master index from multiple ctwill outputs:

shell
ctwill-twinx prog1.tex prog2.tex > index.tex
## See Also

- [cweb(1)](http://localhost/phpMan.php/man/cweb/1/markdown)
- [tex(1)](http://localhost/phpMan.php/man/tex/1/markdown)
- [cc(1)](http://localhost/phpMan.php/man/cc/1/markdown)
- CWEB user manual: `cwebman.tex` (available from [CTAN](https://ctan.org/pkg/cweb))
- *The CWEB System of Structured Documentation* by D. E. Knuth and S. Levy
- *Digital Typography* by D. E. Knuth
- *Literate Programming* by D. E. Knuth
- *Weaving a Program* by W. Sewell

## Exit Codes

Not documented in the original man page.