[racket] scribble secref does not render consistently between HTML and PDF

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Mon Apr 4 08:17:53 EDT 2011

Since PDF is intended for the world of printed papers, the 
rendering process follows the grammatical rules of the printed
media. Those dictate that sections, chapters, etc. are referred
to via numbers. Why those conventions developed the way they 
did is beyond the scope of this email but we try to stay with it. 

Since HTML is about hyperlinked media, the purpose of links to
chapters is quite different (you want something easily seen as
a link, think <a href="1.html>1</a> vs <a href="1.html>Introduction</a>). 
So scribble follows these conventions, too. 



On Apr 4, 2011, at 6:05 AM, Tim Brown wrote:

> I'm writing some general documentation with scribble and have, so far,
> been generating HTML output.
> 
> I'm now moving to PDF/Latex output, and the @secref calls are not being
> rendered consistently between my output formats. In --html, --htmls and
> --text rendering modes, secref renders the title of the section. But with
> --latex and --pdf, the link destination is rendered as the section number
> "section n.n" (this string is not hyperlinked, either -- something I can
> half tolerate, since it's going to printed media).
> 
> Scribble's secref documentation states:
> 
>> Inserts the hyperlinked title of the section tagged tag, but elements in
>              ^^^^^^^^^^^^^^^^^
>> the title content with the 'aux style property are omitted in the
>> hyperlink label.
> 
> My latex is:
> -----------------------------------------------------------------------
> $ pdflatex tim.tex
> This is pdfTeX, Version 3.1415926-1.40.11 (TeX Live 2010)
> restricted \write18 enabled.
> entering extended mode
> -----------------------------------------------------------------------
> 
> Is this a problem with scribble/latex/their interaction or my reading of
> the documentation?
> 
> Help much appreciated. Thanks,
> 
> Tim
> 
> 
> 
> Scribble source:
> -----------------------------------------------------------------------
> #lang scribble/base
> @section[#:tag "s-1"]{First Section}
> @section[#:tag "s-2"]{Second Section}
> Check out @secref{s-1} for more info!
> @(version)
> -----------------------------------------------------------------------
> 
> 
> Text output:
> -----------------------------------------------------------------------
> 
> 
> 
> 1. First Section
> 
> 
> 
> 2. Second Section
> 
> Check out First Section for more info!
> 
> 5.1
> 
> -----------------------------------------------------------------------
> 
> HTML output (snippet):
> -----------------------------------------------------------------------
> <div class="main">
> <h3>1<tt>&nbsp;</tt><a name="(part._s-1)"></a>First Section</h3>
> <h3>2<tt>&nbsp;</tt><a name="(part._s-2)"></a>Second Section</h3>
> <p>Check out <a href="#(part._s-1)" pltdoc="x">First Section</a>
> for more info!</p><p>5.1</p></div></div>
> <div id="contextindicator">&nbsp;</div>
> -----------------------------------------------------------------------
> 
> .tex output (from --latex):
> -----------------------------------------------------------------------
> 
> %   ...
> % Generated by `secref'; first arg is section number, second is section title:
> \newcommand{\BookRef}[2]{\emph{#2}}
> \newcommand{\ChapRef}[2]{\SecRef{#1}{#2}}
> \newcommand{\SecRef}[2]{section~#1}
> % Generated by `Secref':
> \newcommand{\BookRefUC}[2]{\BookRef{#1}{#2}}
> \newcommand{\ChapRefUC}[2]{\SecRefUC{#1}{#2}}
> \newcommand{\SecRefUC}[2]{Section~#1}
> %   ...
> %%% [snip]
> %   ...
> \section[First Section]{First Section}\label{t:x28part_x22sx2d1x22x29}
> 
> 
> 
> \sectionNewpage
> 
> \section[Second Section]{Second Section}\label{t:x28part_x22sx2d2x22x29}
> 
> Check out \ChapRef{1}{First Section} for more info!
> 
> 5.1
> -----------------------------------------------------------------------
> 
> BUT:.pdf output (cut and paste from acroread):
> -----------------------------------------------------------------------
> 1 First Section
> 2 Second Section
> Check out section 1 for more info!
> 5.1
> -----------------------------------------------------------------------
> 
> 
> --
> Tim Brown <tim.brown at cityc.co.uk>  | City Computing Limited            |
> T: +44 20 8770 2110                | City House, Sutton Park Road      |
> F: +44 20 8770 2130                | Sutton, Surrey, SM1 2AE, GB       |
> -----------------------------------------------------------------------|
> BEAUTY:  What's in your eye when you have a bee in your hand           |
> -----------------------------------------------------------------------'
> City Computing Limited registered in London No. 1767817.
> Registered Office: City House, Sutton Park Road, Sutton, Surrey, SM1 2AE
> VAT number 372 8290 34.
> 
> _________________________________________________
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users




Posted on the users mailing list.