hackmdio / codimd

CodiMD - Realtime collaborative markdown notes on all platforms.
https://hackmd.io/c/codimd-documentation
GNU Affero General Public License v3.0
9.11k stars 1.05k forks source link

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

Open IvanaGyro opened 1 year ago

IvanaGyro commented 1 year ago

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?

biafffff commented 1 year ago

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. 
IvanaGyro commented 1 year ago

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

biafffff commented 1 year ago

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.

vishalsingh2972 commented 1 year ago

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

IvanaGyro commented 1 year ago

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. 圖片