{
    "mode": "man",
    "parameter": "cweb",
    "section": "1",
    "url": "https://www.chedong.com/phpMan.php/man/cweb/1/json",
    "generated": "2026-08-06T15:55:55Z",
    "synopsis": "ctangle [options] webfile[.w] [{changefile[.ch]|-} [outfile[.c]]]\ncweave [options] webfile[.w] [{changefile[.ch]|-} [outfile[.tex]]]",
    "sections": {
        "NAME": {
            "content": "ctangle, cweave - translate CWEB to C/C++ and/or TeX\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "ctangle [options] webfile[.w] [{changefile[.ch]|-} [outfile[.c]]]\ncweave [options] webfile[.w] [{changefile[.ch]|-} [outfile[.tex]]]\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "The ctangle program converts a CWEB source document into a C/C++ program that may be compiled\nin  the  usual  way.   The output file includes #line specifications so that debugging can be\ndone in terms of the CWEB source file.\n\nThe cweave program converts the same CWEB file into a TeX file  that  may  be  formatted  and\nprinted  in the usual way.  It takes appropriate care of typographic details like page layout\nand the use of indentation, italics, boldface, etc., and it  supplies  extensive  cross-index\ninformation that it gathers automatically.\n\nCWEB  allows  you  to prepare a single document containing all the information that is needed\nboth to produce a compilable C/C++ program and to produce a well-formatted document  describ‐\ning the program in as much detail as the writer may desire.  The user of CWEB ought to be fa‐\nmiliar with TeX as well as C/C++.\n",
            "subsections": []
        },
        "USAGE": {
            "content": "The  command line should have one, two, or three names on it.  The first is taken as the CWEB\ninput file (and .w is added if there is no extension).  If there is a second name,  it  is  a\nchange  file (and .ch is added if there is no extension).  The change file overrides parts of\nthe CWEB file, as described in the documentation.  If there is a third name, it overrides the\ndefault name of the output file, which is ordinarily the same as the name of the  input  file\n(but  on the current directory) with the extension .tex.  If you just want to change the out‐\nput file name, but don’t have a change file to apply, you can use `-' as the second argument.\n",
            "subsections": []
        },
        "DIFFERENCES TO ORIGINAL CWEB": {
            "content": "CWEBbin tries hard to be a drop-in replacement for CWEB, so in general you should not  notice\nany  differences in invoking the programs nor in the resulting output.  There are, however, a\nfew differences worth noting:\n\n• Options --help, --quiet, --verbose, --version, and flags +c, -i, -o, +u, and +lX are new in\nCWEBbin and TeX Live.\n\n• Option +lX is accompanied by several wrapper files for cwebmac.tex with translated captions\nfor German (+ld), French (+lf), and Italian (+li).\n\n• CWEB in TeX Live operates silently by default (as of 2019); use the --verbose option to get\nthe original behavior.\n\n• File lookup with the environment variable CWEBINPUTS is extended to permit several,  colon-\nseparated, paths; see ENVIRONMENT below.\n\n• If  properly  configured,  the main programs ctangle and cweave are localized with the “GNU\ngettext utilities”.\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "Options on the command line may be either turned off with `-' (if they are on by default)  or\nturned  on  with  `+'  (if they are off by default).  In fact, the options are processed from\nleft to right, so a sequence like --verbose -h will only show the banner line  (+b)  and  the\nprogress report (+p), but leave out the happy message (-h).\n\nThe first batch of options are common to both ctangle and cweave:\n\n• +b: print banner line on terminal\n\n• +h: print success message on completion\n\n• +p: print progress report messages\n\n• +q/-q: shortcut for -bhp; also --quiet (default)\n\n• +v/-v: shortcut for +bhp; also --verbose\n\n• +c: check temporary output for changes\n\n• +s: print usage statistics\n\n• --help: display help message and exit\n\n• --version: output version information and exit\n\nThere is one other option applicable to ctangle only:\n\n• +k: keep separators in numeric literals in the output\n\n• +u: transliterate UTF-8 charcters in C code\n\nThere are seven other options applicable to cweave only:\n\n• -e: do not enclose C/C++ material in \\PB{...}\n\n• -f: do not force a newline after every C/C++ statement in output\n\n• -i: suppress indentation of parameter declarations\n\n• -o: suppress separation of declarations and statements\n\n• -x: omit indices, section names, table of contents\n\n• +lX/-lX: use macros for language X as of Xcwebmac.tex\n\n• +t: treat typename in a template like typedef\n",
            "subsections": []
        },
        "ENVIRONMENT": {
            "content": "The  environment variable CWEBINPUTS is used to search for the input files, or the system de‐\nfault if CWEBINPUTS is not set.  See tex(1) for the details of the searching.  To avoid  con‐\nflicts with other programs that also use the CWEBINPUTS environment, you can be more specific\nand use CWEBINPUTScweb for special requirements in CWEB.\n\nIf  prepared  for NLS support, ctangle and cweave use the environment variable TEXMFLOCALEDIR\nto configure the parent directory where the “GNU gettext utilities”  search  for  translation\ncatalogs.\n\nThese variables are preconfigured in TeX Live’s texmf.cnf.\n",
            "subsections": []
        },
        "FILES": {
            "content": "The  location  of  the files mentioned below varies from system to system.  Use the kpsewhich\nutility to find their locations.\n\n• cwebmac.tex: The default TeX macros \\input in the first line of the cweave output file.\n\n• cwebman.tex: The CWEB user manual, available in PDF from CTAN (https://ctan.org/pkg/cweb).\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "• The CWEB System of Structured Documentation: by Donald E. Knuth and Silvio  Levy  (hardcopy\nversion of cwebman.tex and the source code listings of common.w, ctangle.w, and cweave.w).\n\n• Literate Programming: by D. E. Knuth.\n\n• Weaving a Program: by Wayne Sewell.\n\ncweb(1), tex(1), cc(1)\n",
            "subsections": []
        },
        "AUTHORS": {
            "content": "Don Knuth wrote WEB for TeX and Pascal.\nSilvio  Levy designed and developed CWEB by adapting the WEB conventions to C and by recoding\neverything in CWEB.  Knuth began using CWEB and made further refinements.\nMany other helpers are acknowledged in the CWEB manual.\nContemporary development on https://github.com/ascherer/cweb.\n\nWeb2c 2023                                 August 20, 2022                                   CWEB(1)",
            "subsections": []
        }
    },
    "summary": "ctangle, cweave - translate CWEB to C/C++ and/or TeX",
    "flags": [],
    "examples": [],
    "see_also": [
        {
            "name": "tex",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/tex/1/json"
        },
        {
            "name": "cc",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/cc/1/json"
        }
    ]
}