GNU TeXmacsUser manualReferenceAboutEnglish
Links, bookmarks and metadata in PDF output

1.Hyperlinks

The renderer interface has two methods for links, which only printers implement: href (dest, x1, y1, x2, y2) makes the rectangle a link to dest, and anchor (label, x1, y1, x2, y2) makes it the target of a label. The boxes call them while they are drawn, in two ways:

In both cases each box gets its own link: a link of three words becomes three annotations.

href (

pdf_hummus_renderer.cpp:2297

) writes a /Link annotation for the rectangle, slightly enlarged. Its border is invisible unless the preference locus-on-paper is preserve. A destination #label becomes a named destination /labeln, where n is the number which get_label_id gives to the label; anything else becomes a /URI action with the destination as it is, so relative links to other files are written unchanged. The annotations are written by the destructor, but registered with the page they belong to through RegisterAnnotationReferenceForNextPageWrite.

anchor records the label, the page and the position just above the box; flush_dests writes the dictionary of named destinations, each with an /XYZ view of its page, and the DestinationsWriter adds it to the catalog as /Dests.

2.Bookmarks

The PDF outline is built from the table of contents. The macros of

std-automatic.ts

which add an entry to the table of contents also call toc-notify with the kind of the entry (toc-strong-1, toc-strong-2, toc-1, …, toc-5) and its title. typeset_toc_notify (

concat_active.cpp:316

) converts the title to plain text, replacing the TeX, LaTeX and TeXmacs logos by their names, and produces an invisible toc_box; when this box is drawn, it calls toc_entry with the kind and title.

toc_entry (

pdf_hummus_renderer.cpp:2355

) turns the kind into a level from 1 (toc-strong-1, chapters in books) to 7 (toc-5) and records the entry with its page and position. flush_outlines and recurse build the tree of outline items from this flat list of levels: an entry with a higher level than the previous one becomes its child. Each item has a /Title written as a UTF-16 hex string, links to its parent and siblings, the number of its children (negative, so that the items are closed), and a destination on its page.

3.Metadata

set_metadata stores the title, author and subject passed by print_doc (see from the menu to the file), and flush_metadata (

pdf_hummus_renderer.cpp:2464

) writes them to the information dictionary of the trailer, together with /Creator (TeXmacs version), /Producer (the same followed by + Hummus 4.0) and the creation date. There is no XMP metadata stream, and nothing more (keywords, language, tagged structure) is written.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".