Open holtzermann17 opened 11 years ago
\label does translate into something predictable and useful, akin to a fragment identifier of the XML element which the label gets glued onto. However, that "useful and predictable" part is currently completely internal to LaTeXML, when it comes to the interplay with \ref.
In the final XHTML source, the \label-\ref interplay is realized via the xml:id
attributes. So you can usually base any further features on those.
OK, I see - we can currently use \label and \ref together in a single document. But the long-term interest here would be in linking between documents (e.g. two different sections of a book). I'm not sure how we'd realize this - but the current style (look at the source and find the relevant id
) can probably be improved upon, both in terms of interactive use and possible programmatic interaction. For instance, our old trick of adding RDFa might help with generating world-visible labels -- hooking into these with \ref would then presumably require some post-processing routine (similar to the way the NNexus integration module works).
Global refs on the web are just plain old HTML links. Requesting \label and \ref that transcend the document scope is probably unrealistic.
Oh, in order to have "Link to here" interactions, you could utilize JOBAD for some nice interactive services. You can even have a JOBAD service that gives you the link in a LaTeX \href{link} command. (or whatever the right command would be).
JOBAD "Link to here" sounds good!
Also, I think adding RDFa from \label and \ref would allow us to transcend the individual document level with inter-links generated via a post-processing script. (That part would almost be a NNexus "plugin".)
What is needed here is some way to express the fact that a certain id corresponds to a certain label in the HTML output. For instance, in the example Joe and I presented above, we would want to have the output state somewhere that the label "here" is associated with the paragraph whose id is "S0.SS0.SSS0.P1".
Once that information becomes exposed in the output, the labels will effectively transcend the document scope. With this information in hand, one could for instance extract the sort of link Joe mentioned from the HTML or define a \PMref command which would work like \ref but takes a canonical name as an extra argument and generates a suitable link. For instance, if I wanted to refer to the labeled paragraph in a different article, I might type \PMref{here}{ LabelTest} and have it output a link to http://metameso.org/beta/labeltest#S0.SS0.SSS0.P1 with anchor text "my-example".
Alternatively, one could maybe leave "\ref" as "\ref" in the text but have some sort of command which I'll call \PMExtLabel that tells it to look for a label in some other entry.. So, in the case discussed in the last paragraph, I might add "\PMExtLabel{here}{LabelTest}" to my preamble so that the system could understand "\ref{here}" as referring to "\label{here}" in the entry LabelTest and act accordingly. For the purpose of the book project, this would be a most convenient approach because it would mean that one could leave the body alone and simply have the preamble generator point out where to look for labels.
There are two paths you can take here. One is to stay safe and stick to the simple web paradigm of using regular HTML links, which you can already do.
The other is to start thinking about editing and cross-referencing multi-source LaTeX documents on the web, and that lands you in a whole new paradigm of authoring/publishing that has a variety of challenges. The really big issue is the change management of the various pointers between documents, during the authoring phase, when content is rapidly evolving. To address that in real-time, you need a Book Planetary module, that oversees the process and monitors the global state of affairs.
We have been down that road back when Planetary was implemented with the Vanilla forum, and have a writeup of the overall challenges and solutions in our Sepublica 2011 paper. Michael ( @kohlhase ) has always held this problem in high interest.
The gist of that paper is - if you want to address change management, you need to postpone the phase of resolving labels and references to the actual rendering of the HTML page, and not during the LaTeXML conversion which is the default for generating static HTML.
The Book module can then fill the references during rendering, so that a) the HTML links and b) the narrative numbering (e.g. Section 3.23) are current with the state of the (distributed) manuscript.
You also need a mechanism for transclusion of content, which is something Michael had implemented in sTeX when we submitted that paper.
There is a newer version of the paper Deyan submitted at http://kwarc.info/kohlhase/papers/cicm13-sepcomp.pdf And indeed, I think that this is the way the problem of narrative links should be addressed. I am still hoping that we will be able to get this going in planetary some time soon.
It would be nice for users to be able to extract a link like: http://planetmath.org/15producttypes#Thmrmk1 when mousing over "Remark 1".
As another related question: @dginev can we get
\label{here}
to translate into anything predictable/useful in the source?Here's an example that @rspuzio and I came up with (http://metameso.org/beta/node/87626/source)