| 1 |
%% This is part of the OpTeX project, see http://petr.olsak.net/optex |
| 2 |
|
| 3 |
%% OpTeX ini file |
| 4 |
%% Petr Olsak <project started from: Jan. 2020> |
| 5 |
|
| 6 |
% Catcodes: |
| 7 |
|
| 8 |
\catcode `\{=1 % left brace is begin-group character |
| 9 |
\catcode `\}=2 % right brace is end-group character |
| 10 |
\catcode `\$=3 % dollar sign is math shift |
| 11 |
\catcode `\&=4 % ampersand is alignment tab |
| 12 |
\catcode `\#=6 % hash mark is macro parameter character |
| 13 |
\catcode `\^=7 % |
| 14 |
\catcode `\^^K=7 % circumflex and uparrow are for superscripts |
| 15 |
\catcode `\^^A=8 % downarrow is for subscripts |
| 16 |
\catcode `\^^I=10 % ascii tab is a blank space |
| 17 |
\catcode `\_=11 % underline can be used in control sequences |
| 18 |
\catcode `\~=13 % tilde is active |
| 19 |
\catcode `\^^a0=13 % non breaking space in Unicode |
| 20 |
\catcode 127=12 % normal character |
| 21 |
|
| 22 |
% OpTeX version |
| 23 |
|
| 24 |
\def\optexversion{1.20 May 2026} |
| 25 |
\def\fmtname{OpTeX} |
| 26 |
\let\fmtversion=\optexversion |
| 27 |
|
| 28 |
% Engine testing: |
| 29 |
|
| 30 |
\newlinechar=`\^^J |
| 31 |
\ifx\directlua\undefined |
| 32 |
\message{This format is based only on LuaTeX, use luatex -ini optex.ini^^J} |
| 33 |
\endinput \fi |
| 34 |
|
| 35 |
\ifx\bgroup\undefined \else |
| 36 |
\message{This file can be used only for format initialisation, use luatex -ini^^J} |
| 37 |
\endinput \fi |
| 38 |
|
| 39 |
% Basic .opm syntax: |
| 40 |
|
| 41 |
\let\_endcode =\endinput |
| 42 |
\def \_codedecl #1#2{\immediate\write-1{#2}}% information about .opm file |
| 43 |
\long\def\_doc#1\_cod#2 {} % skip documentation |
| 44 |
|
| 45 |
% Initialization: |
| 46 |
|
| 47 |
\message{OpTeX (Olsak's Plain TeX) initialization <\optexversion>^^J} |
| 48 |
|
| 49 |
\input prefixed.opm % prefixed primitives and code syntax |
| 50 |
\input luatex-ini.opm % LuaTeX initialization |
| 51 |
\input basic-macros.opm % basic macros |
| 52 |
\input alloc.opm % allocators for registers |
| 53 |
\input if-macros.opm % special \if-macros, \is-macros and loops |
| 54 |
\input parameters.opm % parameters setting |
| 55 |
\input more-macros.opm % OpTeX useful macros (todo: doc) |
| 56 |
\input keyval.opm % key=value dictionaries |
| 57 |
\input plain-macros.opm % plainTeX macros |
| 58 |
\input fonts-preload.opm % preloaded Latin Modern fonts |
| 59 |
\input fonts-resize.opm % font resizing (low-level macros) |
| 60 |
\input fonts-select.opm % font selection system |
| 61 |
\input math-preload.opm % math fams CM + AMS preloaded |
| 62 |
\input math-macros.opm % basic macros for math plus mathchardefs |
| 63 |
\input unimath-macros.opm % macros for loading UnicodeMath fonts |
| 64 |
\input fonts-opmac.opm % font managing macros from OPmac |
| 65 |
\input output.opm % output routine |
| 66 |
\input margins.opm % macros for margins setting |
| 67 |
\input colors.opm % colors |
| 68 |
\input ref-file.opm % ref file |
| 69 |
\input references.opm % references |
| 70 |
\input hyperlinks.opm % hyperlinks |
| 71 |
\input maketoc.opm % maketoc |
| 72 |
\input outlines.opm % PDF outlines |
| 73 |
\input pdfuni-string.opm % PDFunicode strings for outlines |
| 74 |
\input sections.opm % titles, chapters, sections |
| 75 |
\input lists.opm % lists, \begitems, \enditems |
| 76 |
\input verbatim.opm % verbatim |
| 77 |
\input hi-syntax.opm % syntax highlighting of verbatim listings |
| 78 |
\input graphics.opm % graphics |
| 79 |
\input table.opm % table macro |
| 80 |
\input multicolumns.opm % more columns by \begmulti ...\endmulti |
| 81 |
\input cite-bib.opm % Bibliography, \cite |
| 82 |
\input makeindex.opm % Make index and sorting |
| 83 |
\input fnotes.opm % \fnotes, \mnotes |
| 84 |
\input styles.opm % styles \report, \letter |
| 85 |
\input logos.opm % standard logos |
| 86 |
\input uni-lcuc.opm % Setting lccodes and uccodes for Unicode characters |
| 87 |
\input languages.opm % Languages macros |
| 88 |
\input lang-decl.opm % Languages declaration |
| 89 |
\input others.opm % miscellaneous |
| 90 |
|
| 91 |
\_directlua{ |
| 92 |
% preload OpTeX's Lua code into format as bytecode |
| 93 |
lua.bytecode[1] = assert(loadfile(kpse.find_file("optex", "lua"))) |
| 94 |
} |
| 95 |
|
| 96 |
\_everyjob = {% |
| 97 |
\_message{\_banner^^J}% |
| 98 |
\_directlua{lua.bytecode[1]()}% load OpTeX's Lua code |
| 99 |
\_mathsbon % replaces \int_a^b to \int _a^b |
| 100 |
\_inputref % inputs \jobname.ref if exists |
| 101 |
} |
| 102 |
|
| 103 |
\dump % You can redefine \dump if additional macros are needed. Example: |
| 104 |
% \let\dump=\relax \input optex.ini \input mymacros \_dump |
| 105 |
|
| 106 |
\_endcode % ------------------------------ |
| 107 |
|