Search code examples
htmldocumentationlatexdocumentation-generation

Equivalent of LaTeX's \label and \ref in HTML


I have an FAQ in HTML (example) in which the questions refer to each other a lot. That means whenever we insert/delete/rearrange the questions, the numbering changes. LaTeX solves this very elegantly with \label and \ref -- you give items simple tags and LaTeX worries about converting to numbers in the final document.

How do people deal with that in HTML?

ADDED: Note that this is no problem if you don't have to actually refer to items by number, in which case you can set a tag with

<a name="foo">

and then link to it with

<a href="#foo">some non-numerical way to refer to foo</a>.

But I'm assuming "foo" has some auto-generated number, say from an <ol> list, and I want to use that number to refer to and link to it.


Solution

  • Here's how I ended up solving this with a php script:

    http://yootles.com/genfaq

    It's roughly as convenient as \label and \ref in LaTeX and even auto-generates the index of questions. And I put it on an etherpad instance which is handy when multiple people are contributing questions to the FAQ.