diff options
Diffstat (limited to 'Master/texmf-dist/tex/optex/base/hyperlinks.opm')
-rw-r--r-- | Master/texmf-dist/tex/optex/base/hyperlinks.opm | 50 |
1 files changed, 30 insertions, 20 deletions
diff --git a/Master/texmf-dist/tex/optex/base/hyperlinks.opm b/Master/texmf-dist/tex/optex/base/hyperlinks.opm index 5fc8a32233b..95fae3846bd 100644 --- a/Master/texmf-dist/tex/optex/base/hyperlinks.opm +++ b/Master/texmf-dist/tex/optex/base/hyperlinks.opm @@ -1,6 +1,6 @@ %% This is part of the OpTeX project, see http://petr.olsak.net/optex -\_codedecl \ulink {Hyperlinks <2021-01-27>} % preloaded in format +\_codedecl \ulink {Hyperlinks <2021-04-17>} % preloaded in format \_doc ---------------------------- \`\dest``[<type>:<spec>]` creates a destination of internal links. The @@ -28,20 +28,30 @@ \`\link``[<type>:<spec>]{<color>}{<text>}` creates an internal link to \^`\dest` with the same `<type>:<spec>`. You can have more links with the same `<type>:<spec>` but only one `\dest` in the document. If \^`\hyperlinks` - command is not used, then `\link` only prints `<text>` else it is set to + command is not used, then `\link` only prints `<text>` else its meaning is set to `\_linkactive`. The \`\_linkactive` is implemented by `\_pdfstartlink...\_pdfendlink` - primitives. + primitives. The `<color>` is the color of the link text generated by + the `\_linkactive` macro. + The `<color>` parameter can be overwritten by definition of + `\_<type>linkcolor`. For example `\def\_toclinkcolor{\Red}` means that + links from table of contents are in red. This is similar concept as + `\_def\_tocborder`. \nl \`\ilink``[<type>:<spec>]{<text>}` is equivalent to `\_link` but - the `<color>` is used from \^`\hyperlinks` declaration. + the `<color>` is used from \^`\hyperlinks` declaration + (or it is overwriten by `\def\_<type>linkcolor`). + \nl + \`\_linkdimens` are default dimensions of the link area. \_cod ---------------------------- -\_protected\_def\_linkactive[#1:#2]#3#4{\_leavevmode\_pdfstartlink height.9em depth.3em - \_pdfborder{#1} goto name{#1:#2}\_relax {#3#4}\_pdfendlink +\_protected\_def\_linkactive[#1:#2]#3#4{\_leavevmode\_pdfstartlink \_linkdimens + attr{\_pdfborder{#1}} goto name{#1:#2}\_relax + {\_localcolor\_trycs{_#1linkcolor}{#3}#4}\_pdfendlink } \_protected\_def\_link[#1]#2#3{\_leavevmode{#3}} -\_protected\_def\_ilink[#1]#2{\_leavevmode{#2}} +\_def\_ilink[#1]#2{\_link[#1]{}{#2}} +\_def\_linkdimens{height.9em depth.3em} \_public \ilink \link ; \_doc ---------------------------- @@ -53,19 +63,18 @@ \_cod ---------------------------- \_protected\_def\_urlactive[#1:#2]#3#4{\_leavevmode{\_escapechar=-1 - \_pdfstartlink height.9em depth.3em \_pdfborder{#1}% + \_pdfstartlink \_linkdimens attr{\_pdfborder{#1}}% user{/Subtype/Link/A <</Type/Action/S/URI/URI(\_detokenize{#2})>>}\_relax - {#3#4}\_pdfendlink}% + {\_localcolor\_trycs{_#1linkcolor}{#3}#4}\_pdfendlink}% } \_def\_ulink[#1]#2{\_leavevmode{#2}} -\_def\_urlcolor{} \_public \ulink ; \_doc ---------------------------- - The `\_pdfstartlink` primitive uses `\_pdfborder{<type>}` in its parameter + The `\_pdfstartlink` primitive uses `attr{\_pdfborder{<type>}}` in its parameter (see \^`\_linkactive` or \^`\_urlactive` macros). The \`\_pdfborder``{<type>}` - expands to `attr{/C[? ? ?] /Border[0 0 .6]}` if the - `\_<type>border` (i.e.\ \`\_refborder`, \`\_citeborder`, \`\_tocborder`, + macro expands to `/C[? ? ?] /Border[0 0 .6]` if the + `\_<type>border` macro (i.e.\ \`\_refborder`, \`\_citeborder`, \`\_tocborder`, \`\_pgborder`, \`\_urlborder`, \`\_fntborder` or \`\_fnfborder`) is defined. Users can define it in order to create colored frames around active links. For example @@ -74,8 +83,7 @@ \_cod ---------------------------- \_def\_pdfborder#1{\_ifcsname _#1border\_endcsname - attr{/C[\_csname _#1border\_endcsname] /Border[0 0 .6]}% - \_else attr{/Border[0 0 0]}\_fi + /C [\_csname _#1border\_endcsname] /Border [0 0 .6]\_else /Border [0 0 0]\_fi } \_doc ---------------------------- @@ -86,8 +94,8 @@ \_def\_hyperlinks#1#2{% \_let\_dest=\_destactive \_let\_link=\_linkactive - \_def\_ilink[##1]##2{\_link[##1]{\_localcolor#1}{##2}}% - \_def\_ulink[##1]##2{\_urlactive[url:##1]{\_localcolor#2}{##2}}% + \_def\_ilink[##1]##2{\_link[##1]{#1}{##2}}% + \_def\_ulink[##1]##2{\_urlactive[url:##1]{#2}{##2}}% \_public \dest \ilink \ulink \link ;% } \_public \hyperlinks ; @@ -136,8 +144,8 @@ There are four types of internal links and one type of external link: see also the section \ref[maketoc]. * `pg:<gpageno>` -- the destination is created at beginning of each page, see also the section \ref[output]. -* `cite:<bibnum>` -- the destination is created in bibliography reference, - see also the section \ref[bib]. +* `cite:<bibpart>/<bibnum>` -- the destination is created in bibliography reference, + see section \ref[bib]. * `url:<url>` -- used by `\url` or `\ulink`, see also the end of this section. \enditems @@ -152,6 +160,8 @@ of internal links are created at the same destination place: \_endinput +2021-04-17 attr{\_pdfborder{...}} instead expanding \_pdfborder to attr{...} +2021-04-02 The possibility of \def\_toclinkcolor introduced, \localcolor moved 2021-01-27 \public \link added to \hyperlinks, bug fixed. 2020-04-22 \| in \url: bug fixed -2020-03-15 introduced
\ No newline at end of file +2020-03-15 introduced |