[Tex/LaTex] abntex and hyphenat problems in url formatting

abntbibtexhyperrefhyphenation

Problem

I would like to disable all hyphenation within the document, but I want the bibtex URL entries to be properly hyphenated, and also properly linked according to the hyperref package. Because of this I'm having some issues using abntex bibliography formatting with the \usepackage[none]{hyphenation} call.

Example

This bibtex entry:

@ARTICLE{Engelhardt2008,
  author = {Sebastian Engelhardt},
  title = {The Economic Properties of Software},
  journal = {Jena Economic Research Papers},
  year = {2008},
  volume = {45},
  url = {http://zs.thulb.uni-jena.de/servlets/MCRFileNodeServlet/jportal_derivate_00119979/wp_2008_045.pdf}
}

Placed in a document like this:

\documentclass{abnt}
\usepackage[brazilian]{babel}
\usepackage[utf8]{inputenc}
\usepackage{makeidx}
\usepackage{hyperref}
\usepackage{abnt-UFPR}
\usepackage{abntcite}
\usepackage[none]{hyphenat}

\begin{document}
  \sloppy
  \cite{Engelhardt2008}
  \bibliography{test.bib}
\end{document}

Will make abntex format the following bibitem:

\bibitem[Engelhardt 2008]{Engelhardt2008}
\abntrefinfo{Engelhardt}{ENGELHARDT}{2008}
{ENGELHARDT, S. The economic properties of software.
\emph{Jena Economic Research Papers}, v.~45, 2008.
Dispon{\'\i}vel em:
  \htmladdnormallink{$<$http:\-/\-/zs\-.thulb\-.uni-jena\-.de\-/servlets\-/MCR%
FileNodeServlet\-/jportal\underline{\ }derivate\underline{      }00119979\-/wp\underline{\ }2008\underline{      }045\-.pdf$>$}{http://zs.thulb.uni-jena.de/servlets/MCRFileNodeServlet/jport%
al_derivate_00119979/wp_2008_045.pdf}.}

Output

That looks like this in the A4 page:

wrong bibitem formatting

If I remove \usepackage[none]{hyphenat} from the preamble, this same entry will have the desired formatting, but the whole text will be hyphenated.

right bibitem formatting

Workarounds Tried

Using \usepackage[hyphens]{url} will output this on compilation:

! LaTeX Error: Option clash for package url.

I could also use just \usepackage{url} and change all my bibtex entries url params to:

 note = {Disponível em: $<$\url{http://zs.thulb.uni-jena.de/servlets/MCRFileNodeServlet/jportal_derivate_00119979/wp_2008_045.pdf}$>$}

But I really wouldn't like to do this, as I'm using a bibliography manager to generate the .bib file.

Best Answer

You may try putting

\renewcommand{\-}{\penalty 0 }

just before the bibliography. However, it's very questionable that the bibliography style loaded by abnt does such horrible things to URLs, when it's simply sufficient to input them as \url{...} when the url package is loaded.

This won't give hyphens at break points (which is in my opinion the right thing to do, as it's impossible for the reader to distinguish between real or added hyphens).

However, I find it questionable also inhibiting hyphenation on a global basis.

A different strategy than using hyphenat can be saying

\begin{document}
\hyphenrules{nohyphenation}\exhyphenpenalty 10000

and

\hyphenrules{brazilian}\exhyphenpenalty 50

before the bibliography, in order to allow hyphenation in it. The parameter \exhyphenpenalty is used by TeX to decide whether break a line after an explicit hyphen in the document (a compound word, for instance); setting it to 10000 inhibits the feature; 50 is the usual value. The nohyphenation pseudolanguage has no hyphenation rule.

Related Question