0

There were some hits for my problem but did not answer fully.

I found out the PassOptions... command to get rid of some options clash with url and hyperref packages here

Forcing linebreaks in \url does not work with biblatex and menukeys

I have the below MWE with two options where I am using biblatex.

One is with hyperref and the other without. The one without hyperref works fine and the url information is broken correctly but the one with hyperref does not work. It leaves the link as a one long line with the box. I could not really find a fix for this. What is missing from the implementation with hyperref?

\documentclass[10pt]{article}
% % option 1
% %
% % that works without hyperref
% % and the links I used as in the rest of my thesis
% % the long line is broken correctly without using
% % hyphens option with the url package
% \usepackage[backend=bibtex,backref,style=numeric,
%             sorting=nyt,firstinits=true,maxbibnames=99]{biblatex}
% \addbibresource{test.bib}
% \usepackage{xcolor}
% % the test
% \title{Test document}
% \begin{document}
% this\cite{nvh_BK} is a test.
% \printbibliography
% % end of option 1

% option 2
% with hyperref package
% I found out that I have to use the 
% PassOptionsToPackage before the biblatex definitions
% 
\PassOptionsToPackage{hyphens}{url}
%
\usepackage[backend=bibtex,backref,style=numeric,
            sorting=nyt,firstinits=true,maxbibnames=99]{biblatex}
\addbibresource{test.bib}
\usepackage{hyperref}
\usepackage{xcolor}
\hypersetup{
   colorlinks   = true,    % Colours links instead of ugly boxes
   urlcolor     = blue,    % Colour for external hyperlinks
   linkcolor    = blue,    % Colour of internal links
   citecolor    = red,     % Colour of citations
   pdfborder = { 0 0 1 },  % Border for pdf
   linkbordercolor = blue, % Border color
   citebordercolor = red,
   breaklinks = true
}
% test
\title{Test document}
\begin{document}
this\cite{nvh_BK} is a test.
\printbibliography
% end of option 2
\end{document}

test bib file I used with one entry is as follows:

@online{nvh_BK,
  author = {Bruel\&Kjaer},
  title = {Vehicle noise vibration and harshness development},
  year = 2019,
  url = {https://www.bksv.com/en/Applications/vehicle-noise-vibration-and-harshness-development-test-test-test},
  urldate = {2019-05-10}
}
  • how are you compiling? with pdflatex? – Ulrike Fischer Jul 27 '19 at 14:01
  • @UlrikeFischer, yes – Umut Tabak Jul 27 '19 at 14:02
  • 1
    Try \usepackage{xurl} before biblatex – CarLaTeX Jul 27 '19 at 14:03
  • @CarLaTeX, still the same although now the box around the url is not there but the line is not broken – Umut Tabak Jul 27 '19 at 14:04
  • I'm probably missing something (I'm not quite sure about the two options hidden in one MWE), but when I compile the MWE without modification I get a nicely brokem URL. Can you show a screenshot of the output you get, please? – moewe Jul 27 '19 at 14:05
  • @moewe, that is interesting, if you did not change anything you have compiled option2, and that is the one working for you, right? – Umut Tabak Jul 27 '19 at 14:06
  • Yes. I'm compiling with pdfLaTeX from an up-to-date MikTeX system (on Win 10). – moewe Jul 27 '19 at 14:07
  • moewe, ok, I guess I pin point the problem. I was using AucTeX environment and if I use the compile toolchain there in the code, it does not work on linux. Then I did a command line pdflatex and indeed it seems to work ;). – Umut Tabak Jul 27 '19 at 14:10
  • That's why Ulrike asked if you use pdfLaTeX. If AucTeX uses LaTeX and compiles to DVI you may get different results. DVI and linked line breaks don't go together that well. – moewe Jul 27 '19 at 14:12
  • @moewe, ok, I will check the complete commands used in emacs, I was sure that it was pdflatex but seems like not – Umut Tabak Jul 27 '19 at 14:14
  • For line breaking with DVIs, see https://tex.stackexchange.com/q/20768/35864 – moewe Jul 27 '19 at 14:18
  • See also https://tex.stackexchange.com/q/107507/35864 – moewe Jul 27 '19 at 14:18
  • @moewe, thanks for the links, I will see further how to fix my commands in emacs – Umut Tabak Jul 27 '19 at 14:21
  • @moewe well with dvips the answer is to wait for the new l3backend-code where Joseph implemented breaking links for the dvips route ;-). (breakurl could work too). – Ulrike Fischer Jul 27 '19 at 14:26

0 Answers0