0

Running the following minimal example:

\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@mvbook{assis08,
    author = {Machado de Assis},
    title = {Obra completa em quatro volumes},
    year = {2008},
    url = {https://www.google.com},
    urlaccessdate = {2018-02-17},
}
\end{filecontents*}
\PassOptionsToPackage{brazil,main=english,spanish,french}{babel}

\documentclass[12pt,a4paper,english]{abntex2}
\usepackage[utf8]{inputenc}
\usepackage{csquotes}

\usepackage[
style=abnt,repeatfields=true,backend=biber,backref=true,citecounter=true]{biblatex}
\pdfstringdefDisableCommands{\let\uppercase\relax}
\addbibresource{\jobname.bib}

\begin{document}
Citing \cite{assis08}.

\printbibliography
\end{document}

Generates the url field with brackets <url> around it:

enter image description here

So far, so good. I like them, and they are required by . However, when I click on the link, the web page is not open. And if I hit copy the link:

enter image description here

It is copied including the brackets around the link, i.e., <https://www.google.com>, instead of only https://www.google.com.

Then, it is clearly that the problem is that something is making the brackets round the url as part of the link. How can I fix the links, so they are copied and opened as https://www.google.com, instead of <https://www.google.com>, while keeping the brackets <url> around the link?

user
  • 4,745
  • 1
    I don't get the result you do. But anyway, it would be good if you tried to make a more minimal example to see if you can determine where the problem comes from. Do you need all those options to babel to see the problem? (or do you need babel at all?) Do you need all those options to biblatex to see the problem? Etc. – pst Nov 22 '19 at 06:34

1 Answers1

1

With a current version of biblatex-abnt the link shows correctly (i.e. the angle 'brackets' are outside of the link) as in the following slightly reduced version of your MWE

\PassOptionsToPackage{brazil,main=english,spanish,french}{babel}

\documentclass[12pt,a4paper,english]{abntex2}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{csquotes}

\usepackage[backend=biber, style=abnt,
  repeatfields=true, backref=true, citecounter=true]{biblatex}

\addbibresource{biblatex-examples.bib}

\begin{document}
Citing \cite{markey}.

\printbibliography
\end{document}

Correctly formatted link in "Available from: <http://mirror.ctan.org/info/bibtex/tamethebeast/ttb_en.pdf>"

A bit of digging reveals that the relevant field format for URLs was changed almost three years ago now in https://github.com/abntex/biblatex-abnt/commit/ba9349dc5a2d7047626baa7ce481a4d432d2b455 following bug report https://github.com/abntex/biblatex-abnt/issues/16.

If you can not or don't want to update your system you can easily replicate that fix by adding

\DeclareFieldFormat{url}{\bibstring{urlfrom}\addcolon\space<\url{#1}>}

to your preamble.

Note that https://github.com/abntex/biblatex-abnt/pull/52 was merged to the dev branch of biblatex-abnt a while ago (I don't think the version is on CTAN yet) that removes the angles around the URL completely. So it could be that if you want to conform with the current (new) version of the norm you need

\DeclareFieldFormat{url}{\bibstring{urlfrom}\addcolon\space\url{#1}}
moewe
  • 175,683
  • Thanks! It is working now. But I had to use \textless and \textgreater instead of < and >, {\bibstring{urlfrom}\addcolon\space\textless\url{#1}\textgreater}, otherwise latex would show them as: ¡https://www.google.com¿ – user Nov 23 '19 at 15:56
  • These characters names seem to be greater-than sign and less-than sign. I found the answer for this problem here: The characters “<”, “>”, and “|” do work as expected in math mode, although they produce, respectively, “¡”, “¿”, and “—” in text mode when using the OT1 font encoding. The Comprehensive LATEX Symbol List – user Nov 23 '19 at 16:01
  • 1
    @user See https://tex.stackexchange.com/q/2369/35864. In my MWE I used T1 fontencoding, so < and > work also in text mode. – moewe Nov 24 '19 at 16:10
  • You are right! Thanks! – user Nov 24 '19 at 20:03
  • Is there anything else I can use other than urlfrom? I am getting this warning: Package biblatex Warning: Bibliography string 'urlfrom' undefined` – user Nov 30 '19 at 00:59
  • I just fixed it by adding \DefineBibliographyStrings{english}{urlfrom = {Available from}} – user Nov 30 '19 at 01:08