1

I want to access this site say, https://en.wikipedia.org/wiki/Cricket#History

Now I want the specific section 'History' to be shown as soon as I open the link

In overleaf I did this, \href{https://en.wikipedia.org/wiki/Cricket#History}{link} But it gives me this error -> llegal parameter number in definition of \Hy@tempa, and when I open the link after compiling even if it get an error I get this -> https://en.wikipedia.org/wiki/Cricket##History, 2 '#' and is wrong

How do I fix this?

4
  • Welcome to TeX.SX! Did you see: tex.stackexchange.com/q/106514/47927 ? If this does not answer your question, please consider providing a minimal working example (MWE), so it becomes clear what packages you use etc. Commented Nov 24, 2023 at 18:10
  • To expand a bit on thie above comment: Normally, if you use the \url command that is used by the \href command internally, you should be able to use # for the URL just like this. There might be a situation where this does not work, but then you should be able to use \# instead of # (which still will become # in the link in the final document). Commented Nov 24, 2023 at 18:17
  • 2
    Possible duplicate: hash-tag in \href causes error Commented Nov 24, 2023 at 18:56
  • You seem to have some conflict with packages Commented Nov 24, 2023 at 19:49

1 Answer 1

0

The \# escapes the hash symbol, ensuring that LaTeX interprets it as part of the URL rather than as a special character.

\documentclass{article} \usepackage{hyperref} \begin{document} This is an example of how to link to a specific section in a Wikipedia article. Click on the following link to go to the 'History' section of the cricket page on Wikipedia: \href{https://en.wikipedia.org/wiki/Cricket\#History}{Cricket History}. \end{document} 
3
  • Your example works just as well without escaping # Commented Nov 24, 2023 at 19:37
  • There might be some conflict between packages in the question Commented Nov 24, 2023 at 19:51
  • That's why it is better to wait until a question is clear enough before answering. Commented Nov 24, 2023 at 19:57

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.