Nesting Nightmares

I am trying to place this in my document

Of course, if you have access to wolframalpha you can do this:

\href{https://www.wolframalpha.com/input/?i=interpolatingpolynomial%7B%7Bx_0,y_0%7D,%7Bx_1,y_1%7D,%7Bx_2,y_2%7D%7D}{ interpolatingpolynomial{{x_0,y_0},{x_1,y_1},{x_2,y_2}} }


and I get an error message about a missing $. If I tell TexShop to Run anyway it produces Clearly I have to escape curly braces.... and adding a \ to each of the curly braces belonging to interpolatingpolynomial, I get All good.... BUT, is there some way to a) avoid the compiler initially choking so I don't have to tell it to Run anyway, and b) make this simpler? • Is this the best I can do: \href{wolframalpha.com/input/…}{$ interpolatingpolynomial\{\{x_0,y_0\},\{x_1,y_1\},\{x_2,y_2\}\} $} Dec 19, 2018 at 17:56 • What you need is the \url{} command from \usepackage{url}, I think. Dec 19, 2018 at 17:58 • @MarcGrober It's not customary to add a “solved” tag to the title. The presence of an accepted answer is sufficient. Dec 20, 2018 at 22:21 • @egreg I wanted to an image of what the text looked like after the usage recommended, especially in light of the discussion under the proposed solution. It appeared that I could not do that unless I amended my initial post, or answering my own question, but just amending the initial post without indicating that it contained info about the solution seemed as inappropriate as adding an answer to my question which was simply a restatement of someone else's answer. Dec 22, 2018 at 0:15 1 Answer You must use math mode to typeset the math-y part of the explanatory string. And, be sure to write \{ and \} to generate curly braces. You could place the math part of the second argument of \href in a \detokenize wrapper. This will render the characters in the string "as is", i.e., without any TeX-special meaning. However, I strongly suspect that this would be doing your readers a serious disservice. \documentclass{article} \usepackage[T1]{fontenc} \usepackage[hyphens,spaces]{url} \usepackage[colorlinks,allcolors=blue]{hyperref} \begin{document} \href{https://www.wolframalpha.com/input/?i=interpolatingpolynomial%7B%7Bx_0,y_0%7D,%7Bx_1,y_1%7D,%7Bx_2,y_2%7D%7D}{ interpolatingpolynomial$\{\{x_0,y_0\},\{x_1,y_1\},\{x_2,y_2\}\}\$ }

\medskip
\href{https://www.wolframalpha.com/input/?i=interpolatingpolynomial%7B%7Bx_0,y_0%7D,%7Bx_1,y_1%7D,%7Bx_2,y_2%7D%7D}{
interpolatingpolynomial\detokenize{{{x_0,y_0},{x_1,y_1},{x_2,y_2}}}}
\end{document}

• I would argue that the reader should see what they would type into Wolfram Alpha, which would be the detokenize version. Dec 19, 2018 at 19:33
• @Teepeemm - What readers would need to type into the web browser address line is the first argument of \href, but that isn't visible to readers.
– Mico
Dec 19, 2018 at 20:29
• But the point seems to be "here's what you can type into the Wolfram Alpha search box", in which case Wolfram can make sense of the input interpolatingpolynomial{{x_0,y_0},{x_1,y_1},{x_2,y_2}}. On the other hand, if OP's context is "since you know the six values, you can use this command, but substitute your values", then your first option would be best. Dec 19, 2018 at 20:39
• @Teepeemm - The second option was meant to address the OP's question, "is there some way to a) avoid the compiler initially choking so I don't have to tell it to Run anyway, and b) make this simpler?" Using \detokenize is, hopefully, reasonably simple; however, IMNSHO, the result really doesn't look that great. Of course, the OP may decide to just omit the math stuff entirely. I don't think that any of his/her readers would mind, and it would be the simplest solution.
– Mico
Dec 19, 2018 at 20:45
• The detokenize is precisely what I needed. Thanks @Teepeemm. The intent in the document is to provide the URL via the href URL only (the URL actually includes the problem data so clicking on the link presents the entire problem with solution in WA), while providing the text of what the user would enter in WA as a demonstration of the specifics of the generic commend first introduced in the text above the reference. Dec 20, 2018 at 20:37