codimd icon indicating copy to clipboard operation
codimd copied to clipboard

How to link to a title in the same document by MathJax `\href`?

Open IvanaGyro opened this issue 2 years ago • 5 comments

I know we can create a link by \href with MathJax.

$$
\href{https://this.is.a.doc/}{\text{this is a doc}}
$$

However, it seems that \href only works when the link starts with http(s)://. I want to link to a title in the same document.

$$
\href{#the-title-in-the-same-document}{=}
$$

Is it possible?

IvanaGyro avatar Jan 18 '23 14:01 IvanaGyro

If you are trying to cross-reference inside the same document, I've found this solution.

### Overview section

Please visit the [Overview section](#Overview-section) to find additional information. 

biafffff avatar Mar 02 '23 16:03 biafffff

I am finding a solution in LaTeX (MathJax), not in pure markdown.

IvanaGyro avatar Mar 02 '23 16:03 IvanaGyro

If so you will need to label your Section/subsection/table/figure/equation \label{sec:overview} and reference them using the command \ref{sec:overview} or \eqref{eq:blackandscholes} for equations.

biafffff avatar Mar 03 '23 17:03 biafffff

is this issue still up? would like to give it a try @IvanaGyro

vishalsingh2972 avatar Jun 25 '23 12:06 vishalsingh2972

I tried. MathJax doesn't handle the references and the labels right.

Here is an example.

$$
\begin{equation}
  \int_0^\infty \frac{x^3}{e^x-1}\,dx = \frac{\pi^4}{15}
  \label{example}
\end{equation}
$$

this is eq $\ref{example}$

And this is the rendering result. 圖片

IvanaGyro avatar Jun 25 '23 17:06 IvanaGyro