Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • M MathJax
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 304
    • Issues 304
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 15
    • Merge requests 15
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • MathJax
  • MathJax
  • Issues
  • #2736
Closed
Open
Issue created Jul 14, 2021 by Administrator@rootContributor

Separately Formatting Tags in Environments Versus References (`tagformat`)

Created by: geometrian

Is your feature request related to a problem? Please describe.

The tagformat option is really great as far as it goes, but (as far as I can tell) it's missing a way to format the reference and the referent separately.

To clarify: the particular use-case would be something like having the equation number inside the \begin{equation}/\end{equation} block be "(1)", but the equation reference \eqref{...} be "Equation 1" (the whole thing linked to the equation). That is, the following source:

\begin{equation}
    f(x) = x^2
    \label{eq:quadratic}
\end{equation}

<p>A simple quadratic function is given in \eqref{eq:quadratic}.</p>

Would render something like:

    f(x) = x^2        (1)

A simple quadratic function is given in Equation 1.

This evokes established LaTeX style in some fields.

However, as it is, the configured function MathJax.tex.tagformat.tag is used for both places, making this apparently impossible.

Describe the solution you'd like

Put simply, I would like to see a way to do this added into MathJax.

I don't want to say how this must be done, but perhaps the way it might be exposed would be to make another function (reftag? eqref?) inside tagformat that by default calls tag. This solution has the advantage of preserving backward-compatibility.

The config for the above use-case would then be something like:

MathJax = {
    loader: { load: [ "[tex]/tagformat" ] },
    tex: {
        //...
        tags: "ams",
        packages: { "[+]": [ "tagformat" ] },
        tagformat: {
            tag:    (tag) => "("+tag+")",
            reftag: (tag) => "Equation "+tag,
        }
    }
    //...
};

Describe alternatives you've considered

Not really applicable; the alternative is to not support this feature. As before, that would be a shame since certain fields require this formatting.

If this feature is already supported, then it should be documented.

Additional context

Not applicable.

Assignee
Assign to
Time tracking