[R] FAQ 7.x when 7 does not exist. Useability question

Deepayan Sarkar deepayan.sarkar at gmail.com
Thu Aug 23 22:21:39 CEST 2007


On 8/23/07, Duncan Murdoch <murdoch at stats.uwo.ca> wrote:
> On 8/23/2007 11:28 AM, Prof Brian Ripley wrote:
> > On Thu, 23 Aug 2007, John Kane wrote:
> >
> >> The FAQ Section 7 is a very useful place for new users
> >> to find out any number of R idiosycracies.  However
> >> there is no numbering on the FAQ Table of Content or
> >> on the Sections Tables of Contents.
> >
> > Hmm, doc/FAQ does have a numbered table of contents and numbered sections
> > and doc/manual/R-FAQ.html does have numbered sections and my browser's
> > search finds 7.10 straight away.
>
> I think the suggestion is to change the contents lists in HTML from <ul>
> lists to <ol> lists.  Then one would see
>
>     1. Introduction
>     2. R Basics
>     3. R and S
>     4. R Web Interfaces
>     5. R Add-On Packages
>     6. R and Emacs
>     7. R Miscellanea
>     8. R Programming
>     9. R Bugs
>    10. Acknowledgments
>
> instead of
>
>      * Introduction
>      * R Basics
>      * R and S
>      * R Web Interfaces
>      * R Add-On Packages
>      * R and Emacs
>      * R Miscellanea
>      * R Programming
>      * R Bugs
>      * Acknowledgments
>
> in a browser, and I agree that would be preferable (assuming the
> numbering is consistent with what we get in the other formats).
> However, I don't see how to tell makeinfo --html to do this.  Adding
> --number-sections isn't enough.

A simple CSS hack is to have

ul{
    list-style-type: decimal;
}

in the style. The result can be seen in

http://dsarkar.fhcrc.org/R/RFAQ-1.png

A more sophisticated hack is to have something like

-----------
body{
    counter-reset: chapter;
    counter-reset: section;
}
h2.chapter {
    counter-increment: chapter;
    counter-reset: section;
}

ul {
    list-style-type: none;
}

li:before {
    counter-increment: section;
    content: counter(chapter) "." counter(section) " " ;
}
---------

which results in

http://dsarkar.fhcrc.org/R/RFAQ-2.png

The only problem here is that there is no way to distinguish between
the chapter listing and the section listings (both are <ul
class="menu">). If that could be made to have a different class, the
chapter listing could be improved.

-Deepayan



More information about the R-help mailing list