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

% Run  optex optex-doc 
% (three times) to generate OpTeX documentation including references and the index. 

\load [doc.opm]  \let\enddocument=\endinput

\typosize[10/12]  % Main size (used in techdoc)
\directlua{optex.glyphstroked = false} % see section 2.39.6 of OpTeX doc.

\begingroup \typosize [11/13.5] % Different size used in useroc.

\insertoutline{OpTeX}  % PDF outlines generated from TOC

% Title:

\vglue1cm
\centerline{\setfontsize{at50pt}\rm\OpTeX}
\vskip-8mm

\tit Format Based on Plain \TeX/
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\hfill Version 1.19

\centerline{\it Petr Olšák, 2020, 2021, 2022, 2023, 2024, 2025, 2026}

\bigskip
\centerline{\url{http://petr.olsak.net/optex}}

\bigskip
\noindent
\OpTeX/ is \LuaTeX/ format with Plain \TeX/ macros
and with extended powerful macros, especially those taken from OPmac\fnote
{OPmac package is a set of simple additional macros to Plain \TeX{}.
It enables users to take advantage of \LaTeX/ functionality but keeps
Plain \TeX/ simplicity. See
\url{http://petr.olsak.net/opmac-e.html} for more information about it.}.
Only \LuaTeX/ engine
is supported (more exactly: \LuaHBTeX/ engine is used from 2025).

\OpTeX/ should be a modern Plain \TeX/ with power from OPmac
(Fonts Selection System, colors, graphics, references, hyperlinks,
indexing, bibliography, ...) with preferred Unicode fonts.

The main goal of \OpTeX/ is:

\begitems
* \OpTeX/ keeps the simplicity (like in Plain \TeX/ and OPmac macros).
* There is no old obscurities concerning various 8-bit encodings and
  various engines.
* \OpTeX/ provides a powerful Fonts Selection System (for Unicode font
  families, of course).
* \OpTeX/ supports hyphenations of all languages installed in your \TeX/ system.
* All features from OPmac macros are copied. For example sorting words in
  the Index\fnotemark1, reading `.bib` files directly\fnotemark1, syntax 
  highlighting\fnotemark1, colors, graphics, hyperlinks, references).
  \fnotetext{All these features are implemented by \TeX/ macros, no external
             program is needed.}
* Macros are documented in the same place where code is.
* User namespace of control sequences is separated from the internal namespace
  of \OpTeX/ and primitives (`\foo` versus `\_foo`).
  The namespaces for macro writers are designed too.
\enditems

If you need to customize your document or you need to use something
very specific, then you can copy relevant parts of \OpTeX/ macros into your macro
file and do changes to these macros here. This is a significant difference from
\LaTeX/ or \ConTeXt/, which is an attempt to create a new user level with a
plenty of non-primitive parameters and syntax hiding \TeX/ internals.
The macros from \OpTeX/ are simple and straightforward because they solve only
what is explicitly needed, they do not create a new user level for
controlling your document. We are using \TeX/ directly in this case.
You can use \OpTeX/ macros, understand them, and modify them.

\OpTeX/ offers a markup language for authors of texts (like \LaTeX),
i.\,e.\ the fixed set of tags to define the structure of the document. This
markup is different from the \LaTeX{} markup. It may offer to write the
source text of the document somewhat clearer and more attractive. 

The manual includes two parts: user documentation and technical
documentation. The second part is generated directly from the sources of
\OpTeX/. There are many hyperlinks from one part to second and vice versa.

This manual describes \OpTeX/ features only. We suppose that the user knows \TeX/
basics. They are described in many books. You can see a short
document \ulink[http://petr.olsak.net/ftp/olsak/optex/tex-nutshell.pdf]
{\TeX/ in nutshell} too.

\vfil\break

\insertoutline{CONTENTS} \outlines{0} 

{\baselineskip=13.4pt
\notoc\nonum \sec Contents
\maketoc
\par}

\thisoutline {USER DOCUMENTATION}

\chap User documentation

\input optex-userdoc
\endgroup

%\end

\input optex-techdoc

\vfil\break

\def\_printchap#1{\noindent{\_printrefnum[@]\_secfont #1}\medskip}

\nonum\chap Index

\noindent
Control sequences declared by \OpTeX/ have page list here and they are
internal links to their main documentation point. \TeX/ primitives used by
\OpTeX/ have no page list here and they are external links to
\ulink[http://petr.olsak.net/ftp/olsak/optex/tex-nutshell.pdf]{\TeX/ in a Nutshell}
to the place where the primitive is briefly described.
%Only primitives used in \OpTeX/ macros are listed here. There are much more
%primitives implemented in \LuaTeX/, see
%\ulink[https://www.pragma-ade.com/general/manuals/luatex.pdf]{\LuaTeX/ manual},
%section \"primitives".

% active links directly to the main documentation point but not to the pages:
\def\_printiiD #1#2#3{%
   \ea\ifx \csname,#3\endcsname \empty % primitive
      \_dest[cs:\_tmp]% main documentation point for primitives is in the Index
      {\tt\link[url:\exurl\#cs:\_tmp]\_elinkcolor{\bslash\_tmp}}
   \nopages \fi
}
\def\exurl{https://petr.olsak.net/ftp/olsak/optex/tex-nutshell.pdf}

\def\_pgprintA #1{#1}
\def\nopages#1&{\fi\fi\fi{\tt*}\_par}
\begmulti 3 \makeindex \endmulti

\bye
