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?
2 Answers
@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$$
follows.
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$$
Suggestion
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$ @robjohn Is there anyone (SE employee?) who can officially confirm this? $\endgroup$– AlexRCommented 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 ModCommented 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 asafe
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 allowhttp://
references but notjavascript://
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$– AlexRCommented 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 thatjavascript:
URL's can be excluded whilehttp:
andhttps:
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:
andftp:
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
[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$hyperref.sty
or similar to include hyperlinks. $\endgroup$\href
function that inserts hyperlinks. However, as I mention in a comment to AlexR's answer, the MathJax header on MathSE containsMacros: { 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$