AllenDowney / ThinkStats2

Text and supporting code for Think Stats, 2nd Edition
http://allendowney.github.io/ThinkStats2/
GNU General Public License v3.0
4.03k stars 11.31k forks source link

Use hyperref package for pdf metadata (TOC, Title, Author) #38

Closed tobanw closed 2 years ago

tobanw commented 8 years ago

It would be nice to have a "document outline" (I would call it a metadata TOC) for using the navigation tree in pdf viewers (usually you can toggle between thumbnail view and document outline). This can easily be added by using the hyperref package -- by default it generates the document outline and you can specify more metadata. For example:

\usepackage{hyperref}

\hypersetup{
    pdftitle={Think Stats}
    pdfauthor={Allen B. Downey}
}

It will also automatically linkify all your references! From the link above: "This will automatically turn all your internal references into hyperlinks. It won't affect the way to write your documents: just keep on using the standard \label-\ref system (discussed in the chapter on Labels and Cross-referencing); with hyperref those "connections" will become links and you will be able to click on them to be redirected to the right page. Moreover the table of contents, list of figures/tables and index will be made of hyperlinks, too."

AllenDowney commented 8 years ago

Can't get it to work with hevea.

On Sat, Feb 27, 2016 at 2:33 PM, Toban Wiebe notifications@github.com wrote:

It would be nice to have a "document outline" (I would call it a metadata TOC) for using the navigation tree in pdf viewers (usually you can toggle between thumbnail view and document outline). This can easily be added by using the hyperref package https://en.wikibooks.org/wiki/LaTeX/Hyperlinks -- by default it generates the document outline and you can specify more metadata. For example:

\usepackage{hyperref} \hypersetup{ pdftitle={Think Stats} pdfauthor={Allen B. Downey} }

It will also automatically linkify all your references! From the link above: "This will automatically turn all your internal references into hyperlinks. It won't affect the way to write your documents: just keep on using the standard \label-\ref system (discussed in the chapter on Labels and Cross-referencing); with hyperref those "connections" will become links and you will be able to click on them to be redirected to the right page. Moreover the table of contents, list of figures/tables and index will be made of hyperlinks, too."

— Reply to this email directly or view it on GitHub https://github.com/AllenDowney/ThinkStats2/issues/38.

tobanw commented 8 years ago

Ah that's too bad. I'll go ahead and close this then.

tobanw commented 8 years ago

I just happened upon a method which might get around your problem with hevea. As you can see in this example, you can use the package ifpdf to only load hyperref when compiling to pdf.