{
    "content": [
        {
            "type": "text",
            "text": "# chem (man)\n\n## DESCRIPTION\n\nchem  produces chemical structure diagrams.  Today's version is best suited for organic chem‐\nistry (bonds, rings).  The chem program is a groff preprocessor like eqn, pic, tbl, etc.   It\ngenerates  pic  output  such that all chem parts are translated into diagrams of the pic lan‐\nguage.\n\n## Sections\n\n- **Name**\n- **Synopsis** (4 subsections)\n- **Description** (1 subsections)\n- **Language** (7 subsections)\n- **Files**\n- **Authors**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "chem",
        "section": "",
        "mode": "man",
        "summary": null,
        "synopsis": null,
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [
            {
                "flag": "-p",
                "long": null,
                "arg": null,
                "description": "chem [file ...] | groff -p ..."
            }
        ],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "Name",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "Synopsis",
                "lines": 2,
                "subsections": [
                    {
                        "name": "chem -h",
                        "lines": 1
                    },
                    {
                        "name": "chem --help",
                        "lines": 1
                    },
                    {
                        "name": "chem -v",
                        "lines": 1
                    },
                    {
                        "name": "chem --version",
                        "lines": 1
                    }
                ]
            },
            {
                "name": "Description",
                "lines": 38,
                "subsections": [
                    {
                        "name": "-p",
                        "lines": 2,
                        "flag": "-p"
                    }
                ]
            },
            {
                "name": "Language",
                "lines": 4,
                "subsections": [
                    {
                        "name": "Setting variables",
                        "lines": 25
                    },
                    {
                        "name": "Bonds",
                        "lines": 25
                    },
                    {
                        "name": "Rings",
                        "lines": 42
                    },
                    {
                        "name": "Moieties and strings",
                        "lines": 34
                    },
                    {
                        "name": "Names",
                        "lines": 12
                    },
                    {
                        "name": "Miscellaneous",
                        "lines": 47
                    },
                    {
                        "name": "Wish list",
                        "lines": 25
                    }
                ]
            },
            {
                "name": "Files",
                "lines": 13,
                "subsections": []
            },
            {
                "name": "Authors",
                "lines": 11,
                "subsections": []
            }
        ],
        "sections": {
            "Name": {
                "content": "chem - embed chemical structure diagrams in groff documents\n",
                "subsections": []
            },
            "Synopsis": {
                "content": "chem [--] [file ...]\n",
                "subsections": [
                    {
                        "name": "chem -h",
                        "content": ""
                    },
                    {
                        "name": "chem --help",
                        "content": ""
                    },
                    {
                        "name": "chem -v",
                        "content": ""
                    },
                    {
                        "name": "chem --version",
                        "content": ""
                    }
                ]
            },
            "Description": {
                "content": "chem  produces chemical structure diagrams.  Today's version is best suited for organic chem‐\nistry (bonds, rings).  The chem program is a groff preprocessor like eqn, pic, tbl, etc.   It\ngenerates  pic  output  such that all chem parts are translated into diagrams of the pic lan‐\nguage.\n\nIf no operands are given, or if file is “-”, chem reads the standard input  stream.   -h  and\n--help  display  a  usage  message, whereas -v and --version display version information; all\nexit.\n\nThe program chem originates from the Perl source file chem.pl.  It tells  pic  to  include  a\ncopy of the macro file chem.pic.  Moreover the groff source file pic.tmac is loaded.\n\nIn a style reminiscent of eqn and pic, the chem diagrams are written in a special language.\n\nA set of chem lines looks like this\n\n.cstart\nchem data\n.cend\n\nLines  containing  the  keywords  .cstart and .cend start and end the input for chem, respec‐\ntively.  In pic context, i.e., after the call of .PS, chem input can optionally be started by\nthe line begin chem and ended by the line with the single word end instead.\n\nAnything outside these initialization lines is copied through without modification; all  data\nbetween the initialization lines is converted into pic commands to draw the diagram.\n\nAs an example,\n\n.cstart\nCH3\nbond\nCH3\n.cend\n\nprints two CH3 groups with a bond between them.\n\nIf  you want to create just groff output, you must run chem followed by groff with the option",
                "subsections": [
                    {
                        "name": "-p",
                        "content": "chem [file ...] | groff -p ...\n",
                        "flag": "-p"
                    }
                ]
            },
            "Language": {
                "content": "The chem input language is rather small.  It provides rings of several styles and  a  way  to\nglue  them  together  as  desired,  bonds of several styles, moieties (e.g., C, NH3, ..., and\nstrings.\n",
                "subsections": [
                    {
                        "name": "Setting variables",
                        "content": "There are some variables that can be set by commands.  Such commands have two possible forms,\neither\n\nvariable value\n\nor\n\nvariable = value\n\nThis sets the given variable to the argument value.  If more arguments  are  given  only  the\nlast argument is taken, all other arguments are ignored.\n\nThere are only a few variables to be set by these commands:\n\ntextht arg\nSet the height of the text to arg; default is 0.16.\n\ncwid arg\nSet the character width to arg; default is 0.12.\n\ndb arg Set the bond length to arg; default is 0.2.\n\nsize arg\nScale the diagram to make it look plausible at point size arg; default is 10 point.\n"
                    },
                    {
                        "name": "Bonds",
                        "content": "This\n\nbond [direction] [length n] [from Name|picstuff]\n\ndraws  a single bond in direction from nearest corner of Name.  bond can also be double bond,\nfront bond, back bond, etc.  (We will get back to Name soon.)\n\ndirection is the angle in degrees (0 up, positive clockwise) or a  direction  word  like  up,\ndown,  sw (= southwest), etc.  If no direction is specified, the bond goes in the current di‐\nrection (usually that of the last bond).\n\nNormally the bond begins at the last object placed;  this can be changed  by  naming  a  from\nplace.  For instance, to make a simple alkyl chain:\nCH3\nbond                (this one goes right from the CH3)\nC                   (at the right end of the bond)\ndouble bond up      (from the C)\nO                   (at the end of the double bond)\nbond right from C\nCH3\n\nA  length  in inches may be specified to override the default length.  Other pic commands can\nbe tacked on to the end of a bond command, to created dotted or dashed bonds or to specify  a\nto place.\n"
                    },
                    {
                        "name": "Rings",
                        "content": "There are lots of rings, but only five- and six-sided rings get much support.  ring by itself\nis  a six-sided ring; benzene is the benzene ring with a circle inside.  aromatic puts a cir‐\ncle into any kind of ring.\n\nring [pointing (up|right|left|down)] [aromatic] [put Mol at n] [double i,j k,l ...\n[picstuff]\n\nThe vertices of a ring are numbered 1, 2, ... from the vertex that points in the natural com‐\npass direction.  So for a hexagonal ring with the point at the top,  the  top  vertex  is  1,\nwhile if the ring has a point at the east side, that is vertex 1.  This is expressed as\n\nR1: ring pointing up\nR2: ring pointing right\n\nThe  ring  vertices are named .V1, ..., .Vn, with .V1 in the pointing direction.  So the cor‐\nners of R1 are R1.V1 (the top), R1.V2, R1.V3, R1.V4 (the bottom), etc., whereas for R2, R2.V1\nis the rightmost vertex and R2.V4 the leftmost.  These vertex names are used  for  connecting\nbonds or other rings.  For example,\n\nR1: benzene pointing right\nR2: benzene pointing right with .V6 at R1.V2\n\ncreates two benzene rings connected along a side.\n\nInterior double bonds are specified as double n1,n2 n3,n4 ...; each number pair adds an inte‐\nrior bond.  So the alternate form of a benzene ring is\n\nring double 1,2 3,4 5,6\n\nHeterocycles  (rings with something other than carbon at a vertex) are written as put X at V,\nas in\n\nR: ring put N at 1 put O at 2\n\nIn this heterocycle, R.N and R.O become synonyms for R.V1 and R.V2.\n\nThere are two five-sided rings.  ring5 is pentagonal with a side that matches  the  six-sided\nring;  it  has  four natural directions.  A flatring is a five-sided ring created by chopping\none corner of a six-sided ring so that it exactly matches the six-sided rings.\n\nThe description of a ring has to fit on a single line.\n"
                    },
                    {
                        "name": "Moieties and strings",
                        "content": "A moiety is a string of characters beginning with a capital letter, such as  N(C2H5)2.   Num‐\nbers  are  converted to subscripts (unless they appear to be fractional values, as in N2.5H).\nThe name of a moiety is determined  from  the  moiety  after  special  characters  have  been\nstripped out: e.g., N(C2H5)2) has the name NC2H52.\n\nMoieties  can  be  specified  in two kinds.  Normally a moiety is placed right after the last\nthing mentioned, separated by a semicolon surrounded by spaces, e.g.,\n\nB1: bond ; OH\n\nHere the moiety is OH; it is set after a bond.\n\nAs the second kind a moiety can be positioned as the first word in a pic-like command, e.g.,\n\nCH3 at C + (0.5,0.5)\n\nHere the moiety is CH3.  It is placed at a position relative to C, a moiety used  earlier  in\nthe chemical structure.\n\nSo  moiety  names  can  be  specified as chem positions everywhere in the chem code.  Beneath\ntheir printing moieties are names for places.\n\nThe moiety BP is special.  It is not printed but just serves as a mark to be referred  to  in\nlater chem commands.  For example,\n\nbond ; BP\n\nsets  a mark at the end of the bond.  This can be used then for specifying a place.  The name\nBP is derived from branch point (i.e., line crossing).\n\nA string within double quotes \" is interpreted as a part of a chem command.  It represents  a\nstring that should be printed (without the quotes).  Text within quotes \"...\" is treated more\nor less like a moiety except that no changes are made to the quoted part.\n"
                    },
                    {
                        "name": "Names",
                        "content": "In  the  alkyl chain above, notice that the carbon atom C was used both to draw something and\nas the name for a place.  A moiety always defines a name for a place;  you can use  your  own\nnames for places instead, and indeed, for rings you will have to.  A name is just\n\nName: ...\n\nName  is  often  the  name of a moiety like CH3, but it need not to be.  Any name that begins\nwith a capital letter and which contains only letters and numbers is valid:\n\nFirst: bond\nbond 30 from First\n"
                    },
                    {
                        "name": "Miscellaneous",
                        "content": "The specific construction\n\nbond ... ; moiety\n\nis equivalent to\n\nbond\nmoiety\n\nOtherwise, each item has to be on a separate line (and only one line).  Note that there  must\nbe whitespace after the semicolon which separates the commands.\n\nA  period  character . or a single quote ' in the first column of a line signals a troff com‐\nmand, which is copied through as-is.\n\nA line whose first non-blank character is a hash character (#) is treated as  a  comment  and\nthus ignored.  However, hash characters within a word are kept.\n\nA line whose first word is pic is copied through as-is after the word pic has been removed.\n\nThe command\n\nsize n\n\nscales the diagram to make it look plausible at point size n (default is 10 point).\n\nAnything else is assumed to be pic code, which is copied through with a label.\n\nSince chem is a pic preprocessor, it is possible to include pic statements in the middle of a\ndiagram  to  draw  things not provided for by chem itself.  Such pic statements should be in‐\ncluded in chem code by adding pic as the first word of this line for clarity.\n\nThe following pic commands are accepted as chem commands, so no pic command word is needed:\n\ndefine Start the definition of pic macro within chem.\n\n[      Start a block composite.\n\n]      End a block composite.\n\n{      Start a macro definition block.\n\n}      End a macro definition block.\n\nThe macro names from define statements are stored and their call is accepted as a  chem  com‐\nmand as well.\n"
                    },
                    {
                        "name": "Wish list",
                        "content": "This TODO list was collected by Brian Kernighan.\n\nError  checking is minimal; errors are usually detected and reported in an oblique fashion by\npic.\n\nThere is no library or file inclusion mechanism, and there is  no  shorthand  for  repetitive\nstructures.\n\nThe  extension mechanism is to create pic macros, but these are tricky to get right and don't\nhave all the properties of built-in objects.\n\nThere is no in-line chemistry yet (e.g., analogous to the $...$ construct of eqn).\n\nThere is no way to control entry point for bonds on groups.  Normally a bond connects to  the\ncarbon atom if entering from the top or bottom and otherwise to the nearest corner.\n\nBonds from substituted atoms on heterocycles do not join at the proper place without adding a\nbit of pic.\n\nThere is no decent primitive for brackets.\n\nText (quoted strings) doesn't work very well.\n\nA squiggle bond is needed.\n"
                    }
                ]
            },
            "Files": {
                "content": "/usr/share/groff/1.23.0/pic/chem.pic\nA collection of pic macros needed by chem.\n\n/usr/share/groff/1.23.0/tmac/pic.tmac\nA macro file which redefines .PS, .PE, and .PF to center pic diagrams.\n\n/usr/share/doc/groff-base/examples/chem/*.chem\nExample files for chem.\n\n/usr/share/doc/groff-base/examples/chem/122/*.chem\nExample  files  from  the chem article by its authors, “CHEM—A Program for Typesetting\nChemical Structure Diagrams: User Manual” (CSTR #122).\n",
                "subsections": []
            },
            "Authors": {
                "content": "The GNU version of chem was written by \u001b]8;;mailto:groff-bernd.warken-72@web.de\u001b\\Bernd Warken\u001b]8;;\u001b\\.  It is based  on  the  documentation  of\nBrian Kernighan's original awk version of chem.\n\nSee also\n“CHEM—A  Program  for  Typesetting Chemical Diagrams: User Manual” by Jon L. Bentley, Lynn W.\nJelinski, and Brian W. Kernighan, 1992, AT&T Bell Laboratories  Computing  Science  Technical\nReport No. 122\n\n\u001b]8;;man:groff(1)\u001b\\groff(1)\u001b]8;;\u001b\\, \u001b]8;;man:pic(1)\u001b\\pic(1)\u001b]8;;\u001b\\\n\ngroff 1.23.0                                31 March 2024                                    chem(1)",
                "subsections": []
            }
        }
    }
}