0

I would like to attach a link to the name of an article (which doesn't have a DOI) in BibTex. I am using the JHEP style for the bibliography. However, the command \href{}{} does not work in the BibTeX file. For example, I can not see the name of the following article in the resulting pdf file

\documentclass[11pt,a4paper]{article}
\usepackage{jheppub}
\usepackage[utf8]{inputenc}
\usepackage{amsmath, amsthm, mathtools}
\usepackage{hyperref}
\hypersetup{urlcolor=Aquamarine, citecolor=red, linkcolor=Emerald}

\begin{document}

We use the results of \cite{MeeksPatrusky1978a}.

\end{document}

The BibTex item is

@article{MeeksPatrusky1978a,
    author = "Meeks, William H. and Patrusky, Julie",
    fjournal = "Illinois Journal of Mathematics",
    journal = "Illinois J. Math.",
    month = "06",
    number = "2",
    pages = "262--269",
    publisher = "Duke University Press",
    title = "{\href{https://projecteuclid.org:443/euclid.ijm/1256048735}{Representing Homology Classes by Embedded Circles on a Compact Surface}}",
    volume = "22",
    year = "1978"}

I am using the latest version of Texstudio. Any comment would be appreciated.

P.S. I have checked all the other relevant posts. I couldn't find the solution in any of them.

  • 1
    Are you using \usepackage{hyperref} in your document at all? – user31729 Jan 27 at 8:56
  • @ChristianHupfer yes, I am using that package. – QGravity Jan 28 at 4:55
  • No, I just want the article to have a link to the publication webpage. – QGravity Feb 15 at 6:07
2

Apart from irrelevant errors caused by your MWE being incomplete, I get no errors, and in the absence of a log or something I can't guess what's going wrong.

But I suggest this is the wrong way to do things if you are trying to use the JHEP style properly. It recognises an "eprint" field which, if provided, will hyperlink the journal reference. I'd suggest that is probably the "official" and better way to achieve your aim while sticking to the particular style you are using. After all, the whole point of providing styles is to produce consistency! (A "doi" would be even better, if there is one.)

\documentclass[11pt,a4paper]{article}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{MeeksPatrusky1978a,
    author = "Meeks, William H. and Patrusky, Julie",
    fjournal = "Illinois Journal of Mathematics",
    journal = "Illinois J. Math.",
    month = "06",
    number = "2",
    pages = "262--269",
    publisher = "Duke University Press",
    title = "Representing Homology Classes by Embedded Circles on a Compact Surface",
    eprint = "https://projecteuclid.org:443/euclid.ijm/1256048735",
    volume = "22",
    year = "1978"}
\end{filecontents}
\usepackage{jheppub}

\usepackage[utf8]{inputenc}
\usepackage{amsmath, amsthm, mathtools}
\usepackage{hyperref}
\bibliographystyle{jhep}

\begin{document}

We use the results of \cite{MeeksPatrusky1978a}.

\bibliography{\jobname.bib}

\end{document}

Produces output from LaTeX code

  • Thank you for the nice answer. However, I don't get any error. The point is that I use the \hyperref package, and I expect that it would work in the BibTex file, I mean the file with .bib extension. However, it seems that the command \href{}{} does not work in the BibTex file. The code that I wrote in the question should attach a link to the name of article. However, it doesn't. My question is why it does not do it. However, you are saying that it works so I am not sure what is wrong. – QGravity Jan 29 at 9:30
  • Just a question, when you compile the code I wrote in the question, do you get a clickable link on the name of the article in the bibliography section? – QGravity Jan 29 at 9:34
  • I did, I think. I have since deleted the file. – Paul Stanley Jan 29 at 10:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.