17

Many questions on the site ask for explanations of specific commands, for TeX/LaTeX/Engine Foo. The informations is often directly available in one of canonical books like "TeX by Topic", "TeX for the Impatient", and of course "The TeXBook". At least some of these are freely and legally available as PDFs (assume for the moment that distribution issues were suitably settled).

It is technically quite simple to drop these PDFs on a website and provide an in-browser viewer for displaying them, also allowing anyone to link directly to a specific page of any hosted book. There may be existing services (Scribd, once upon a time?) to do this, and if not, Setting this up on github pages for example can be done with a couple of hours work. Knowing that the urls will work "forever", participants on the site could provide a directly viewable link to a precise location in a specific resource in comments and answers.

As a concrete example of how this could work, here is a link to the tech demo for the [PDF.js project][1] from Mozilla, an in-browser PDF viewer, displaying a CS paper on javascript engine tech.

Implementation is easy, hosting is not a problem, assuming legal permission is obtainable or available, if there's no actual hinderance to putting this in place, would it be useful or useless? is it a good idea? would it have negative side-effects on answer quality?

  • 6
    What's wrong with texdoc.net? Covers not only TeX by Topic and TeX for the Impatient but also all of the packages in TeX Live. – Joseph Wright Jul 27 '15 at 18:18
  • I haven't used it before. The search brings up nothing when you plug in \parfillskip for example, and the 'view' button simply links to the pdf for download. That's not quite what I was suggesting. Still useful, though. – Jared Kulik Jul 27 '15 at 18:59
  • Related: tex.stackexchange.com/questions/186676/… – musarithmia Jul 27 '15 at 21:02
  • You can use texdoc locally, too, of course: texdoc texbytopic or texdoc impatient, texdoc source2e, etc. – musarithmia Jul 27 '15 at 21:03
  • Handy, but asking users to (use linux) and edit their .bashrc is less convenient then a providing a direct link to a viewable page. – Jared Kulik Jul 27 '15 at 21:12
  • 3
    @JaredKulik Where's the need to use Linux/edit .bashrc files? texdoc works cross-platform, and not only with TeX Live: fine in MiKTeX too. – Joseph Wright Jul 27 '15 at 21:16
  • That was meant in response to the link andrew provided. I still think clicking a link is friendlier then switching out to a shell, typing a command with the right bookname and navigating to the page. By curious coincidence, my texlive install also doesn't have docs installed. – Jared Kulik Jul 27 '15 at 21:29
  • I just realized modern browsers show pdfs in the browser by default, mine has it disabled by choice. Fo most users, It's true then that jumping to a page is a non-issue and a texdoc link is good enough. – Jared Kulik Jul 27 '15 at 21:42
  • @JaredKulik Perhaps a self answer based on your edit (if that works as a solution for you). – Joseph Wright Jul 28 '15 at 18:04
  • 1
    related: stackoverflow.com/questions/125632/… – matth Aug 10 '15 at 12:49
24

As noted in the comments, texdoc already provides this—as long as your browser is configured to view pdf file in the browser because, at least in firefox, appending #page=123 to the texdoc package url is sufficient to have the requested page opened directly. Examples:

Edit: texdoc links (it seems) always point to the latest version, so absolute references to page number can break when manuals get revised.

Edit: @thewaywewalk points out that it's possible to link directly to a named destination in the pdf by appending #nameddest=<name> to the url. Google turned up this SO question and this Adobe guide on url parameters for pdf links.

  • Section 7.1 of the beamer manual: Link

How are the named destinations created in the first place? hyperref creates them for use with internal hyperlinks (see section 3.2 of the manual), naming each one using its own convention. By using the nameddest url parameter, you can link directly to any locations hyperref creates a named destination for, including section, subsection, figure, table, footnote, etc'.

Edit: Here's a quick python script for listing all named destinations in a given PDF file (pip install PyPDF2):

#!/usr/bin/env python
#
# Invoke from shell as `$ script.py foo.pdf`

import sys
from PyPDF2 import PdfFileReader

pdf = PdfFileReader(open(sys.argv[1], "rb"))
x=pdf.getNamedDestinations()
for n in sorted(x.keys(),key=lambda x:x.rsplit('.',1)[0]):
    print(n)
  • I didn't know it. I'll use in future answers. Thank you for sharing it. – Ignasi Jul 31 '15 at 10:20
  • 2
    @JaredKulik Regarding the breaking of page references. It maybe would work longer if not the pages, but the section directly is linked: e.g. Fontspec section 7.1: texdoc.net/texmf-dist/doc/latex/fontspec/… – thewaywewalk Aug 5 '15 at 7:12
  • #page=123 also works in Chromium (and thus, probably, Chrome). – Keelan Aug 10 '15 at 17:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .