% This is part of OpTeX project, see http://petr.olsak.net/optex \_codedecl \slideshow {Slides style for OpTeX <2020-03-19>} % loaded on demand by \slides \_doc ----------------------------- Default margins and design is declared here. Note that `\_ttfont` is scaled by `mag1.15` in order to balance the ex height of Helvetica (Heros) and LM fonts Typewriter. The `\begtt`...`\endtt` verbatim is printed by smaller text. \_cod ----------------------------- \_margins/1 a5l (14,14,10,3)mm % landscape A5 format \_def\_wideformat{\_margins/1 (263,148) (16,16,10,3)mm } % 16:9 format \_fontfam[Heros] \_typosize[16/19] \_famvardef\_ttfont{\_setfontsize{mag1.15}\_tt} \_def\_urlfont{} \_everytt={\_typosize[13/16] \advance\hsize by10mm} \_fontdef\_fixbf{\_bf} \_nopagenumbers \_parindent=0pt \_ttindent=5mm \_parskip=5pt plus 4pt minus2pt \_rightskip=0pt plus 1fil \_ttindent=10pt \_def\_ttskip{\_smallskip} \_onlyrgb % RGB color space is better for presentations \_doc ----------------------------- The bottom margin is set to 3\,mm. If we use 1\,mm, then baseline of `\footline` is 2\,mm from the bottom page. This is depth of the `\Grey` rectange used for page numbers. It is rlapped to `\hoffset` because left margin = `\hoffset` = right margin. It is 14\,mm for narrow pages or 16\,mm for wide pages. \_cod ----------------------------- \_footlinedist=1mm \_footline={\_hss \_rlap{% \_rlap{\Grey\_kern.2\_hoffset\_vrule height6mm depth2mm width.8\_hoffset}% \_hbox to\_hoffset{\White\_hss\_folio\_kern3mm}}} \_doc ----------------------------- The `\subtit` is defined analogicaly like `\tit`. \_cod ----------------------------- \_eoldef\_subtit#1{\_vskip20pt {\_leftskip=0pt plus1fill \_rightskip=\_leftskip \_subtitfont #1\_nbpar}} \_doc ----------------------------- The `\pshow` is implemented by printing the text in invisible (transparent) font when `\layernum<`. The color font feature is used for this transparency. \_cod ----------------------------- \_famvardef\Transparent{\_setfontcolor{FF000000}\_currvar} \_def\_use#1#2{\_ifnum\_layernum#1\_relax#2\_fi} \_def\_pshow#1{\_use{=#1}\Red \_use{<#1}\Transparent \_ignorespaces} \_doc ----------------------------- The main level list is activated here. The `\_item:X` and `\_item:x` are used and are re-defined here. If we are in nested level of items and `\pg+` is used then `\egroups` macro xepands to the right number of `\egroup`s in order to close page correctly. The level of nested item lists is saved to the `\_ilevel` register and used when we start again the next text after `\pg+`. \_cod ----------------------------- \_newcount\_ilevel \_newcount\_gilevel \_def\*{*} \_adef*{\_startitem} \_sdef{_item:X}{\Blue\_raise.2ex\_fullrectangle{.8ex}\_kern.5em} \_sdef{_item:x}{\Blue\_raise.3ex\_fullrectangle{.6ex}\_kern.4em} \_style X \_addto\_begitems{\_style x }\public \begitems ; \_def\_egroups{\_par\_global\_gilevel=\_ilevel \_egroup} \_everybegitems={\_advance\_ilevel by1 \_addto\_egroups{\_egroup}} \_doc ----------------------------- The default values of `\pg;`, `\pg+` and `\pg.` are very simple. They are used when `\showslides` is not specified. \_cod ----------------------------- \_def\_pg#1{\_cs{_spg:#1}} \_sdef{_spg:;}{\_vfil\_break \_lfnotenumreset} \_sdef{_spg:.}{\_end} \_sdef{_spg:+}{\_par} \_doc ----------------------------- We need no numbers and no table of contents when using slides. The `\_printsec` macro is redefined in order the title is centered and typeset in `\Blue`. \_cod ----------------------------- \_def\_titfont{\_typosize[42/60]\_bf \Blue} \_def\_subtitfont{\_typosize[20/30]\_bf} \_def\_secfont{\_typosize[25/30]\_bf \Blue} \_nonum \_notoc \_let\_resetnonumnotoc=\_relax \_def\_printsec#1{\_par \_abovetitle{\_penalty-400}\_bigskip {\_secfont \_noindent \_leftskip=0pt plus1fill \_rightskip=\_leftskip \_printrefnum[@\_quad]#1\_nbpar}\_insertmark{#1}% \_nobreak \_belowtitle{\_medskip}% } \_doc ----------------------------- When `\slideshow` is active then each page is opened (roughly speaking) by `\setbox\_slidepage=\vbox\bgroup` and closed by `\egroup`. The material is `\unvbox`ed and saved for the usage in the next usage if `\pg+` is in process. The `\_slidelayer` is inceremnted instead `\pageno` if `\pg+`. This counter is equal to `\count1`, so it is printed to the terminal and log file next to `\pageno`. The code is somewhat more complicated when `\layers` is used. Then is saved to the `\_layertext` macro, the material before it is in `\_sidepage` box and the material after it is in `\_slidepageB` box. The pages are completrd in the `\loop` which increments the `\layernum` register. \_cod ----------------------------- \_newbox\_slidepage \_newbox\_slidepageB \_countdef\_slidelayer=1 \_def\_decr#1{\_global\_advance#1 by-1 } \_def\_slideshow{\_slidelayer=1 \_slideshowactive \_setbox\_slidepage=\_vbox\_bgroup} \_def\_slideshowactive{% \_sdef{_spg:;}{\_closepage \_global\_slidelayer=1 \_resetpage \_openslide} \_sdef{_spg:.}{\_closepage \_end} \_sdef{_spg:+}{\_closepage \_incr\_slidelayer \_decr\_pageno \_openslide} \_def\bye {\_closepage \_end} \_let\_layers=\_layersactive \_def\_destbox[##1:##2]{\_isequal{##1}{ref}\_iffalse \_destboxori[##1:##2]\_fi}% } \_def\_openslide{\_setbox\_slidepage=\_vbox\_bgroup \_setilevel \_ifvoid\_slidepage \_else \_unvbox\_slidepage \_nointerlineskip\_lastbox \_fi} \_def\_setilevel{\_loop \_decr\_gilevel \_ifnum\_gilevel<0 \_else \_begitems \_repeat} \_def\_closepage{\_egroups \_ifnum \_maxlayers=0 \_unvcopy\_slidepage \_vfil\_break \_else \_begingroup \_setwarnslides \_layernum=0 \_loop \_ifnum\_layernum<\_maxlayers \_advance\_layernum by1 \_printlayers \_vfil\_break \_ifnum\_layernum<\_maxlayers \_incr\_slidelayer \_decr\_pageno \_fi \_repeat \_global\_maxlayers=0 \_incr\_layernum \_global\_setbox\_slidepage=\_vbox{\_printlayers}% \_endgroup \_fi} \_def\_resetpage{% \_global\_setbox\_slidepage=\_box\_voidbox \_global\_setbox\_slidepageB=\_box\_voidbox \_lfnotenumreset } \_def\_setwarnslides{% \_def\pg##1{\_opwarning{\_string\pg##1 \_layersenv}\_def\pg####1{}}% \_def\layers##1 {\_opwarning{\_string\layers\_space \_layersenv}\_def\layers####1{}}% } \_def\_layersenv{cannot be inside \_string\layers...\_string\endlayers, ignored} \_def\_printlayers{\_unvcopy\_slidepage \_nointerlineskip\_lastbox \_layertext \_endgraf \_ifdim\_prevdepth>-1000pt \_kern-\_prevdepth \_kern\_dp\_strutbox \_fi \_vskip\_parskip \_unvcopy\_slidepageB } \_let\_destboxori=\_destbox \_newcount\_layernum \_newcount\_maxlayers \_maxlayers=0 \_long\_def\_layersactive #1 #2\endlayers{% \_par\_egroup \_gdef\_layertext{#2}% \_global\_maxlayers=#1 \_setbox\_slidepageB=\_vbox\_bgroup } \_doc ----------------------------- Default `\layers ` macro (when `\slideshow` is not activated) is simple. It prints the with `\layernum=+1` because we need the result after last layer is processed. \_cod ----------------------------- \_def\_layers #1 {\_par\_layernum=\_numexpr#1+1\_relax} \_let\endlayers=\_relax \_def\layers{\_layers} \_public \subtit \slideshow \pg \wideformat \use \pshow ; \_doc ----------------------------- We must to redefine `\fnotenumpages` because the data from `.ref` file are less usable for implementing such feature: the footnote should be in more layers repeatedly. But we can suppose that each page starts by `\pg;` macro, so we can reset the footnote counter by this macro. \_cod ----------------------------- \_def \_fnotenumpages {\def\_fnotenum{\_the\_lfnotenum}\_pgfnotefalse \_def\_lfnotenumreset{\_global\_lfnotenum=0 }} \_let \_lfnotenumreset=\_relax \_public \fnotenumpages ; \_endcode % ---------------------------------------------- The user manual of \OpTeX/ slides are in `op-slides.tex` file.