# man > cweb(1)

---
type: CommandReference
command: ctangle, cweave
mode: man
section: 1
source: man-pages
---

## Quick Reference

- `ctangle webfile.w` — translate CWEB to C/C++ program
- `cweave webfile.w` — translate CWEB to TeX document
- `ctangle webfile.w changefile.ch` — apply change file overrides
- `cweave webfile.w - outfile.tex` — specify output without change file
- `ctangle --verbose webfile.w` — enable progress messages
- `cweave --quiet webfile.w` — suppress all messages (default)
- `cweave -x webfile.w` — omit indices, section names, table of contents
- `ctangle --help` — display help and exit

## Name

**ctangle**, **cweave** — translate CWEB to C/C++ and/or TeX

## Synopsis

**ctangle** [*options*] *webfile*[.w] [{*changefile*[.ch]|-} [*outfile*[.c]]]

**cweave** [*options*] *webfile*[.w] [{*changefile*[.ch]|-} [*outfile*[.tex]]]

## Options

### Common to both **ctangle** and **cweave**

- `+b` — print banner line on terminal
- `+h` — print success message on completion
- `+p` — print progress report messages
- `+q` / `-q` — shortcut for `-bhp`; also `--quiet` (default)
- `+v` / `-v` — shortcut for `+bhp`; also `--verbose`
- `-c` — ignore temporary output irrespective of changes
- `+s` — print usage statistics
- `--help` — display help message and exit
- `--version` — output version information and exit

### **ctangle** only

- `+k` — keep separators in numeric literals in the output

### **cweave** only

- `-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
- `+lX` / `-lX` — use macros for language *X* as of *X***cwebmac.tex**
- `+t` — treat `typename` in a template like `typedef`

## Environment

- `CWEBINPUTS` — colon-separated search path for input files; overridden by system default if not set. (See [tex(1)](https://www.chedong.com/phpMan.php/man/tex/1/markdown) for details.)
- `CWEBINPUTS_cweb` — more specific search path for CWEB.
- `TEXMFLOCALEDIR` — parent directory for GNU gettext translation catalogs (if NLS support enabled).

## Files

- `cwebmac.tex` — default TeX macros loaded by **cweave** output.
- `cwebman.tex` — CWEB user manual (available from [CTAN](https://ctan.org/pkg/cweb)).

## Examples

shell
# Basic translation
ctangle program.w
cweave program.w

# Apply a change file
ctangle program.w fix.ch

# Specify output file, no change file
cweave program.w - output.tex

# Verbose mode
ctangle --verbose program.w

# Quiet mode (default)
cweave program.w
## See Also

- [cweb(1)](https://www.chedong.com/phpMan.php/man/cweb/1/markdown)
- [tex(1)](https://www.chedong.com/phpMan.php/man/tex/1/markdown)
- [cc(1)](https://www.chedong.com/phpMan.php/man/cc/1/markdown)
- The CWEB System of Structured Documentation (D. E. Knuth and S. Levy)
- Literate Programming (D. E. Knuth)
- Weaving a Program (Wayne Sewell)