I've Googled and searched mathstackexchange, but cannot find out how to insert a blue URL reference in a question or answer. Can you give me an example that I can edit it to look at the Latex code?

  • 6
    $\begingroup$ Perhaps you meant markdown and not MathJax? The way to include links is explained in editing help. One possibility is to use this: [editing help](http://math.stackexchange.com/editing-help#links). See also: meta.math.stackexchange.com/questions/845/… In the editor you also have button for inserting links and the keyboard shortcut Ctrl+L works, too. $\endgroup$ Commented Feb 1, 2014 at 7:00
  • $\begingroup$ @MartinSleziak's answer (it should be an answer) is the way to go. In $\LaTeX$, one needs to load hyperref.sty or similar to include hyperlinks. $\endgroup$
    – robjohn Mod
    Commented Feb 1, 2014 at 9:20
  • $\begingroup$ @robjohn If this is indeed what the OP wanted to ask, then I think the question can be closed as a duplicate. $\endgroup$ Commented Feb 1, 2014 at 9:35
  • $\begingroup$ @MartinSleziak: I searched for a previous instance of this question, but could not find one. Do you have one? $\endgroup$
    – robjohn Mod
    Commented Feb 1, 2014 at 10:00
  • $\begingroup$ @robjohn I thought that the question I linked in my first comment could be a reasonable candidate. $\endgroup$ Commented Feb 1, 2014 at 10:22
  • $\begingroup$ @Martin: The link you provide is for having a link included via markdown. What robjohn is suggesting that the question is about including links via MathJax. $\endgroup$
    – Asaf Karagila Mod
    Commented Feb 1, 2014 at 11:09
  • 1
    $\begingroup$ @MartinSleziak: Okay, if the OP intended markdown as you suggest, then yes, it is a duplicate of the question to which you link. If not, then there is no way to add a link within MathJax to my knowledge (and the question seems to be unique). $\endgroup$
    – robjohn Mod
    Commented Feb 1, 2014 at 11:20
  • $\begingroup$ @robjohn: If I recall correctly, t.b. did that at least once. $\endgroup$
    – Asaf Karagila Mod
    Commented Feb 1, 2014 at 13:29
  • $\begingroup$ @AsafKaragila: MathJax has the \href function that inserts hyperlinks. However, as I mention in a comment to AlexR's answer, the MathJax header on MathSE contains Macros: { href: "{}" }. Davide Cervone explains that \href is disabled since it is not considered safe. Perhaps t.b. did his magic before \href was disabled. $\endgroup$
    – robjohn Mod
    Commented Feb 1, 2014 at 15:18
  • $\begingroup$ @robjohn: See Davide's answer. I think that this is what I remembered being done. $\endgroup$
    – Asaf Karagila Mod
    Commented Feb 4, 2014 at 16:32
  • $\begingroup$ @AsafKaragila: oh, I remember doing that. I thought you were talking about a link to a URL. $\endgroup$
    – robjohn Mod
    Commented Feb 4, 2014 at 16:48
  • $\begingroup$ I want to insert a hyperlink in MathSE and in chatroom using ctrl L but it is not working $\endgroup$
    – Manjoy Das
    Commented May 5, 2020 at 19:51

2 Answers 2


@AlexR's suggestion can be implemented using \label and \eqref macros in order to get links from within an equation to another equation (but only such links). E.g.

$$\sin^2(\theta) + \cos^2(\theta) = 1\tag{1}\label{dpvc-1}$$

and then a link in the text: \eqref{dpvc-1} is due to the Pythagorean theorem, and

$$\cos^2(\eta) + \sin^2(\eta)-1 \stackrel{\eqref{dpvc-1}}= 0$$


Note, however, that you do face the problem described in this post when using labels. There is a work-around using the SOUP script.


See here for a reference, however this does not seem to work on this site:
$$E \href{javascript:alert("Einstein says so!")}{=} mc^2$$ (C&P'ed the example from the MathJax page):
$$E \href{javascript:alert("Einstein says so!")}{=} mc^2$$


If Links are really required, try this:

$$\sin^2(\theta) + \cos^2(\theta) = 1\tag{1}$$ (1) Is due to the pythagorean theorem $$\cos^2(\eta) + \sin^2(\eta)-1 \stackrel{(1)}= 0$$

  • $\begingroup$ I tried \href because it is listed here, but, as you say, it is not enabled here. $\endgroup$
    – robjohn Mod
    Commented Feb 1, 2014 at 11:45
  • $\begingroup$ @robjohn Is there anyone (SE employee?) who can officially confirm this? $\endgroup$
    – AlexR
    Commented Feb 1, 2014 at 11:46
  • $\begingroup$ I tried this example on a local page to which I have added a MathJax header. The example works on my local page, but I see Macros: { href: "{}" } in the MathJax header on the pages here, and that disables \href. $\endgroup$
    – robjohn Mod
    Commented Feb 1, 2014 at 12:18
  • 5
    $\begingroup$ The \href macro is considered "unsafe" because it can allow answers to include javascript (like the alert in AlexR's message), and that means that posts could include evil code that a user could trigger inadvertently. MathJax now includes a safe extension (see the documentation and options for details) that disables all such macros, but SE hasn't updated to use that. Note that you can configure \href to allow http:// references but not javascript:// ones. $\endgroup$ Commented Feb 1, 2014 at 13:01
  • $\begingroup$ @Davide Imo this is a major flaw, about which I've been meaning to make a feature request. Often I want to post a long proof (e.g. in an \eqnarray) where each line links to prior answers to justify the inferences. To insert the links, I have to break it into numerous MathJax lines, so losing the two-dimensional alignment afforded by the array. For me, this is one of the greatest pains currently in MathJax (besides the frequent Chrome crashes). Is there any workaround? $\endgroup$ Commented Feb 2, 2014 at 0:40
  • $\begingroup$ @BillDubuque You could use \tag{1} to set reference "labels" at the right: $$a^2+b^2=c^2 \tag{1}$$ $$c \stackrel{(1)}= \sqrt{a^2+b^2}$$ $\endgroup$
    – AlexR
    Commented Feb 2, 2014 at 15:10
  • 1
    $\begingroup$ It is not clear to me what "this" refers to when you say "this is a major flaw", the fact that SE has disabled \href (the subject of the comments above yours) or that you haven't been able to make a link from a line of an alignment (a new topic). I suspect it is the latter, but in that case, you should be posting a new question, not asking a new one in comments. Indeed, since \href is not enabled in SE, it would be better to do it on the Mathjax forum, since none of what you are discussing can be done here. $\endgroup$ Commented Feb 2, 2014 at 16:14
  • $\begingroup$ In any case, the answer to your question would require more than just a comment from me, but since it is not an answer to the original post, I am not able to use an answer, here. If you post to the MathJax forum (or make a new question here in meta), I will respond there. Note, however, that you can't use \href to make link from an entire line of an \eqnarray in $\rm\TeX$ either, so I'm not sure why you would expect to be able to in MathJax, and personally I don't consider this a flaw, let alone a major one. There are some things you could do to get the effect I think you want, however. $\endgroup$ Commented Feb 2, 2014 at 16:17
  • $\begingroup$ @BillDubuque, forgot to tag you, so weren't sure you'd see the two comments above. $\endgroup$ Commented Feb 2, 2014 at 17:15
  • $\begingroup$ @Davide I am requesting the same functionality as the OP, i.e. the ability to embed a URL in MathJax code. Does that functionality currently exist? If not, can it be provided? $\endgroup$ Commented Feb 2, 2014 at 17:57
  • $\begingroup$ @Bill, yes, as pointed out by AlexR, MathJax supports the \href command (he links to the docs as well). But StackExchange has disabled it, as indicated by robjohn. That is not a flaw in MathJax, so your comment was confusing. The inclusion of \eqnarray into the mix led me astray since I thought you were talking about not being able to use \href across the column breaks (which you can't, but that is also true in $\rm\LaTeX$). The fact that you are breaking up the alignment in order to use Markdown links around the lines is not a flaw in MathJax either, so that was a confusion as well. $\endgroup$ Commented Feb 2, 2014 at 19:23
  • $\begingroup$ I pointed out that the safe extension allows a more fine-grained control over the URL's that can be included in \href, and that javascript: URL's can be excluded while http: and https: ones are allowed. So yes, MathJax provides the functionality, but SE disables it, and yes, it could be provided safely if they chained the configuration. But since all that was said before your comment, I was confused about what additional information you were after. $\endgroup$ Commented Feb 2, 2014 at 19:29
  • 2
    $\begingroup$ @Bill, the ability to separate safe from unsafe URL's did not exist in MathJax before several months ago, which is why SE had the entire macro disabled. At this point, it is a matter of getting the SE developers' attention rather than a capabilities issue. It was not clear from your message that you meant only http:, https: and ftp: links, since you said "urls", which includes all protocols. You seemed confused by why SE would have disabled \href, which is why I tried to explain it (not defend it). $\endgroup$ Commented Feb 2, 2014 at 22:43
  • 1
    $\begingroup$ @Bill, actually not. It is a support request, which is asking about how to use the current features of the site. It has already been marked as "status-bydesign" (correctly), with no additional comment. I suggest you make a question tagged as "feature-request" that asks for enabling of the MathJax safe extension. $\endgroup$ Commented Feb 3, 2014 at 11:45
  • 2
    $\begingroup$ @BillDubuque I've opened a feature-request over here $\endgroup$
    – AlexR
    Commented Feb 3, 2014 at 12:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .