diff options
Diffstat (limited to 'macros/luatex/optex/base/parameters.opm')
-rw-r--r-- | macros/luatex/optex/base/parameters.opm | 542 |
1 files changed, 542 insertions, 0 deletions
diff --git a/macros/luatex/optex/base/parameters.opm b/macros/luatex/optex/base/parameters.opm new file mode 100644 index 0000000000..8a707b4758 --- /dev/null +++ b/macros/luatex/optex/base/parameters.opm @@ -0,0 +1,542 @@ +%% This is part of OpTeX project, see http://petr.olsak.net/optex + +\_codedecl \normalbaselineskip {Parameter settings <2020-03-17>} % preloaded in format + + \_doc ----------------------------- + \secc Primitive registers + The primitive registers with the same default value as in plain \TeX/ follow: + \_cod ----------------------------- + +\_parindent=20pt % indentation of paragraphs +\_pretolerance=100 % parameters used in paragraph breaking algorithm +\_tolerance=200 +\_hbadness=1000 +\_vbadness=1000 +\_doublehyphendemerits=10000 +\_finalhyphendemerits=5000 +\_adjdemerits=10000 +\_uchyph=1 +\_defaulthyphenchar=`\- +\_defaultskewchar=-1 +\_hfuzz=0.1pt +\_vfuzz=0.1pt +\_overfullrule=5pt +\_linepenalty=10 % penalty between lines inside the paragraph +\_hyphenpenalty=50 % when a word is bro-ken +\_exhyphenpenalty=50 % when the hyphenmark is used explicitly +\_binoppenalty=700 % between binary operators in math +\_relpenalty=500 % between relations in math +\_brokenpenalty=100 % after lines if they end by a broken word. +\_displaywidowpenalty=50 % before last line of paragraph if display math follows +\_predisplaypenalty=10000 % above display math +\_postdisplaypenalty=0 % below display math +\_delimiterfactor=901 % parameter for scaling delimiters +\_delimitershortfall=5pt +\_nulldelimiterspace=1.2pt +\_scriptspace=0.5pt +\_maxdepth=4pt +\_splitmaxdepth=\_maxdimen +\_boxmaxdepth=\_maxdimen +\_parskip=0pt plus 1pt +\_abovedisplayskip=12pt plus 3pt minus 9pt +\_abovedisplayshortskip=0pt plus 3pt +\_belowdisplayskip=12pt plus 3pt minus 9pt +\_belowdisplayshortskip=7pt plus 3pt minus 4pt +\_parfillskip=0pt plus 1fil +\_thinmuskip=3mu +\_medmuskip=4mu plus 2mu minus 4mu +\_thickmuskip=5mu plus 5mu + + \_doc ----------------------------- + Note that `\topskip` and `\splittopskip` are changed when first + `\typosize` sets the main values (default font size and default + `\baselineskip`). + \_cod ----------------------------- + +\_topskip=10pt % top edge of page-box to first baseline distance +\_splittopskip=10pt + + \_doc ----------------------------- + \secc Plain \TeX/ registers + Declared registers used in plain \TeX/ + \_cod ----------------------------- + +% We also define special registers that function like parameters: +\_newskip\_smallskipamount \_smallskipamount=3pt plus 1pt minus 1pt +\_newskip\_medskipamount \_medskipamount=6pt plus 2pt minus 2pt +\_newskip\_bigskipamount \_bigskipamount=12pt plus 4pt minus 4pt +\_newskip\_normalbaselineskip \_normalbaselineskip=12pt +\_newskip\_normallineskip \_normallineskip=1pt +\_newdimen\_normallineskiplimit \_normallineskiplimit=0pt +\_newdimen\_jot \_jot=3pt +\_newcount\_interdisplaylinepenalty \_interdisplaylinepenalty=100 +\_newcount\_interfootnotelinepenalty \_interfootnotelinepenalty=100 + +\_def\_normalbaselines{\_lineskip=\_normallineskip + \_baselineskip=\_normalbaselineskip \_lineskiplimit=\_normallineskiplimit} + +\_def\_frenchspacing{\_sfcode`\.=1000 \_sfcode`\?=1000 \_sfcode`\!=1000 + \_sfcode`\:=1000 \_sfcode`\;=1000 \_sfcode`\,=1000 } +\_def\_nonfrenchspacing{\_sfcode`\.=3000 \_sfcode`\?=3000 \_sfcode`\!=3000 + \_sfcode`\:=2000 \_sfcode`\;=1500 \_sfcode`\,=1250 } + +\_public \normalbaselines \frenchspacing \nonfrenchspacing + \smallskipamount \medskipamount \bigskipamount + \normalbaselineskip \normallineskip \normallineskiplimit + \jot \interdisplaylinepenalty \interfootnotelinepenalty ; + + \_doc ----------------------------- + \secc Different settings than in plain \TeX/ + + Default \"baseline setting" is for 10\,pt fonts (like in plain \TeX/). + But `\typosize` and `\typoscale` macros re-declare it if another font size is used. + + The \`\nonfrenchspacing` is not set by default because + the author of \OpTeX/ is living in the Europe. + If you set `\enlang` hyphenation patterns then `\nonfrenchspacing` + is set. + \_cod ----------------------------- + +\_normalbaselines % baseline setting, 10 pt font size + + \_doc ----------------------------- + Different values than in plain \TeX/ have following primitive registers. + We prohibit orphans, set more information for tracing boxes, set page origin + to upper left corner of the paper (no at 1\,in, 1\,in coordinates) + and set default page dimensions as A4, no letter. + \_cod ----------------------------- + +\_emergencystretch=20pt % we want to use third pass of aparagraph building algoritmh + % we need not to keep the compatibility with old documents + +\_clubpenalty=10000 % after first line of paragraph +\_widowpenalty=10000 % before last line of paragraph + +\_showboxbreadth=150 % for tracing boxes +\_showboxdepth=7 +\_errorcontextlines=15 +\_tracinglostchars=2 % missing chracter warnings on terminal too + +\_outputmode=1 % PDF ouput +\_pdfvorigin=0pt % orgin is exatly at left upper corner +\_pdfhorigin=0pt +\_hoffset=25mm % margins are 2.5cm, no 1in +\_voffset=25mm +\_hsize=160mm % 210mm (from A4 size) - 2*25mm (default margins) +\_vsize=244mm % 297mm (from A4 size) - 2*25mm (default margins) -3mm baseline correction +\_pagewidth=210 true mm +\_pageheight=297 true mm + + \_doc ----------------------------- + If you insist on plain \TeX/ values of these parameters then you can + call the `\plaintexsetting` macro. + \_cod ----------------------------- + +\_def\_plaintexsetting{% + \_emergencystretch=0pt + \_clubpenalty=150 + \_widowpenalty=150 + \_pdfvorigin=1in + \_pdfhorigin=1in + \_hoffset=0pt + \_voffset=0pt + \_hsize=6.5in + \_vsize=8.9in + \_pagewidth=8.5 true in + \_pageheight=11 true in + \_nonfrenchspacing +} +\_public \plaintexsetting ; + + \_doc ----------------------------- + \secc \OpTeX/ parameters + + The main principle how to configure \OpTeX/ is not to use only parameters. + A designer can copy macros from \OpTeX/ and re-define them as required. + This is a reason why we don't implement dozens of parameters, + but we keep \OpTeX/ macros relatively simple. Example: do you want + another design of section titles? Copy macros `\_printsec` and + `\_printsecc` from `sections.opm` file to your macro file and re-define them. + + Notice for OPmac users: there is important difference: all "string-like" + parameters are token lists in \OpTeX/ (OPmac uses macros for them). The reason of + this difference: if user sets parameter by unprotected control sequence, + an \OpTeX/ macro can read {\em the same data} using protected control sequence. + If user re-defines such unprotected control sequence (because he/she does + know about it) then nothing bad happens. + + The \`\picdir` tokens list can include a directory where image files + (loaded by `\inspic`) are saved. Empty `\picdir` (default value) means + that image files are in the current directory (or somewhere in the \TeX/ + system where \LuaTeX/ is able to find them). If you set non-empty value to + the `\picdir`, then it must end by `/` character, for example + `\picdir={img/}` means that there exists a directory `img` in your + current directory and the image files are stored here. + \_cod ----------------------------- + +\_newtoks\_picdir +\_public \picdir ; + + \_doc ----------------------------- + You can control the dimesions of included images by + the parameters \`\picwidth` (which is equivalent to \`\picw`) and + \`\picheight`. By default these parameters are set to zero: the native + dimension of the image is used. If only `\picwidth` has a nonzero value, + then this is the width of the image (height is calculated automatically in + order to respect the aspect of the image). If only `\picheight` has + a nonzero value then height is given, width is calculated. If both + parameters are non-zero, the height and width are given and the aspect + ratio of the image is (probably) broken. We recommend to set these + parameters locally in the group where `\inspic` is used in order to not + influence the dimensions of another images. But there exist many + situations you need to put the same dimensions to more images, + so you can set this parameter only once before more `\inspic` macros. + \_cod ----------------------------- + +\_newdimen\_picwidth \_picwidth=0pt \_let\picw=\_picwidth +\_newdimen\_picheight \_picheight=0pt +\_public \picwidth \picheight ; + + \_doc ----------------------------- + The \`\everytt` is token list used in + `\begtt`...`\endtt` environment and + in the verbatim group opened by `\verbinput` macro. You can include a + code which is processed inside the group after basic settings were done + On the other hand, it is processed before scanner of verbatim text is started. + Your macros should influence scanner (catcode settings) or printing + process of the verbatim code or both. + + The code from the line immediately after `\begtt` is processed after + the `\everytt`. This code should overwrite `\everytt` settings. Use + `\everytt` for all verbatim environments in your document and use a code + after `\begtt` locally only for this environment. + + The \`\everyintt` token list does similar work + but acts in the in-line verbatim + text processed by a pair of `\activettchar` characters or by `\code{<text>}`. + You can set `\everyintt={\Red}` for example if you want in-line verbatim + in red color. + \_cod ----------------------------- + +\_newtoks\_everytt +\_newtoks\_everyintt +\_public \everytt \everyintt ; + + \_doc ----------------------------- + The \`\ttline` is used + in `\begtt`...`\endtt` environment or in the code + printed by `\verbinput`. If `\ttline` is positive or zero, then the + verbatim code have numbered lines from `\ttline+1`. The `\ttline` + register is re-set to new value after a code piece is printed, so next + code pieces have numbered lines continuously. If `\ttline=-1`, then + `\begtt`...`\endtt` lines are without numbers and `\verbinput` lines + shows the line numbers of inputted file. If `\ttline`\code{<-1} + then no line numbers are printed. + \_cod ----------------------------- + +\_newcount\_ttline \_ttline=-1 % last line number in \begtt...\endtt +\_public \ttline ; + + \_doc ----------------------------- + The \`\ttindent` gives default indentation + of verbatim lines printed by `\begtt`...`\endtt` pair or by + `\verbinput`. + \nl + The \`\ttshift` gives the amount of shift of all verbatim lines to right. + Despite to the \^`\ttindent`, it does not shift the line numbers, only + the text. + \nl + The \`\iindent` gives default indentations used in table of contents, + captions, lists, bib references, + \nl + It is strongly recommended to re-set this value if you set `\parindent` + to another value than plain \TeX/ default 20pt. A well typeset + document should have the same dimension for all indentations, so + you should say `\ttindent=\parindent` and `\iindent=\parindent`. + \_cod ----------------------------- + +\_newdimen\_ttindent \_ttindent=\_parindent % indentation in verbatim +\_newdimen\_ttshift +\_newdimen\_iindent \_iindent=\_parindent +\_public \ttindent \ttshift \iindent ; + + \_doc ----------------------------- + The tabelator `^^I` has its category code like space: it behaves as a + space in normal text. This is normal plain \TeX/ setting. + But in the multiline verbatim environment it + is active and expands to the `\hskip<dimen>` where `<dimen>` + is the width of \`\tabspaces` spaces. + Default `\tabspaces=3` means + that tabelator behaves like three spaces in multiline verbatim. + \_cod ----------------------------- + +\_newcount \_tabspaces \_tabspaces=3 +\_public \tabspaces ; + + \_doc ----------------------------- + If \`\hicolors` is non-empty then its contents is used instead + `\_hicolors<name>` declared in the file `hisyntax-<name>.opm`. + The user can give his/her preferences about colors for + syntax highlighting by this tokens list. + Full color set must be declared here. + \_cod ----------------------------- + +\_newtoks\_hicolors +\_public \hicolors ; + + \_doc ----------------------------- + The default item mark used between `\begitems` and `\enditems` is bullet. + The \`\defaultitem` tokens list declare this default item mark. + \nl + The \`\everyitem` tokens list is applied in vertical mode + at the start of each item. + \nl + The \`\everylist` tokens list is applied after group is opened by + \nl + The \`\ilevel` keeps the value of current nesting level of the items list. + \nl + The \`\listskipamount` gives vertical skip above and below the items list + if `\ilevel=1`. + \_cod ----------------------------- + +\_newtoks\_defaultitem \_defaultitem={$\_bullet$\_enspace} +\_newtoks\_everyitem +\_newtoks\_everylist +\_newskip \_listskipamount \_listskipamount=\_medskipamount +\_newcount \_ilevel +\_public \defaultitem \everyitem \everylist \listskipamount \ilevel ; + + \_doc ----------------------------- + The `\tit` macro includes `\vglue`\`\titskip` above the title of the document. + \_cod ----------------------------- + +\_newskip\_titskip \_titskip=40pt \_relax % \vglue above title printed by \tit +\_public \titskip ; + + \_doc ---------------------------- + The `\begmulti` `\endmulti` pair creates more columns. The parameter + \`\colsep` declares the space between columns. If $n$ columns are specified + then we have $n-1$ `\colseps` and $n$ columns in total `\hsize`. This + gives definite result of columns width. + \_cod ---------------------------- + +\_newdimen\_colsep \_colsep=20pt % space between columns +\_public \colsep ; + + \_doc ----------------------------- + Each line in the Table of contents is printed in a group. + The \`\everytocline` tokens list is processed here before + the internal `\_tocl:<num>` macro which starts printing the line. + \_cod ----------------------------- + +\_newtoks \_everytocline +\_public \everytocline ; + + \_doc ----------------------------- + The \`\bibtexhook` tokens list is used inside the group when `\usebib` command is + processed after style file is loaded and before printing bib-entries. + You can re-define a behavior of style file here or you can modify the + more declaration for printing (fonts, baselineskip, etc.) or you can + define a specific macros used in your `.bib` file. + \_cod ----------------------------- + +\_newtoks\_bibtexhook +\_public \bibtexhook ; + +\_newtoks\_everycaptiont \_newtoks\_everycaptionf +\_public \everycaptiont \everycaptionf ; + + \_doc ----------------------------- + The \`\everyii` tokens list is used before `\noindent` for each + Index item when printing the Index. + \_cod ----------------------------- + +\_newtoks\_everyii +\_public \everyii ; + + \_doc ----------------------------- + The \`\everymnote` is used in the `\mnote` group before `\noindent` which + immediately precedes marginal note text. + \nl + The \`\mnotesize` is horizontal size of the marginal notes. + \nl + The \`\mnoteindent` is horizontal space between body-text and marginal note. + \nl + The \`\mnoteskip` is a dimen which denotes the vertical shift of marginal + note from its normal position. Positive value means shift up, negative + down. The `\mnoteskip` register is set to zero + after the marginal note is printed. + Use it as an exception of marginal note position if the marginal + notes overlaps or they are put at bottom of the page. + \_cod ----------------------------- + +\_newtoks\_everymnote +\_newdimen\_mnotesize \_mnotesize=20mm % the width of the mnote paragraph +\_newdimen\_mnoteindent \_mnoteindent=10pt % ditance between mnote and text +\_newdimen\_mnoteskip +\_public \everymnote \mnotesize \mnoteindent \mnoteskip ; + + \_doc ----------------------------- + The `\table` parameters follows. The \`\thistable` tokens list + register should be used for giving an exception for only one `\table` + which follows. It should change locally other parameters of the `\table`. + It is reset to empty list after the table is printed. + \nl + The \`\everytable` tokens list register is applied in every table. + There is another difference between these two registers. + The `\thistable` is used first, then strut and baselineskip settings are + done, then `\everytable` is applied and then the table is printed. + \nl + \`\tabstrut` configures the height and depth of lines in the table. + You can declare `\tabstrut={}`, then normal baselineskip is used in the + table. This can be used when you don't use horizontal nor vertical + lines in tables. + \nl + \`\tabiteml` is applied before each item, + \`\tabitemr` is applied after each item of the table. + \nl + \`\tablinespace` is additional vertical space between horizontal rules + and the lines of the table. + \nl + \`\hhkern` gives the space between horizontal lines if they are doubled and + \`\vvkern` gives the space between such vertical lines. + \_cod ----------------------------- + +\_newtoks\_everytable \_newtoks\_thistable +\_newtoks\_tabiteml \_newtoks\_tabitemr \_newtoks\_tabstrut +\_newdimen\_tablinespace \_newdimen\_vvkern \_newdimen\_hhkern +\_everytable={} % code used after settings in \vbox before table processing +\_thistable={} % code used when \vbox starts, is is removed after using it +\_tabstrut={\_strut} +\_tabiteml={\_enspace} % left material in each column +\_tabitemr={\_enspace} % right material in each column +\_tablinespace=2pt % additional vertical space before/after horizontal rules +\_vvkern=1pt % space between double vertical line and used in \frame +\_hhkern=1pt % space between double horizontal line and used in \frame +\_public \everytable \thistable \tabiteml \tabitemr \tabstrut \tablinespace \vvkern \hhkern ; + + \_doc ----------------------------- + The output routine uses token list \`\headline` and \`\footline` in the + same sense as in plain \TeX/. If they are non-empty then `\hfil` or `\hss` + must be here because they are used inside `\hbox to\hsize`. + + Assume that page-body text can be typeset in different sizes and + different fonts and we don't know in what font context the output routine + is invoked. So, it is strongly recommended to declare fixed variants of + fonts at begining of your document. For example `\fontdef\rmfixed{\rm}`, + `\fontdef\itfixed{\it}`. Then use them in headline and footline: + \begtt + \headline={\itfixed Text of headline, section: \fistmark \hss} + \footline={\rmfixed \ifodd\pageno \hfill\fi \folio \hfil} + \endtt + \_cod ----------------------------- + +\_newtoks\_headline \_headline={} +\_newtoks\_footline \_footline={\_hss\_rmfixed \_folio \_hss} +\_public \headline \footline ; + + \_doc ----------------------------- + The distance between the `\headline` and the top of the page-text + is controlled by the \`\headlinedist` register. + The distance between bottom of + page-text and `\footline` is \`\footlinedist`. + More precisely: baseline of + headline and baseline of first line in page-text have distance + `\headlinedist+\topskip`. The baseline of the last line in page-text and + the baseline of the footline have distance `\footlinedist`. + Default values are inspired from plain \TeX/. + \_cod ----------------------------- + +\_newdimen \_headlinedist \_headlinedist=14pt +\_newdimen \_footlinedist \_footlinedist=24pt +\_public \headlinedist \footlinedist ; + + \_doc ----------------------------- + The \`\pgbottomskip` is inserted to the page bottom + in the output routine. You can set a less tolerance here than + `\raggedbotom` does. By default, no tolerance is given. + \_cod ----------------------------- + +\_newskip \_pgbottomskip \_pgbottomskip=0pt \_relax +\_public \pgbottomskip ; + + \_doc ----------------------------- + The \`\nextpages` tokens list can include settings which will be used at + next pages. It is processed at the end of output routine with + `\globaldefs=1` prefix. The `\nextpages` is reset to empty after + processing. Example of usage: + \begtt + \headline={} \nexptages={\headline={\fixedrm \firstmark \hfil}} + \endtt + This example sets current page with empty headline, but next pages have + non-empty headlines. + \_cod ----------------------------- + +\_newtoks \_nextpages +\_public \nextpages ; + + \_doc ----------------------------- + The \`\pgbackground` token list can include macros which generate a + vertical list. It is used as page background. The top-left corner of such + `\vbox` is at the top-left corner of the paper. Example creates the + background of all pages yellow: + \begtt + \pgbackground={\Yellow \hrule height 0pt depth\pdfpageheight width\pdfpagewidth} + \endtt + \_cod ----------------------------- + +\_newtoks \_pgbackground \_pgbackground={} % for page background +\_public \pgbackground ; + + \_doc ----------------------------- + The parameters used in `\inoval` and `\incircle` macros. + The default values (documented in user manual) are set in the macros. + The user can re-set these values using tokens \`\ovalparams`, \`\circleparams`. + \_cod ----------------------------- + +\_newtoks \_ovalparams +\_newtoks \_circleparams +%\_ovalparams={\_roundness=2pt \_fcolor=\Yellow \_lcolor=\Red \_lwidth=.5bp +% \_shadow=N \_overlapmargins=N \_hhkern=0pt \_vvkern=0pt } +%\_circleparams={\_ratio=1 \_fcolor=\Yellow \_lcolor=\Red \_lwidth=.5bp +% \_shadow=N \_overlapmargins=N \_hhkern=3pt \_vvkern=3pt} + +\_newdimen \_roundness \_roundness=5mm % used in \clippingoval macro + +\_public \ovalparams \circleparams \roundness ; + + +\_endcode %---------------------------------------------------- + +The behavior of document processing by \OpTeX/ is +controlled by {\em parameters}. The parameters are +\begitems +* primitive registers used in build-in algorithms of \TeX/, +* registers declared and used by \OpTeX/ macros. +\enditems +Both groups of registers have their type: number, dimension, skip, token +list. + +The registers are represented by their names (control sequences). If the user +re-defines such control sequence then the appropriate register exists +steadily and build-in algorithms are using it without change. But user +cannot access its value in such case. \OpTeX/ declares two control sequences +for each register: prefixed and unprefixed. \OpTeX/ macros use only +prefixed variants of control sequences. The user should use unprefixed variant +with the same meaning and set or read values of registers using the +unprefixed variant. If the user re-defines the unprefixed control sequence of +a register then \OpTeX/ macros still work without change. + +%There is only few parameters declared by \OpTeX/ macros. All of them +%are listed in this section. This is desired feature of the \OpTeX/. +%If you want to do more +%changes wich cannot be controlled by parameters listed here then you +%can copy the appropriate \OpTeX/ macro to your macro file and you +%can completely re-define it. The typical examples are `\_printsomething` +%macros which declares the design of the document. + +\_endinput + +History: +2020-04-04 ... \tabspaces added +2020-04-03 ... \hicolors added |