Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PDF table of contents #13

Open
nkrusch opened this issue Dec 18, 2024 · 3 comments
Open

PDF table of contents #13

nkrusch opened this issue Dec 18, 2024 · 3 comments

Comments

@nkrusch
Copy link
Member

nkrusch commented Dec 18, 2024

In a PDF TOC, in place of *, I wanted hyperlinks for "Table of contents", Tables, Figures, etc.

HAVE
Screen Shot 2024-12-17 at 11 57 24 PM
WANT
Screen Shot 2024-12-18 at 12 01 58 AM

This part on the "printable page" as in template of course

Screen Shot 2024-12-18 at 12 03 10 AM

A starting point:

\AddToHookNext{shipout/foreground}{\put (0, 0){\pdfbookmark[0]{Cover}{sec:cover}}}
\label{sec:cover}\maketitle\clearpage

\AddToHookNext{shipout/foreground}{\put (0, 0){\pdfbookmark[0]{Acknowledgements}{sec:acks}}}
\input{acknowledgements}\clearpage

\AddToHookNext{shipout/foreground}{\put (0, 0){\pdfbookmark[0]{Abstract}{sec:abstract}}}
\input{abstract}\clearpage

\pdfbookmark[0]{\contentsname}{toc}\tableofcontents\clearpage
\pdfbookmark[0]{\listtablename}{lot}\listoftables\clearpage
\pdfbookmark[0]{\listfigurename}{lof}\listoffigures\clearpage
  • The \AddToHookNext{shipout/foreground}{\put (0, 0) bit is to achor to top of page
  • The \pdfbookmark[0]{display text}{ref} adds it to the PDF table of contents (only)

Originally posted by @nkrusch in #12 (comment)

@aubertc
Copy link
Collaborator

aubertc commented Dec 24, 2024

I had some ok result with the - listof = totoc, toc option in info.md, but this resulted in some entries being in the actual table of contents:

image

then I played with \pdfbookmark[0]{\contentsname}{toc} for a long time, but never quite got it right.

in the end I use a convoluted \hypertarget{listoftables}{}\bookmark[level=chapter,dest=listoftables]{\listtablename} set up.

It has two drawbacks:

  1. It uses the same page numbering, resulting in multiple pages being numbered "1, 2, …" in the pdf bookmarks:
    image

  2. For some reason, all the links except the one on table of content point slightly after the part of the document referenced.

I've played with this issue for a while, but that's the best I could get.

@nkrusch
Copy link
Member Author

nkrusch commented Dec 28, 2024

With template v0.2.1, I get the right headings in a PDF, and no extras in paper TOC.

Screen Shot 2024-12-28 at 3 06 09 PM

However the page anchoring/alignment is off.

  • ACK + Abstract: "too low" alignment below the title, title cropped off.
  • TOC: good
  • LOT/LOF: "too high" 0.5-page into previous page, before the heading.

@aubertc
Copy link
Collaborator

aubertc commented Dec 28, 2024

Thanks for getting back to me on that. I see the same issue with where the links point on my end -- I'll try to fix it when I get some inspiration (I feel that I've tried everything now).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants