ModelicaSpecification icon indicating copy to clipboard operation
ModelicaSpecification copied to clipboard

Some sections have multiple \label

Open henrikt-ma opened this issue 3 years ago • 2 comments

This is a follow-up of https://github.com/modelica/ModelicaSpecification/pull/3073#issuecomment-1011397360.

We should avoid having a growing number of \label identifiers defined for the same place in the document. For example, we shouldn't have sections labeled like this: https://github.com/modelica/ModelicaSpecification/blob/a7b29803bd8f24211f55bc41ee39ae75ee1259bd/chapters/classes.tex#L74

When fixing this, we should once again discuss the advantages and disadvantages of trying to maintain a word-by-word mapping between actual headings and their labels used for cross referencing. Disadvantages include:

  • Labels change every time a heading is changed.
  • Changing a heading causes diffs across the document, as also all references to it need updating.
  • Some labels become very non-informative, with arbitrary resolution of conflicting labels when similar subsections appear in different parts of the document. For example: \label{examples1} (avoiding a conflict with some other section also named Examples) instead of choosing a more informative label such as \label{external-function-examples}.

An argument in favor of the word-by-word mapping was given in the comment linked above:

However, the main goal with the labels was that you should be able to look at a section and construct the label automatically.

For me, this is not a significant advantage, as always dig up the precise label to use anyway, relying on copy/paste in my editor (or other automated tooling to achieve the same result) to make sure I get it right.

henrikt-ma avatar Jan 26 '22 06:01 henrikt-ma

Poll:

    1. Multiple - keep old (keeps link): Elena, Markus, Gerd, Hans
    1. Only keep old one (keeps link): Henrik, Elena
    1. Only have derived from latest section-heading: Stephan, Markus, Gerd
    1. Only have latest (...) now, but then not change them: Henrik (Masoud and Christoff abstain.) Should verify that also works in LaTeXML. Assuming that there's not change here.

HansOlsson avatar Feb 09 '22 15:02 HansOlsson

I tried this:

Label 1: \cref{declaration-order}

Label 2: \cref{declaration-order-and-usage-before-declaration}

In the HTML, both of these go to the same destination, identified by the the section's id:

                <section id="declaration-order" class="ltx_section">
                    <h2 class="ltx_title ltx_title_section">
                        <span class="ltx_tag ltx_tag_section">4.3 </span>
                        Declaration Order
                    </h2>

Hence, to make sure old links remain valid, one cannot introduce additional labels for the same location in the document.

henrikt-ma avatar Feb 09 '22 23:02 henrikt-ma