OPmac

OPmac
extended plainTeX macros

Petr Olsak , 2013, 2014

cz Cesky

opmac-prospectus.pdf

Links:
Tips, triks, howto
FTP site

OPmac are additional macros to allow to get the LaTeX basic functionality by simple plainTeX macros: font size selecting, automatic creation of the table of contents and the index, working with bibliographic databases of references, links, hyperlinks etc.

opmac.tex
opmac-u-en.pdf
opmac-d.pdf
opmac-u-en.tex
opmac-d.tex

OPmac package consists of the following files: opmac.tex (macro) opmac-u.pdf (user documentation written using opmac) opmac-d.pdf (technical documentation written using DocByTeX) opmac-u.tex and opmac-d.tex (source files for documentation). The opmac-u-en.tex/pdf is English documentation. The TUGboat article about OPmac is available too.

The main principles, which I followed when creating this macro package, are:

  • Simplicity is power.
  • Macros are not universal, but are readable and understandable.
  • Users can easily redefine these macros as they wish.

Each macro is written in order to maximize readability for human who will want to read it, understand it and change it. There is user documentation (17 pages) and extensive technical documentation (60 pages) available. The second one can serve as a textbook of macro programming in plainTeX.

OPmac package offers a markup language for authors of texts (like LaTeX), ie the fixed set of tags to define the structure of the document. This markup is different than in LaTeX. It may offer to write the source text of the articles somewhat clearer and more attractive. Package OPmac however, does not care for typographic of the document. The simple sober document is created without additional macros. We assume that the author of plainTeX additional macros creates a look of the document to suit specific requirement.

Below is a brief overview of the features of the macro opmac.tex. After the initial line in the document:

   \input opmac

the following key commands are (roughly) available:

   \tit Title (terminated by a blank line)
   \chap Chapter Title (terminated by a blank line)
   \sec Section Title (terminated by a blank line)
   \secc Subsection Title (terminanted by a blank line)
   
   \maketoc         % table of contents generation
   \ii item1,item2  % insertion the items to the index
   \makeindex       % the index is generated
   
   \label [labname]  % link target location
   \ref [labname]    % link to the chapter, section, subsection, equation, ...
   \pgref [labname]  % link to the page
   
   \caption/t  % a numbered table caption
   \caption/f  % a numbered caption for the picture
   \eqmark     % a numbered equation
   
   \begitems       % start list of the items
   \enditems       % end of list of the items
   \begtt          % start verbatim text
   \endtt          % end verbatim extract
   \activettchar X % initialization character X for in-text verbatim
   \verbinput      % verbatim extract from the external file
   \begmulti num   % start multicolumn text (num columns)
   \endmulti       % end multicolumn text
   
   \cite [labnames]  % refers to the item in the lits of references
   \rcite [labnames] % similar to \cite but [] are not printed.
   \sortcitations \shortcitations \nonumcitations % cite format
   \bib [labname]  % an item in the list of references
   \usebibtex {bib-base}{bst-style}  % use BibTeX for bibliography
   \genbbl {bib-base}{bst-style}     % prepare the bbl file generation
   \usebbl/? bbl-base   % use pre-generated bbl file, ? in {a,b,c}
   \usebib/? (style) bib-base % direct using of .bib file, ? in {s,c}
   
   \fontfam [Family name] % uses font-file of given font Family
   \typosize [font-size/baselineskip] % size setting of typesetting
   \typoscale [factor-font/factor-baselineskip] % size scaling
   \thefontsize [size] \thefontscale [factor]   % current font size
   
   \inspic file.ext    % insert a picture, extensions: jpg, png, pdf
   \table {rule}{data} % simple macro for the tables like in LaTeX

   \fnote    % footnote (local numbering on each page)
   \mnote    % note in the margin (left or right by page number)

   \hyperlinks {color-in}{color-out} % PDF links activate as clickable
   \outlines {level}   % PDF will have a table of contents in the left tab

   \magscale[factor]  % resize typesetting, line/page breaking unchanged
   \margins/pg format (left, right, top, bottom)unit % margins setting

License: In order to avoid a discomfort for the author of the macros or his state of irritation, it is strictly required not to use the word ``license'' in connection with the OPmac package. In this paragraph, there are the only two occurrences of this word, and other such word not occur never in the OPmac package. If you comply with previous condition, you can do with the package OPmac what you want.

csplain.tar.gz

Dependency: File opmac.tex needs to read the file ams-math.tex, which is a part of version csplain Nov.2012 or newer. If this version of csplain isn't a part of your TeX distributions, you can download it here from csplain.tar.gz package.

Old versions

Development: I offer consultations to OPmac users by email. All messages about OPmac are welcome. Let's work together to eliminate the possible bugs and other flies. You will always find the latest version of the package on this web page. First public beta version is (a)Nov.2012. First stable version is Dec.2012. This version was released and included to csplain. This csplain is a part of TeXlive since December 2012.

fontfam.tex
fontfam-global.tex
fontfam-catalog.tex

The additional package fontfam: It lists a font families implemented in font-files, selects given font family and prints a simple font catalogue. The macro \fontfam can be used after \input opmac. This additional package is automatically loaded when \fontfam is used firstly. The features of \fontfam are documentated is in the file fontfam.tex and in OPmac user documentation.

pdfuni.tex
pdfuni-article.pdf
pdfuni-article.tex

The additional package PDFuni: If you \input pdfuni after \input opmac then the conversion process of strings to PDF outlines is redefined: the accents are not removed but they are kept in UNICODE strings. The Czech article about it with more technical notes was published.

opmac-xetex.tex

The additional package opmac-xetex: This package is used automatically during \input opmac when XeTeX is detected. Some low level macros for PDF features (hyperlinks, colors, outlines) are redefined here because OPmac supposes pdfTeX and XeTeX uses a different postprocessor for creating PDF.

opmac-luatex.tex

The additional package opmac-luatex: This package is automatically loaded when LuaTeX version 0.95 (or newer) is detected, because this version of LuaTeX leaves the direct support of pdfTeX primitives. We need to declare them analogicaly as in opmac-xetex package.

opmac-bib.tex
opmac-bib-simple.tex
opmac-bib-iso690.tex
op-example.bib

The additional package opmac-bib gives you possibiity for direct accessing the .bib databases by TeX macros without using bibTeX or any other external program. The librarian.tex package by Paul Isambert is used here. Two bib styles are offered: simple and iso690. The comprehensive documenation is included in opmac-bib.tex and opmac-bib-iso690.tex files after \endinput command. If \usebib is firstly used then opmac-bib package is loaded automatically.

Triks: The OPmac tricks page lists many tens of tricks which extend the usage of the OPmac for various reasons. Many tricks are (by functionality) comparable with LaTeX packages.

480.pdf
339.pdf
popelsta.pdf
mirek-bakalarka

Examples: There are examples of Theses created by students at Czech Technical University in Prague using the CTUStyle template which is based on OPmac. The last example shows Thesis at Charles University in Prague (Faculty of Mathematics and Physics).