GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it
1[1X2 [33X[0;0Y[5XAutoDoc[105X[101X[1X documentation comments[133X[101X23[33X[0;0YYou can document declarations of global functions and variables, operations,4attributes etc. by inserting [13X[5XAutoDoc[105X[113X comments into your sources before these5declaration. An [5XAutoDoc[105X comment always starts with [10X#![110X. This is also the6smallest possible [5XAutoDoc[105X command. If you want your declaration documented,7just write [10X#![110X at the line before the documentation. For example:[133X89[4X[32X[104X10[4X#![104X11[4XDeclareOperation( "AnOperation",[104X12[4X [ IsList ] );[104X13[4X[32X[104X1415[33X[0;0YThis will produce a manual entry for the operation [10XAnOperation[110X.[133X1617[33X[0;0YInside of [5XAutoDoc[105X comments, [13X[5XAutoDoc[105X commands[113X starting with [10X@[110X can be used to18control the output [5XAutoDoc[105X produces.[133X192021[1X2.1 [33X[0;0YDocumenting declarations[133X[101X2223[33X[0;0YIn the bare form above, the manual entry for [10XAnOperation[110X will not contain24much more than the name of the operation. In order to change this, there are25several commands you can put into the [5XAutoDoc[105X comment before the26declaration. Currently, the following commands are provided:[133X272829[1X2.1-1 [33X[0;0Y@Description [3Xdescr[103X[101X[1X[133X[101X3031[33X[0;0YAdds the text in the following lines of the [5XAutoDoc[105X to the description of32the declaration in the manual. Lines are until the next [5XAutoDoc[105X command or33until the declaration is reached.[133X343536[1X2.1-2 [33X[0;0Y@Returns [3Xret_val[103X[101X[1X[133X[101X3738[33X[0;0YThe string [3Xret_val[103X is added to the documentation, with the text [21XReturns: [121X39put in front of it. This should usually give a brief hint about the type or40meaning of the value retuned by the documented function.[133X414243[1X2.1-3 [33X[0;0Y@Arguments [3Xargs[103X[101X[1X[133X[101X4445[33X[0;0YThe string [3Xargs[103X contains a description of the arguments the function46expects, including optional parts, which are denoted by square brackets. The47argument names can be separated by whitespace, commas or square brackets for48the optional arguments, like [21Xgrp[, elm][121X or [21Xxx[y[z] ][121X. If [5XGAP[105X options are49used, this can be followed by a colon : and one or more assignments, like50[21Xn[, r]: tries := 100[121X.[133X515253[1X2.1-4 [33X[0;0Y@Group [3Xgrpname[103X[101X[1X[133X[101X5455[33X[0;0YAdds the following method to a group with the given name. See section [14X2.5[114X56for more information about groups.[133X575859[1X2.1-5 [33X[0;0Y@Label [3Xlabel[103X[101X[1X[133X[101X6061[33X[0;0YAdds label to the function as label. If this is not specified, then for62declarations that involve a list of input filters (as is the case for63[10XDeclareOperation[110X, [10XDeclareAttribute[110X, etc.), a default label is generated from64this filter list.[133X6566[4X[32X[104X67[4X#! @Label testlabel[104X68[4XDeclareProperty( "AProperty",[104X69[4X IsObject );[104X70[4X[32X[104X7172[33X[0;0Yleads to this:[133X7374[1X2.1-6 AProperty[101X7576[29X[2XAProperty[102X( [3Xarg[103X ) [32X property77[6XReturns:[106X [33X[0;10Y[10Xtrue[110X or [10Xfalse[110X[133X7879[33X[0;0Ywhile[133X8081[4X[32X[104X82[4X#![104X83[4XDeclareProperty( "AProperty",[104X84[4X IsObject );[104X85[4X[32X[104X8687[33X[0;0Yleads to this:[133X8889[1X2.1-7 AProperty[101X9091[29X[2XAProperty[102X( [3Xarg[103X ) [32X property92[6XReturns:[106X [33X[0;10Y[10Xtrue[110X or [10Xfalse[110X[133X939495[1X2.1-8 [33X[0;0Y@ChapterInfo [3Xchapter, section[103X[101X[1X[133X[101X9697[33X[0;0YAdds the entry to the given chapter and section. Here, [3Xchapter[103X and [3Xsection[103X98are the respective titles.[133X99100[33X[0;0YAs an example, a full [5XAutoDoc[105X comment for with all options could look like101this:[133X102103[4X[32X[104X104[4X#! @Description[104X105[4X#! Computes the list of lists of degrees of ordinary characters[104X106[4X#! associated to the <A>p</A>-blocks of the group <A>G</A>[104X107[4X#! with <A>p</A>-modular character table <A>modtbl</A>[104X108[4X#! and underlying ordinary character table <A>ordtbl</A>.[104X109[4X#! @Returns a list[104X110[4X#! @Arguments modtbl[104X111[4X#! @Group CharacterDegreesOfBlocks[104X112[4X#! @FunctionLabel chardegblocks[104X113[4X#! @ChapterInfo Blocks, Attributes[104X114[4XDeclareAttribute( "CharacterDegreesOfBlocks",[104X115[4X IsBrauerTable );[104X116[4X[32X[104X117118119[1X2.2 [33X[0;0YOther documentation comments[133X[101X120121[33X[0;0YThere are also some commands which can be used in [5XAutoDoc[105X comments that are122not associated to any declaration. This is useful for additional text in123your documentation, examples, mathematical chapters, etc..[133X124125126[1X2.2-1 [33X[0;0Y@Chapter [3Xname[103X[101X[1X[133X[101X127128[33X[0;0YSets a chapter, all functions without separate info will be added to this129chapter. Also all text comments, i.e. lines that begin with #! without a130command, and which do not follow after @description, will be added to the131chapter as regular text. Example:[133X132133[4X[32X[104X134[4X#! @Chapter My chapter[104X135[4X#! This is my chapter.[104X136[4X#! I document my stuff in it.[104X137[4X[32X[104X138139[33X[0;0YThe [10X@ChapterLabel[110X [3Xlabel[103X command can be used to set the label of the chapter140to [10XChapter_[110X[3Xlabel[103X. Additionally, the chapter will be stored as141[10X_Chapter_[110X[3Xlabel[103X[10X.xml[110X.[133X142143144[1X2.2-2 [33X[0;0Y@Section [3Xname[103X[101X[1X[133X[101X145146[33X[0;0YSets a section like chapter sets a chapter.[133X147148[4X[32X[104X149[4X#! @Section My first manual section[104X150[4X#! In this section I am going to document my first method.[104X151[4X[32X[104X152153[33X[0;0YThe [10X@SectionLabel[110X [3Xlabel[103X command can be used to set the label of the section154to [10XSection_[110X[3Xlabel[103X.[133X155156157[1X2.2-3 [33X[0;0Y@EndSection[133X[101X158159[33X[0;0YCloses the current section. Please be careful here. Closing a section before160opening it might cause unexpected errors.[133X161162[4X[32X[104X163[4X#! @EndSection[104X164[4X#### The following text again belongs to the chapter[104X165[4X#! Now we could start a second section if we want to.[104X166[4X[32X[104X167168169[1X2.2-4 [33X[0;0Y@Subsection [3Xname[103X[101X[1X[133X[101X170171[33X[0;0YSets a subsection like chapter sets a chapter.[133X172173[4X[32X[104X174[4X#! @Subsection My first manual subsection[104X175[4X#! In this subsection I am going to document my first example.[104X176[4X[32X[104X177178[33X[0;0YThe [10X@SubsectionLabel[110X [3Xlabel[103X command can be used to set the label of the179subsection to [10XSubsection_[110X[3Xlabel[103X.[133X180181182[1X2.2-5 [33X[0;0Y@EndSubsection[133X[101X183184[33X[0;0YCloses the current subsection. Please be careful here. Closing a subsection185before opening it might cause unexpected errors.[133X186187[4X[32X[104X188[4X#! @EndSubsection[104X189[4X#### The following text again belongs to the section[104X190[4X#! Now we are in the section again[104X191[4X[32X[104X192193194[1X2.2-6 [33X[0;0Y@BeginAutoDoc[133X[101X195196[33X[0;0YCauses all subsequent declarations to be documented in the manual,197regardless of whether they have an [5XAutoDoc[105X comment in front of them or not.[133X198199200[1X2.2-7 [33X[0;0Y@EndAutoDoc[133X[101X201202[33X[0;0YEnds the affect of [10X@BeginAutoDoc[110X. So from here on, again only declarations203with an explicit [5XAutoDoc[105X comment in front are added to the manual.[133X204205[4X[32X[104X206[4X#! @BeginAutoDoc[104X207[4X[104X208[4XDeclareOperation( "Operation1", [ IsList ] );[104X209[4X[104X210[4XDeclareProperty( "IsProperty", IsList );[104X211[4X[104X212[4X#! @EndAutoDoc[104X213[4X[32X[104X214215[33X[0;0YBoth, [10XOperation1[110X and [10XIsProperty[110X would appear in the manual.[133X216217218[1X2.2-8 [33X[0;0Y@BeginGroup [3X[grpname][103X[101X[1X[133X[101X219220[33X[0;0YStarts a group. All following documented declarations without an explicit221[10X@Group[110X command are grouped together in the same group with the given name.222If no name is given, then a new nameless group is generated. The effect of223this command is ended when an [10X@EndGroup[110X command is reached.[133X224225[33X[0;0YSee section [14X2.5[114X for more information about groups.[133X226227228[1X2.2-9 [33X[0;0Y@EndGroup[133X[101X229230[33X[0;0YEnds the current group.[133X231232[4X[32X[104X233[4X#! @BeginGroup MyGroup[104X234[4X#![104X235[4XDeclareAttribute( "GroupedAttribute",[104X236[4X IsList );[104X237[4X[104X238[4XDeclareOperation( "NonGroupedOperation",[104X239[4X [ IsObject ] );[104X240[4X[104X241[4X#![104X242[4XDeclareOperation( "GroupedOperation",[104X243[4X [ IsList, IsRubbish ] );[104X244[4X#! @EndGroup[104X245[4X[32X[104X246247248[1X2.2-10 [33X[0;0Y@Level [3Xlvl[103X[101X[1X[133X[101X249250[33X[0;0YSets the current level of the documentation. All items created after this,251chapters, sections, and items, are given the level [3Xlvl[103X, until the252[10X@ResetLevel[110X command resets the level to 0 or another level is set.[133X253254[33X[0;0YSee section [14X2.6[114X for more information about groups.[133X255256257[1X2.2-11 [33X[0;0Y@ResetLevel[133X[101X258259[33X[0;0YResets the current level to 0.[133X260261262[1X2.2-12 [33X[0;0Y@BeginExample and @EndExample[133X[101X263264[33X[0;0Y@BeginExample inserts an example into the manual. The syntax for examples is265different from GAPDocs example syntax in order to have a file that contains266the example and is GAP readable. To achieve this, GAP commands are not267preceded by a comment, while output has to be preceded by an [5XAutoDoc[105X268comment. The GAP prompt for the display in the manual is added by AutoDoc.269@EndExample ends the example block.[133X270271[4X[32X[104X272[4X#! @BeginExample[104X273[4XS5 := SymmetricGroup(5);[104X274[4X#! Sym( [ 1 .. 5 ] )[104X275[4XOrder(S5);[104X276[4X#! 120[104X277[4X#! @EndExample[104X278[4X[32X[104X279280281[1X2.2-13 [33X[0;0Y@ExampleSession and @EndExampleSession[133X[101X282283[33X[0;0Y@ExampleSession inserts an example into the manual, but in a different284syntax. For example, consider[133X285286[4X[32X[104X287[4X#! @BeginExample[104X288[4XS5 := SymmetricGroup(5);[104X289[4X#! Sym( [ 1 .. 5 ] )[104X290[4XOrder(S5);[104X291[4X#! 120[104X292[4X#! @EndExample[104X293[4X[32X[104X294295[33X[0;0YAs you can see, the commands are not commented and hence are executed when296the file containing the example block is read. To insert examples directly297into source code files, one can instead use @ExampleSession:[133X298299[4X[32X[104X300[4X#! @ExampleSession[104X301[4X#! gap> S5 := SymmetricGroup(5);[104X302[4X#! Sym( [ 1 .. 5 ] )[104X303[4X#! gap> Order(S5);[104X304[4X#! 120[104X305[4X#! @EndExampleSession[104X306[4X[32X[104X307308[33X[0;0YIt inserts an example into the manual just as @Example would do, but all309lines are commented and therefore not executed when the file is read.[133X310311312[1X2.2-14 [33X[0;0Y@BeginLog and @EndLog[133X[101X313314[33X[0;0YWorks just like the @BeginExample command, but the example will not be315tested. See the GAPDoc manual for more information.[133X316317318[1X2.2-15 [33X[0;0Y@BeginLogSession and @EndLogSession[133X[101X319320[33X[0;0YWorks just like the @BeginExampleSession command, but the example will not321be tested if manual examples are run. See the GAPDoc manual for more322information.[133X323324325[1X2.2-16 [33X[0;0Y@DoNotReadRestOfFile[133X[101X326327[33X[0;0YPrevents the rest of the file from being read by the parser. Useful for not328finished or temporary files.[133X329330[4X[32X[104X331[4X#! This will appear in the manual[104X332[4X[104X333[4X#! @DoNotReadRestOfFile[104X334[4X[104X335[4X#! This will not appear in the manual.[104X336[4X[32X[104X337338339[1X2.2-17 [33X[0;0Y@BeginChunk [3Xname[103X[101X[1X, @EndChunk, and @InsertChunk [3Xname[103X[101X[1X[133X[101X340341[33X[0;0YText insider of a @BeginChunk / @EndChunk part will not be inserted into the342final documentation directly. Instead, the text is stored in an internal343buffer. That chunk of text can then later on be inserted in any other place344by using the @InsertChunk [3Xname[103X command. If you do not provide an @EndChunk,345the chunk ends at the end of the file.[133X346347[4X[32X[104X348[4X#! @BeginChunk MyChunk[104X349[4X#! Hello, world.[104X350[4X#! @EndChunk[104X351[4X[104X352[4X#! @InsertChunk MyChunk[104X353[4X## The text "Hello, world." is inserted right before this.[104X354[4X[32X[104X355356[33X[0;0YYou can use this to define an example like this in one file:[133X357358[4X[32X[104X359[4X#! @BeginChunk Example_Symmetric_Group[104X360[4X#! @BeginExample[104X361[4XS5 := SymmetricGroup(5);[104X362[4X#! Sym( [ 1 .. 5 ] )[104X363[4XOrder(S5);[104X364[4X#! 120[104X365[4X#! @EndExample[104X366[4X#! @EndChunk[104X367[4X[32X[104X368369[33X[0;0YAnd then later, insert the example in a different file, like this:[133X370371[4X[32X[104X372[4X#! @InsertChunk Example_Symmetric_Group[104X373[4X[32X[104X374375376[1X2.2-18 [33X[0;0Y@BeginSystem [3Xname[103X[101X[1X, @EndSystem, and @InsertSystem [3Xname[103X[101X[1X[133X[101X377378[33X[0;0YSame as @BeginChunk etc. This command is deprecated. Please use chunk379instead.[133X380381382[1X2.2-19 [33X[0;0Y@BeginCode [3Xname[103X[101X[1X, @EndCode, and @InsertCode [3Xname[103X[101X[1X[133X[101X383384[33X[0;0YInserts the text between @BeginCode and @EndCode verbatim at the point where385@InsertCode is called. This is useful to insert code excerpts directly into386the manual.[133X387388[4X[32X[104X389[4X#! @BeginCode Increment[104X390[4Xi := i + 1;[104X391[4X#! @EndCode[104X392[4X[104X393[4X#! @InsertCode Increment[104X394[4X## Code is inserted here.[104X395[4X[32X[104X396397398[1X2.2-20 [33X[0;0Y@LatexOnly [3Xtext[103X[101X[1X, @BeginLatexOnly , and @EndLatexOnly[133X[101X399400[33X[0;0YCode inserted between @BeginLatexOnly and @EndLatexOnly or after @LatexOnly401is only inserted in the PDF version of the manual or worksheet. It can hold402arbitrary LaTeX-commands.[133X403404[4X[32X[104X405[4X#! @BeginLatexOnly[104X406[4X#! \include{picture.tex}[104X407[4X#! @EndLatexOnly[104X408[4X[104X409[4X#! @LatexOnly \include{picture.tex}[104X410[4X[32X[104X411412413[1X2.3 [33X[0;0YTitle page commands[133X[101X414415[33X[0;0YThe following commands can be used to add the corresponding parts to the416title page of the document, in case the scaffolding is enabled.[133X417418[30X [33X[0;6Y@Title[133X419420[30X [33X[0;6Y@Subtitle[133X421422[30X [33X[0;6Y@Version[133X423424[30X [33X[0;6Y@TitleComment[133X425426[30X [33X[0;6Y@Author[133X427428[30X [33X[0;6Y@Date[133X429430[30X [33X[0;6Y@Address[133X431432[30X [33X[0;6Y@Abstract[133X433434[30X [33X[0;6Y@Copyright[133X435436[30X [33X[0;6Y@Acknowledgements[133X437438[30X [33X[0;6Y@Colophon[133X439440[33X[0;0YThose add the following lines at the corresponding point of the title page.441Please note that many of those things can be (better) extracted from the442PackageInfo.g. In case you set some of those, the extracted or in scaffold443defined items will be overwritten. While this is not very useful for444documenting packages, they are necessary for worksheets created with445[2XAutoDocWorksheet[102X ([14X3.1-1[114X), since they do not have a PackageInfo to extract446those information.[133X447448449[1X2.4 [33X[0;0YPlain text files[133X[101X450451[33X[0;0YAutoDoc plain text files work exactly like AutoDoc comments, except that the452#! is unnecessary at the beginning of a line which should be documented.453Files that have the suffix .autodoc will automatically regarded as plain454text files while the commands @AutoDocPlainText and @EndAutoDocPlainText455mark parts in plain text files which should be regarded as AutoDoc parts.456All commands can be used like before.[133X457458459[1X2.5 [33X[0;0YGrouping[133X[101X460461[33X[0;0YIn [5XGAPDoc[105X, it is possible to make groups of ManItems, i.e., when documenting462a function, operation, etc., it is possible to group them into suitable463chunks. This can be particularly useful if there are several definitions of464an operation with several different argument types, all doing more or less465the same to the arguments. Then their manual items can be grouped, sharing466the same description and return type information. Note that it is currently467not possible to give a header to the Group in the manual, but the generated468ManItem heading of the first entry will be used.[133X469470[33X[0;0YNote that group names are globally unique throughout the whole manual. That471is, groups with the same name are in fact merged into a single group, even472if they were declared in different source files. Thus you can have multiple473[10X@BeginGroup[110X / [10X@EndGroup[110X pairs using the same group name, in different474places, and these all will refer to the same group.[133X475476[33X[0;0YMoreover, this means that you can add items to a group via the [10X@Group[110X477command in the [5XAutoDoc[105X comment of an arbitrary declaration, at any time. The478following code[133X479480[4X[32X[104X481[4X#! @BeginGroup Group1[104X482[4X[104X483[4X#! @Description[104X484[4X#! First sentence.[104X485[4XDeclareOperation( "FirstOperation", [ IsInt ] );[104X486[4X[104X487[4X#! @Description[104X488[4X#! Second sentence.[104X489[4XDeclareOperation( "SecondOperation", [ IsInt, IsGroup ] );[104X490[4X[104X491[4X#! @EndGroup[104X492[4X[104X493[4X## .. Stuff ..[104X494[4X[104X495[4X#! @Description[104X496[4X#! Third sentence.[104X497[4X#! @Group Group1[104X498[4XKeyDependentOperation( "ThirdOperation", IsGroup, IsInt, "prime );[104X499[4X[32X[104X500501[33X[0;0Yproduces the following:[133X502503[1X2.5-1 FirstOperation[101X504505[29X[2XFirstOperation[102X( [3Xarg[103X ) [32X operation506[29X[2XSecondOperation[102X( [3Xarg1[103X, [3Xarg2[103X ) [32X operation507[29X[2XThirdOperation[102X( [3Xarg1[103X, [3Xarg2[103X ) [32X operation508509[33X[0;0YFirst sentence. Second sentence. Third sentence.[133X510511512[1X2.6 [33X[0;0YLevel[133X[101X513514[33X[0;0YLevels can be set to not write certain parts in the manual by default. Every515entry has by default the level 0. The command [10X@Level[110X can be used to set the516level of the following part to a higher level, for example 1, and prevent it517from being printed to the manual by default. However, if one sets the level518to a higher value in the autodoc option of [10XAutoDoc[110X, the parts will be519included in the manual at the specific place.[133X520521[4X[32X[104X522[4X#! This text will be printed to the manual.[104X523[4X#! @Level 1[104X524[4X#! This text will be printed to the manual if created with level 1 or higher.[104X525[4X#! @Level 2[104X526[4X#! This text will be printed to the manual if created with level 2 or higher.[104X527[4X#! @ResetLevel[104X528[4X#! This text will be printed to the manual.[104X529[4X[32X[104X530531532[1X2.7 [33X[0;0YMarkdown-like formatting of text in [5XAutoDoc[105X[101X[1X[133X[101X533534[33X[0;0Y[5XAutoDoc[105X has some convenient ways to insert special format into text, like535math formulas and lists. The syntax for them are inspired by Markdown and536LaTeX, but do not follow them strictly. Neither are all features of the537Markdown language supported. The following subsections describe what is538possible.[133X539540541[1X2.7-1 [33X[0;0YLists[133X[101X542543[33X[0;0YOne can create lists of items by beginning a new line with *, +, -, followed544by one space. The first item starts the list. When items are longer than one545line, the following lines have to be indented by at least two spaces. The546list ends when a line which does not start a new item is not indented by two547spaces. Of course lists can be nested. Here is an example:[133X548549[4X[32X[104X550[4X#! The list starts in the next line[104X551[4X#! * item 1[104X552[4X#! * item 2[104X553[4X#! which is a bit longer[104X554[4X#! * and also contains a nested list[104X555[4X#! * with two items[104X556[4X#! * item 3 of the outer list[104X557[4X#! This does not belong to the list anymore.[104X558[4X[32X[104X559560[33X[0;0YThis is the output:[133X561[33X[0;0YThe list starts in the next line[133X562563[30X [33X[0;6Yitem 1[133X564565[30X [33X[0;6Yitem 2 which is a bit longer[133X566567[30X [33X[0;12Yand also contains a nested list[133X568569[30X [33X[0;12Ywith two items[133X570571[30X [33X[0;6Yitem 3 of the outer list[133X572573[33X[0;0YThis does not belong to the list anymore.[133X574[33X[0;0YThe *, -, and + are fully interchangeable and can even be used mixed, but575this is not recommended.[133X576577578[1X2.7-2 [33X[0;0YMath modes[133X[101X579580[33X[0;0YOne can start an inline formula with a $, and also end it with $, just like581in LaTeX. This will translate into [5XGAPDoc[105Xs inline math environment. For582display mode one can use $$, also like LaTeX.[133X583584[4X[32X[104X585[4X#! This is an inline formula: $1+1 = 2$.[104X586[4X#! This is a display formula:[104X587[4X#! $$ \sum_{i=1}^n i. $$[104X588[4X[32X[104X589590[33X[0;0Yproduces the following output:[133X591[33X[0;0YThis is an inline formula: [23X1+1 = 2[123X. This is a display formula:[133X592593594[33X[1;6Y[24X[33X[0;0Y\sum_{i=1}^n i.[133X [124X[133X595596597598[1X2.7-3 [33X[0;0YEmphasize[133X[101X599600[33X[0;0YOne can emphasize text by using two asterisks (**) or two underscores (__)601at the beginning and the end of the text which should be emphasized.602Example:[133X603604[4X[32X[104X605[4X#! **This** is very important.[104X606[4X#! This is __also important__.[104X607[4X#! **Naturally, more than one line[104X608[4X#! can be important.**[104X609[4X[32X[104X610611[33X[0;0YThis produces the following output:[133X612[33X[0;0Y[13XThis[113X is very important. This is [13Xalso important[113X. [13XNaturally, more than one613line can be important.[113X[133X614615616617