[racket] Scribble secref unlinked in PDF output

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Thu Dec 5 09:33:40 EST 2013

Scribble runs Latex multiple times to produce PDF.

The problem is that \label{} was being used in a context where
\refstepcounter{} wasn't used to set the target of the label. (Thanks
to Robby for sending me on the right path.)

I've pushed a repair.

At Thu, 5 Dec 2013 09:10:30 -0500, Sam Tobin-Hochstadt wrote:
> Could this be a situation where TeX needs to be run multiple times to
> get the correct result?  I believe that Scribble currently runs TeX
> only once.
> 
> Sam
> 
> On Thu, Dec 5, 2013 at 8:45 AM, Tim Jervis <tim at timjervis.com> wrote:
> > Hi Matthew,
> >
> > Perhaps it is related to how figures are moved about during rendering.
> >
> > I'm attaching an example source file, test.scrbl, and the PDF output after 
> running "scribble --pdf test.scrbl".
> >
> >
> >
> >
> >
> > When I open the PDF on my system with Preview, the links to figures 1 and 2 
> take me to the wrong pages.
> >
> > When I remove the padding text in the source and re-run scribble, the links 
> go to the right place in the resulting PDF.
> >
> > Kind regards,
> >
> >
> >
> > Tim
> >
> > On 5 Dec 2013, at 13:25, Matthew Flatt <mflatt at cs.utah.edu> wrote:
> >
> >> I wonder whether it's a limitation of \hyperref and figures. When the
> >> link goes to the wrong place, does it go to the place where the figure
> >> would be in the source of the document, as opposed to where it's moved
> >> to in the output?
> >>
> >> At Thu, 5 Dec 2013 09:24:53 +0000, Tim Jervis wrote:
> >>> Thanks Matthew. As it happens I did get so far as to adjust the \FigureRef
> >>> macro as you have in your change, but the results on some of my PDF outputs
> >>> have the links going to the wrong pages.
> >>>
> >>> For example, I have a PDF with a link on page 5 of 115 to a figure on page 
> 6
> >>> of 116. However, a hover over the link in Preview says "Go to page 4", 
> while
> >>> clicking on the link takes me to page 5 of 115. But, some of the figures in
> >>> the document do link correctly.
> >>>
> >>> I appreciate this isn't much to go on; I will try to get a clearer example 
> of
> >>> the issue.
> >>>
> >>> On 5 Dec 2013, at 02:22, Matthew Flatt <mflatt at cs.utah.edu> wrote:
> >>>
> >>>> Yes, it's about the same, where it's just a matter of adjusting the
> >>>> \FigureRef Latex macro.
> >>>>
> >>>> I've pushed the change.
> >>>>
> >>>> At Thu, 5 Dec 2013 01:50:53 +0000, Tim Jervis wrote:
> >>>>> Dear Matthew,
> >>>>>
> >>>>> Is there a similarly easy change to tweak the Figure package to do the 
> same
> >>>>> thing for references to figures?
> >>>>>
> >>>>> I've started to hack away but I have not got to the bottom of decoding 
> the
> >>>>> link mechanism.
> >>>>>
> >>>>> Kind regards,
> >>>>>
> >>>>>
> >>>>>
> >>>>> Tim
> >>>>>
> >>>>> On 3 Nov 2013, at 17:11, Matthew Flatt <mflatt at cs.utah.edu> wrote:
> >>>>>
> >>>>>> I've change Scribble to hyperlink section references by default in
> >>>>>> LaTeX/PDF output.
> >>>>>>
> >>>>>> The change turned out to be easy, due to improvements back in July that
> >>>>>> deliver a LaTeX-level label to macros that render section links (when
> >>>>>> the referenced section is within the same document).
> >>>>>>
> >>>>>> At Wed, 23 Oct 2013 23:02:27 +0100, Tim Jervis wrote:
> >>>>>>> Dear Racket Users,
> >>>>>>>
> >>>>>>> I have been writing a document in Scribble, without output to PDF. The
> >>>>> table
> >>>>>>> of contents of the PDF nicely links the entries in the table to the
> >>>>> sections
> >>>>>>> in the document, so that when viewing the PDF on screen rather than
> >>> paper,
> >>>>> one
> >>>>>>> can click or tap on a line in the table of contents to quickly navigate
> >>> to
> >>>>> the
> >>>>>>> relevant section. Unfortunately, if I add a secref element in the body 
> of
> >>>>> the
> >>>>>>> document, it is not rendered in the same way and the secref elements 
> are
> >>>>> not
> >>>>>>> clickable on screen.
> >>>>>>>
> >>>>>>> My investigation into this so far has revealed to me that the table of
> >>>>>>> contents linking appears to be handled with the LaTeX Hyperref package,
> >>> and
> >>>>> is
> >>>>>>> taken out of Scribble's hands.
> >>>>>>>
> >>>>>>> For HTML output, Scribble seems able to render links just fine. I 
> wonder
> >>> if
> >>>>>>> Scribble has been written without the notion that PDF output might be
> >>>>> viewed
> >>>>>>> on screen, so the link elements have been neglected.
> >>>>>>>
> >>>>>>> In any event, is there a way to render a PDF with "live" secref links, 
> to
> >>>>> give
> >>>>>>> similar functionality to the table of contents?
> >>>>>>>
> >>>>>>> Kind regards,
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>> Tim
> >>>>>>>
> >>>>>>> Tim Jervis
> >>>>>>>
> >>>>>>> http://timjervis.com/
> >>>>>>>
> >>>>>>> ____________________
> >>>>>>> Racket Users list:
> >>>>>>> http://lists.racket-lang.org/users
> >>>>>
> >>>>>
> >>>>>
> >>>>> Tim Jervis
> >>>>>
> >>>>> http://timjervis.com/
> >>>
> >>>
> >>>
> >>> Tim Jervis
> >>>
> >>> http://timjervis.com/
> >
> >
> >
> > Tim Jervis
> >
> > http://timjervis.com/
> >
> >
> > ____________________
> >   Racket Users list:
> >   http://lists.racket-lang.org/users
> >
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users

Posted on the users mailing list.