4

Phys Rev journals offer direct BibTeX output for each paper e.g. as here that is very handy to just copy-paste in a BibTeX file:

@article{EXP_stack,
  title = {Calculation of Multichannel Reactions in the Four-Nucleon System above Breakup Threshold},
  author = {Deltuva, A. and Fonseca, A. C.},
  journal = {Phys. Rev. Lett.},
  volume = {113},
  issue = {10},
  pages = {102502},
  numpages = {5},
  year = {2014},
  month = {Sep},
  publisher = {American Physical Society},
  doi = {10.1103/PhysRevLett.113.102502},
  url = {http://link.aps.org/doi/10.1103/PhysRevLett.113.102502}
}

and when you cite it, it will appear e.g. as 26th entry:

[26] A. Deltuva and A. C. Fonseca, Phys. Rev. Lett. 113, 102502 (2014), URL http://link.aps.org/doi/ 10.1103/PhysRevLett.113.102502.

This by default has also the URL at the end which is indeed very useful to include for easy access. But for the final version to submit, it should not have it.

Question: How can I exclude the URL? Even when I get the .bbl file from BibTeX and copy-paste it at the end of LaTeX file, this remains. Obviously, I don't want to remove them by hand/sed/grep from my main BibTeX file.

As a 99 % solution, I found that adding these lines

\def\urlprefix{}
\def\url#1{}

removes JUST the URL but the , and . remain so the output is:

[26] A. Deltuva and A. C. Fonseca, Phys. Rev. Lett. 113, 102502 (2014), .

Any idea of a clean solution?

\documentclass[aps,prl,twocolumn]{revtex4-1}
\begin{document}
\title{Stack Question}
\author{John Smith}
\maketitle
How to cite now? \cite{EXP_stack}
\bibliography{stack}
\bibliographystyle{apsrev}
\end{document}
egreg
  • 1,121,712
physiker
  • 143
  • 1
  • 4
  • 1
    Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. –  Sep 08 '14 at 14:36
  • here it is:\documentclass[aps,prl,twocolumn]{revtex4-1}

    \begin{document}

    \title{Stack Question} \author{John Smith}

    \maketitle

    How to cite now? \cite{EXP_stack}

    \bibliography{stack} \bibliographystyle{apsrev}

    \end{document} snf the stack.bib is a file with a single entry as above.

    – physiker Sep 08 '14 at 14:49

1 Answers1

5

The solution I found is to modify the .bst file.

Look for apsrev.bst on your system and make a copy of it in the directory containing the document you're working on, naming it apsrev-nourl.bst.

Open this file with any text editor and look for format.url; then change

FUNCTION {format.url}
{ url empty$
    { "" }
    { "\urlprefix\url{" url * "}" * }
  if$
}

into

FUNCTION {format.url}{ "" }

This will consume the item without producing any output. Change

\bibliographystyle{apsrev}

into

\bibliographystyle{apsrev-nourl}

and run pdflatex+bibtex+pdflatex. This is the result:

enter image description here

egreg
  • 1,121,712
  • GREAT! that is what I wanted, thank you, now I can put them even with ifthen package to read with or without url. – physiker Sep 08 '14 at 15:33
  • If you can not find format.url, then search for write.url or just <something>.url and replace that function too. – Art Gower Apr 06 '18 at 13:17