%% $Id: xurl.tex 400 2022-01-09 13:12:20Z herbert $
%
\listfiles\setcounter{errorcontextlines}{100}
\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@online{asdf,
  sortname={BSI},label={BSI},
  organization={BSI (Bundesamt für Sicherheit in der Informationstechnik)},
  title={Angaben des BSI für die Algorithmenkataloge der Vorjahre, Empfehlungen zur Wahl der Schlüssellängen},
  date={2016},
  url={https://www.bundesnetzagentur.de/DE/Service-Funktionen/ElektronischeVertrauensdienste/HinweiseEmpfehlungen/Empfehlungen/Empfehlungen_node.html},
}
\end{filecontents*}
\documentclass[paper=a4,fontsize=11pt,DIV=14,parskip=half-,
               captions=tableabove,twoside=on]{scrartcl}
\usepackage{fontspec}
%\usepackage[%usefilenames,
%            TT={Scale=0.88,FakeStretch=0.9},
%            SS={Scale=0.9},
%            RM={Scale=0.9},
%            DefaultFeatures={Ligatures=TeX}]{lucida-otf}  % support opentype math fonts
\setmainfont{AccanthisADFStdNo3}[
  UprightFont   =*-Regular,
  BoldFont      =*-Bold,
  ItalicFont    =*-Italic,
  BoldItalicFont=*-BoldItalic,
  RawFeature    = -rlig,
]
\setsansfont{GilliusADF}[
  UprightFont   =*-Regular,
  BoldFont      =*-Bold,
  ItalicFont    =*-Italic,
  BoldItalicFont=*-BoldItalic,
  RawFeature    = -rlig,
]
\setmonofont{Anonymous Pro}[Scale=MatchLowercase,FakeStretch=0.9]

\usepackage[english]{babel}
\usepackage{scrlayer-scrpage}
\automark[section]{section}
\automark*[subsection]{}
\pagestyle{scrheadings}

\usepackage{biblatex}
\addbibresource{\jobname.bib}

%\usepackage{selnolig}
%\nolig{oe}{o|e}

\usepackage{xurl}
\title{Package \texttt{xurl}}
\author{Herbert Voß\thanks{\texttt{herbert@dante.de}\newline Thanks to Robert Alessi; Ulrike Fischer}}
\begin{document}
\maketitle

\section{How it works}
Package xurl loads package url by default and defines
possible url breaks for all alphanumerical characters
and \verb|= / . : * - ~ ' "| 

All arguments which are valid for url can be used.
It will be passed to package url. xurl itself has no 
special optional argument. For more information read
the documentation of package url.

\section{With the original setting from package url}

The original behaviour of package \texttt{url} can be obtained
by using the macro \texttt{\textbackslash useOriginalUrlSetting}
which should be used inside a group:

\begingroup
\useOriginalUrlSetting
\noindent
\frame{\begin{minipage}{0.5\linewidth}
\noindent
some text \url{very-long-url-very-long-url-very-long-url-very-long-url-very-long-url-} 
and another url: \url{https://tex.stackexchange.com/questions/3033/forcing-linebreaks-in-url/10419?noredirect=1#comment1021887_10419}
\end{minipage}}

\noindent
\frame{\begin{minipage}{0.75\linewidth}
\noindent
some text \url{very-long-url-very-long-url-very-long-url-very-long-url-very-long-url-} 
and another url: \url{https://tex.stackexchange.com/questions/3033/forcing-linebreaks-in-url/10419?noredirect=1#comment1021887_10419}
\end{minipage}}

\noindent
\frame{\begin{minipage}{\dimexpr\linewidth-2\fboxrule}
\noindent
some text \url{iszv://dsf.tqsdatmdtdls.ctm/cudfsdvqfqll-ocd/bdcbcfqlf-lcclldh/cbsntwgqke-esbptb-vvylhy/zkhqnqidf-obedbacpf-lzlal-pxaccqa-gwki.lfof/}
and another url: \url{koff://osb.ccdngagkkg.raa/qrkxzvi/dxfsiaa/xidf-lata-dgdqmhp-uoxdl-vst-vcsbhl-aisdsasih-skl-aezb-fhixvyy-qqlachd-achhfc-koe-xgfqp-iyplcu-1.696884}
\end{minipage}}
\endgroup


\section{With the setting from package xurl}


\noindent
\frame{\begin{minipage}{0.5\linewidth}
\noindent
some text \url{very-long-url-very-long-url-very-long-url-very-long-url-very-long-url-} 
and another url: \url{https://tex.stackexchange.com/questions/3033/forcing-linebreaks-in-url/10419?noredirect=1#comment1021887_10419}
\end{minipage}}

\noindent
\frame{\begin{minipage}{0.75\linewidth}
\noindent
some text \url{very-long-url-very-long-url-very-long-url-very-long-url-very-long-url-} 
and another url: \url{https://tex.stackexchange.com/questions/3033/forcing-linebreaks-in-url/10419?noredirect=1#comment1021887_10419}
\end{minipage}}

\noindent
\frame{\begin{minipage}{\dimexpr\linewidth-2\fboxrule}
\noindent
some text \url{iszv://dsf.tqsdatmdtdls.ctm/cudfsdvqfqll-ocd/bdcbcfqlf-lcclldh/cbsntwgqke-esbptb-vvylhy/zkhqnqidf-obedbacpf-lzlal-pxaccqa-gwki.lfof/}
and another url: \url{koff://osb.ccdngagkkg.raa/qrkxzvi/dxfsiaa/xidf-lata-dgdqmhp-uoxdl-vst-vcsbhl-aisdsasih-skl-aezb-fhixvyy-qqlachd-achhfc-koe-xgfqp-iyplcu-1.696884}
\end{minipage}}

\section{Using \texttt{biblatex}}
Package \texttt{biblatex} has it's own url handling. If you want the the same behaviour as \texttt{xurl} has, you have to
set 

\begin{verbatim}
\setcounter{biburllcpenalty}{100}
\setcounter{biburlucpenalty}{200}
\setcounter{biburlnumpenalty}{100}
\end{verbatim}

However, if you load \texttt{xurl} \emph{after} \texttt{biblatex} then it is done
by default. Compare the following bibliographies. IF you do not want that \texttt{xurl}
should set these counters, then load the package \emph{before} \texttt{biblatex} or
use the optional argument \texttt{nobiblatex}:

\begin{verbatim}
\usepackage[...]{biblatex}
\usepackage[nobiblatex]{xurl}
\end{verbatim}

\nocite{*}


\printbibliography[title={With urlbreaks}]

\setcounter{biburllcpenalty}{0}
\setcounter{biburlucpenalty}{0}
\setcounter{biburlnumpenalty}{0}

\printbibliography[title={xurl with option nobiblatex}]





\end{document}