Optex Manual
Total Page:16
File Type:pdf, Size:1020Kb
OpTEX 1 Format Based on Plain TEX and OPmac Version 1.04 Petr Olšák, 2020, 2021 http://petr.olsak.net/optex OpTEX is LuaTEX format with Plain TEX and OPmac. Only LuaTEX engine is supported. 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: • 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 Index2, reading .bib files directly2, syntax highlighting2, colors, graphics, hyperlinks, references). • 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. 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 fromA LTEX 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 (likeA LTEX), i. e. the fixed set of tags to define the structure of the document. This markup is differentA fromtheLTEX 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 TEX in nutshell too. 1 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 http://petr.olsak.net/opmac-e.html for more information about it. 2 All these features are implemented by TEX macros, no external program is needed. 1 Contents 1 User documentation 5 1.1 Starting with OpTEX..................................... 5 1.2 Page layout . 5 1.2.1 Setting the margins . 5 1.2.2 Concept of the default page . 6 1.2.3 Footnotes and marginal notes . 7 1.3 Fonts ............................................. 7 1.3.1 Font families . 7 1.3.2 Font sizes . 8 1.3.3 Typesetting math . 9 1.4 Typical elements of the document . 10 1.4.1 Chapters and sections . 10 1.4.2 Another numbered objects . 10 1.4.3 References . 12 1.4.4 Hyperlinks, outlines . 12 1.4.5 Lists . 13 1.4.6 Tables . 14 1.4.7 Verbatim . 16 1.5 Autogenerated lists . 18 1.5.1 Table of contents . 18 1.5.2 Making the index . 18 1.5.3 BibTEXing....................................... 20 1.6 Graphics . 21 1.6.1 Colors . 21 1.6.2 Images . 22 1.6.3 PDF transformations . 22 1.6.4 Ovals, circles . 23 1.6.5 Putting images and texts wherever . 24 1.7 Others . 24 1.7.1 Using more languages . 24 1.7.2 Pre-defined styles . 25 1.7.3 Loading other macro packages . 25 1.7.4 Lorem ipsum dolor sit . 26 1.7.5 Logos . 26 1.7.6 The last page . 26 1.7.7 Use OpTEX....................................... 26 1.8 Summary . 27 1.9 API for macro writers . 27 1.10 Compatibility with Plain TEX............................... 29 2 Technical documentation 30 2.1 The main initialization file . 30 2.2 Concept of namespaces of control sequences . 32 2.2.1 Prefixing internal control sequences . 32 2.2.2 Namespace of control sequences for users . 32 2.2.3 Macro files syntax . 33 2.2.4 Name spaces for package writers . 33 2.2.5 Summary about rules for external macro files published forE OpT X........ 33 2.2.6 The implementation of the namespaces . 34 2 2.3 pdfTEX initialization . 35 2.4 Basic macros . 37 2.5 Allocators for TEX registers . 39 2.6 If-macros, loops, is-macros . 41 2.6.1 Classical \newif .................................... 41 2.6.2 Loops.......................................... 41 2.6.3 Is-macros . 43 2.7 Setting parameters . 44 2.7.1 Primitive registers . 45 2.7.2 Plain TEX registers . 45 2.7.3 Different settings than in plainE T X......................... 46 2.7.4 OpTEX parameters . 46 2.8 More OpTEX macros . 51 2.9 Using key=value format in parameters . 54 2.10 Plain TEX macros . 55 2.11 Preloaded fonts for text mode . 59 2.12 Scaling fonts in text mode (low-level macros) . 60 2.12.1 The \setfontsize macro . 60 2.12.2 The \font primitive . 60 2.12.3 The \fontlet declarator . 60 2.12.4 Optical sizes . 61 2.12.5 Implementation of resizing . 61 2.13 The Font Selection System . 62 2.13.1 Terminology . 62 2.13.2 Font families, selecting fonts . 63 2.13.3 Math Fonts . 64 2.13.4 Declaring font commands . 64 2.13.5 The \fontdef declarator in detail . 64 2.13.6 The \famvardef declarator . 64 2.13.7 The \tt variant selector . 65 2.13.8 Font commands defined by \def ........................... 66 2.13.9 Modifying font features . 66 2.13.10 Special font modifiers . 66 2.13.11 How to create the font family file . 67 2.13.12 How to write the font family file with optical sizes . 70 2.13.13 How to register the font family in the Font Selection System . 71 2.13.14 Notices about extension of \font primitive . 72 2.13.15 Implementation of the Font Selection System . 72 2.14 Preloaded fonts for math mode . 79 2.15 Math macros . 82 2.16 Unicode-math fonts . 90 2.16.1 Unicode-math macros preloaded in the format . 91 2.16.2 Macros and codes set when \loadmatfont is processed . 93 2.16.3 More Unicode-math examples . 100 2.16.4 Printing all Unicode math slots in used math font . 100 2.17 Scaling fonts in document (high-level macros) . ..