[Tex/LaTex] Remove words “URL” and “[link]” from references

elsarticlenatbiburls

I am writing a paper using the elsarticle documentclass and as far as I know it loads natbib. The problem I am facing has to do with the references : when I invoke a url there is the work "URL" and "[link]" in the entry, so what I want to achieve is to get rid of those.

A simple MWE to illustrate the issue and a sample .bib file follows up next.

MWE

\documentclass[preprint, 5p]{elsarticle}

\RequirePackage[colorlinks,citecolor=blue,urlcolor=blue,linkcolor=blue]{hyperref}
\RequirePackage{url}

%% `Elsevier LaTeX' style for references
\bibliographystyle{elsarticle-num}
\biboptions{numbers,sort&compress}

\usepackage{blindtext}

\begin{document}

\section{Section}
\blindtext \cite{MGAS3, Tsinganis, nTOF}

\section*{References}
\bibliography{bibliography}

\end{document}

bibliography.bib file

@online{nTOF,
title = {The {n\_ToF} Collaboration},
url   = {www.cern.ch/ntof},
}

@techreport{MGAS3,
  AUTHOR      = {Y. Giomataris},
  XTITLE      = {MICROMEGAS: results and prospects},
  INSTITUTION = {CEA/Saclay, DAPNIA},
  URL         = {www.slac.stanford.edu/pubs/icfa/fall99/paper1/paper1a.html},
}

@inbook{Tsinganis,
xtitle     = "Measurement of the 240Pu(n,f) cross-section at the CERN n-TOF facility: First results from EAR-2",
author     = "A. Tsinganis and et al.",
year       = "2015",
isbn       = "9789290834182",
pages      = "23--28",
booktitle  = "Proceedings of the 14th International Conference on Nuclear Reaction Mechanisms, NRM 2015",
publisher  = "CERN-2114737",
URL        = "https://cds.cern.ch/record/2114737",
}

The output looks like that

enter image description here

Why is this happening? Does it have to do with the class itslef? Is there a way to avoid and get rid of what's contained in the red rectangles?

Best Answer

A real solution would require to change the bst-file. As a hack you can try this -- it assumes that \href has to eat four arguments -- the standard two argument, a period and a \newline. If there are cases where the \newline is missing it could fail. Then one would have to improve the hack.

\documentclass[preprint, 5p]{elsarticle}

\RequirePackage[colorlinks,citecolor=blue,urlcolor=blue,linkcolor=blue]{hyperref}
\RequirePackage{url}
\usepackage{etoolbox}
%% `Elsevier LaTeX' style for references
\bibliographystyle{elsarticle-num}
\biboptions{numbers,sort&compress}

\usepackage{blindtext}

\begin{document}

\section{Section}
\blindtext \cite{MGAS3, Tsinganis, nTOF}

\section*{References}

\def\urlprefix{}\def\href#1#2#3#4{\ifstrequal{#2}{[link]}{}{#2\newline}}
\bibliography{test}

\end{document}

enter image description here