%% This is part of the OpTeX project, see http://petr.olsak.net/optex

%% OpTeX ini file
%% Petr Olsak <project started from: Jan. 2020>

% Catcodes:

\catcode `\{=1 % left brace is begin-group character
\catcode `\}=2 % right brace is end-group character
\catcode `\$=3 % dollar sign is math shift
\catcode `\&=4 % ampersand is alignment tab
\catcode `\#=6 % hash mark is macro parameter character
\catcode `\^=7 % 
\catcode `\^^K=7 % circumflex and uparrow are for superscripts
\catcode `\^^A=8 % downarrow is for subscripts
\catcode `\^^I=10 % ascii tab is a blank space
\catcode `\_=11 % underline can be used in control sequences
\catcode `\~=13 % tilde is active
\catcode `\^^a0=13 % non breaking space in Unicode
\catcode 127=12 % normal character

% OpTeX version

\def\optexversion{1.11 Mar 2023}
\def\fmtname{OpTeX}
\let\fmtversion=\optexversion

% Engine testing:

\newlinechar=`\^^J
\ifx\directlua\undefined 
   \message{This format is based only on LuaTeX, use luatex -ini optex.ini^^J} 
   \endinput \fi

\ifx\bgroup\undefined \else
   \message{This file can be used only for format initialisation, use luatex -ini^^J}
   \endinput \fi

% Basic .opm syntax:

\let\_endcode =\endinput
\def \_codedecl #1#2{\immediate\write-1{#2}}%  information about .opm file
\long\def\_doc#1\_cod#2 {} % skip documentation

% Initialization:

\message{OpTeX (Olsak's Plain TeX) initialization <\optexversion>^^J}

\input prefixed.opm        % prefixed primitives and code syntax
\input luatex-ini.opm      % LuaTeX initialization
\input basic-macros.opm    % basic macros
\input alloc.opm           % allocators for registers
\input if-macros.opm       % special \if-macros, \is-macros and loops
\input parameters.opm      % parameters setting
\input more-macros.opm     % OpTeX useful macros  (todo: doc)
\input keyval.opm          % key=value dictionaries
\input plain-macros.opm    % plainTeX macros
\input fonts-preload.opm   % preloaded Latin Modern fonts  
\input fonts-resize.opm    % font resizing (low-level macros)
\input fonts-select.opm    % font selection system
\input math-preload.opm    % math fams CM + AMS preloaded
\input math-macros.opm     % basic macros for math plus mathchardefs
\input unimath-macros.opm  % macros for loading UnicodeMath fonts
\input fonts-opmac.opm     % font managing macros from OPmac
\input output.opm          % output routine
\input margins.opm         % macros for margins setting
\input colors.opm          % colors
\input ref-file.opm        % ref file
\input references.opm      % references
\input hyperlinks.opm      % hyperlinks
\input maketoc.opm         % maketoc
\input outlines.opm        % PDF outlines
\input pdfuni-string.opm   % PDFunicode strings for outlines
\input sections.opm        % titles, chapters, sections
\input lists.opm           % lists, \begitems, \enditems
\input verbatim.opm        % verbatim
\input hi-syntax.opm       % syntax highlighting of verbatim listings
\input graphics.opm        % graphics
\input table.opm           % table macro
\input multicolumns.opm    % more columns by \begmulti ...\endmulti
\input cite-bib.opm        % Bibliography, \cite
\input makeindex.opm       % Make index and sorting
\input fnotes.opm          % \fnotes, \mnotes
\input styles.opm          % styles \report, \letter
\input logos.opm           % standard logos
\input uni-lcuc.opm        % Setting lccodes and uccodes for Unicode characters
\input languages.opm       % Languages macros
\input lang-decl.opm       % Languages declaration
\input others.opm          % miscellaneous

\_directlua{
   % preload OpTeX's Lua code into format as bytecode
   lua.bytecode[1] = assert(loadfile(kpse.find_file("optex", "lua")))
}

\_everyjob = {%
   \_message{\_banner^^J}%
   \_directlua{lua.bytecode[1]()}% load OpTeX's Lua code
   \_mathsbon % replaces \int_a^b to \int _a^b
   \_inputref % inputs \jobname.ref if exists
}

\dump % You can redefine \dump if additional macros are needed. Example:
      % \let\dump=\relax \input optex.ini \input mymacros \_dump

\_endcode % ------------------------------

