diff options
Diffstat (limited to 'Master/texmf-dist/tex/optex/base/slides.opm')
-rw-r--r-- | Master/texmf-dist/tex/optex/base/slides.opm | 100 |
1 files changed, 82 insertions, 18 deletions
diff --git a/Master/texmf-dist/tex/optex/base/slides.opm b/Master/texmf-dist/tex/optex/base/slides.opm index 94fa3afac83..a491d1f5ad1 100644 --- a/Master/texmf-dist/tex/optex/base/slides.opm +++ b/Master/texmf-dist/tex/optex/base/slides.opm @@ -1,6 +1,6 @@ % This is part of the OpTeX project, see http://petr.olsak.net/optex -\_codedecl \slideshow {Slides style for OpTeX <2021-03-10>} % loaded on demand by \slides +\_codedecl \slideshow {Slides style for OpTeX <2021-04-22>} % loaded on demand by \slides \_doc ----------------------------- Default margins and design is declared here. @@ -79,7 +79,7 @@ \_newcount\_gilevel \_def\*{*} -\_adef*{\_relax\_ifmmode*\_else\_ea\_startitem\_fi} +\_adef*{\_relax\_ifmmode*\_else\_ea\_startitem\_fi} % defined also in styles.opm \_sdef{_item:X}{\Blue\_raise.2ex\_fullrectangle{.8ex}\_kern.5em} \_sdef{_item:x}{\Blue\_raise.3ex\_fullrectangle{.6ex}\_kern.4em} \_style X @@ -98,7 +98,7 @@ \_sdef{_spg:+}{\_par} \_doc ----------------------------- - The \`\_endslides` is defined as `\_end` primitive, but + The \`\_endslides` is defined as `\_end` primitive (preceeded by `\_byehook`), but slide-designer can redefine it. For example, \ulink[http://petr.olsak.net/optex/optex-tricks.html\#slider]{OpTeX trick 0029} shows how to define clickable navigation to the pages and how to check @@ -107,7 +107,7 @@ The `\bye` macro is redefined here as an alternative to `\pg.`. \_cod ----------------------------- -\_def\_endslides{\_end} +\_def\_endslides{\_byehook \_end} \_def\bye{\_pg.} \_doc ----------------------------- @@ -139,9 +139,9 @@ The code is somewhat more complicated when \^`\layers` is used. Then `<layered-text>` is saved to the \`\_layertext` macro, the material before - it is in \`\_slidepage` box and the material after it is in `\_slidepageB` + it is in \`\_slidepage` box and the material after it is in \`\_slidepageB` box. The pages are completed in the `\loop` which increments the - \`\layernum` register. + \`\layernum` register and prints page by the \`\_printlayers` \_cod ----------------------------- \_newbox\_slidepage \_newbox\_slidepageB @@ -156,10 +156,8 @@ \_sdef{_spg:.}{\_closepage \_endslides} \_sdef{_spg:+}{\_closepage \_incr\_slidelayer \_decr\_pageno \_openslide} \_let\_layers=\_layersactive - \_destboxslide % to prevent hyperlink-dests duplication + \_slidelinks % to prevent hyperlink-dests duplication } -\_def\_destboxslide{\_def\_destbox[##1:##2]{\_isequal{##1}{ref}\_iffalse \_destboxori[##1:##2]\_fi}} - \_def\_openslide{\_setbox\_slidepage=\_vbox\_bgroup\_bgroup \_setilevel \_ifvoid\_slidepage \_else \_unvbox\_slidepage \_nointerlineskip\_lastbox \_fi} \_def\_setilevel{\_loop \_decr\_gilevel \_ifnum\_gilevel<0 \_else \_begitems \_repeat} @@ -186,9 +184,8 @@ } \_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 +\_def\_printlayers{\_unvcopy\_slidepage \_prevdepth=\_dp\_slidepage + {\_layertext \_endgraf}% \_vskip\_parskip \_unvcopy\_slidepageB } @@ -198,19 +195,77 @@ \_maxlayers=0 \_long\_def\_layersactive #1 #2\endlayers{% - \_par\_penalty0\_egroup - \_gdef\_layertext{#2}% + \_par\_penalty0\_egroup\_egroup + \_gdef\_layertext{\_settinglayer#2}% \_global\_maxlayers=#1 - \_setbox\_slidepageB=\_vbox\_bgroup + \_setbox\_slidepageB=\_vbox\_bgroup\_bgroup + \_setbox0=\_vbox{{\_layernum=1 \_globaldefs=-1 \_layertext\_endgraf}}\_prevdepth=\_dp0 } +\_public \subtit \slideshow \pg \wideformat \use \pshow \layernum ; + + \_doc ----------------------------- + \`\slideopen` should be used instead \^`\slideshow` to deactivate it + but keep the borders of groups. + \_cod ----------------------------- + \_def\_slideopen{\_let\slideshow=\_relax % first wins \_sdef{_spg:;}{\_egroups\_vfil\_break \_lfnotenumreset\_bgroup \_setilevel} \_sdef{_spg:.}{\_egroups\_endslides} \_sdef{_spg:+}{\_egroups\_bgroup \_setilevel} + \_let\_layersopen=\_egroup \_let\_layersclose\_bgroup \_bgroup } +\_public \slideopen ; + + \_doc ----------------------------- + When \^`\slideshow` is active then the destinations of internal hyperlinks + cannot be duplicated to more \"virtual" pages because + hyperlink destinations have to be unique in the whole document. + + The \^`\slideshow` creates boxes of typesetting material and copies them to + more pages. So, we have to suppress creating destinations in these boxes. + This is done in the \`\_slidelinks` macro. We + can move creating these destinations to the output routine. \`\_sdestbox` is + saved value of the original `\_destbox` which is redefined to do only + `\addto\_destboxes{\_sdestbox[<label>]}`. All destinations saved to + \`\_destboxes` are created at the start of the next output routine in the + \^`\_pagedest` macro. The output routine removes `\_destboxes`, so each + destination is created only once. + + Limitations of this solution: destinations are only at the start of the + page, no at the real place where \^`\wlabel` was used. The first \"virtual" + page where \^`\wlabel` is used includes its destination. If you want to + go to the final page of the partially uncovering ideas then + use \^`\label``[<label>]`\^`\wlabel``{text}` in the last part of + the page (before `\pg;`) o use \^`\pgref` instead \^`\ref`. + \_cod ----------------------------- + +\_def\_slidelinks{% + \_def \_destbox[##1]{\_edef\_tmp{\_noexpand\_sdestbox[##1]}% + \_global\_ea\_addto\_ea\_destboxes\_ea{\_tmp}}% + \_def \_pagedest {% + \_hbox{\_def\_destheight{25pt}\_sdestbox[pg:\_the\_gpageno]\_destboxes}% + \_nointerlineskip \_gdef\_destboxes{}% + }% + \_ifx \_dest\_destactive \_else \_let\_pagedest=\_relax \_fi +} +\_let\_sdestbox = \_destbox +\_def\_destboxes{} % initial value of \_destboxes +\_let\_bibgl=\_global % \advance\bibnum must be global if they are at more pages -\_public \subtit \slideshow \slideopen \pg \wideformat \use \pshow \layernum ; + \_doc ----------------------------- + The \`\_settinglayer` is used in the \^`\_layertext` macro to prevent + printing \"Duplicate label" warning when it is expanded. It is done + by special value of \`\_slideshook` (used by the \^`\label` macro). + Moreower, the warning about illegal use of `\bib`, `\usebib` in `\layers` + environment is activated. + \_cod ----------------------------- + +\_def\_settinglayer{% + \_def\_slideshook ##1##2{}% + \_def\_bibB[##1]{\_nousebib}\_def\_usebib/##1 (##2) ##3 {\_nousebib}% +} +\_def\_nousebib{\_opwarning{Don't use \noexpand\bib nor \noexpand\usebib in \string\layers}} \_doc ----------------------------- Default \`\layers` `<num>` macro (when \^`\slideshow` is not activated) is simple. @@ -218,8 +273,10 @@ result after last layer is processed. \_cod ----------------------------- -\_def\_layers #1 {\_par\_layernum=\_numexpr#1+1\_relax} -\_let\endlayers=\_relax +\_long\_def\_layers #1 #2\endlayers{\_par + \_layersopen {\_layernum=\_numexpr#1+1\_relax #2\_endgraf}\_layersclose} +\_let\_layersopen=\_relax +\_let\_layersclose=\_relax \_def\layers{\_layers} @@ -240,6 +297,13 @@ The user manual of \OpTeX/ slides are in `op-slides.tex` file. +2021-04-22 \adef* moved back, bug fixed in more-macros.opm +2021-04-21 \adef* removed from slides.opm, bug fixed +2021-04-19 \_byehook added to \_endslides. +2021-04-13 hyperlinks destinations are moved to the output routine when \slideshow +2021-04-10 \layers: \prevdepth calculation added, {\_layertext} group added +2021-04-10 \layers: bug with \setbox\_slidepageB fixed +2021-04-10 \layers: \vskip\parskip added after \unvcopy\_slidepage 2021-03-10 \slideopen introduced, bug with colors in \setbox fixed 2021-03-10 \ifmmode* added to \adef* 2021-02-15 \_def\_decr removed |