%% 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)

\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/ and OPmac\fnotemark1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\hfill Version 1.17

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

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

\fnotetext {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.}

\bigskip
\noindent
\OpTeX/ is \LuaTeX/ format with Plain \TeX/ and OPmac. 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\_printii #1&{%
   \noindent\hskip-\iindent
   \ea\ifx \csname,#1\endcsname \empty % primitive
      \_dest[cs:#1]% main documentation point for primitives is in the Index
      \ulink[http://petr.olsak.net/ftp/olsak/optex/tex-nutshell.pdf\#cs:#1]{\bslash#1}
      \ea\ea\ea\nopages
   \else \link[cs:#1]\Blue{\bslash #1} % OpTeX macro
   \fi
}
\def\_pgprintA #1{#1}
\def\nopages#1&{*\_par}
\begmulti 3 \tt \makeindex \endmulti

\bye
