2

I have the problem with long URLs. They are not broken in an appropiate way for my thesis because they fill in the whole line and by doing so violating the rim constraint. For example I have the following code:

 Das Fraunhofer-Institut für Bauphysik IBP: \grqq Planungsinstrumente
 \grqq.\\ Abgerufen von:
 \burl{http://www.ibp.fraunhofer.de/de/Kompetenzen/waermetechnik/planungsinstrumente/simulationswerkzeuge.html}
(Abrufdatum: 16.09.2015)

I loaded the breakurl package but it did not change anything. How can I break the line at some specific point in the URL.

Here is the main file:

%% Available languages: english,ngerman
%% Available modes: draft,final (see README)
\documentclass[ngerman,draft,table*]{sdqthesis}
\usepackage{breakurl}

\usepackage{amssymb}

\usepackage{nomencl}
\makenomenclature
\makeatletter
\newcommand{\closenomencl}{%
  \closeout\@nomenclaturefile%
}
\makeatother


\newcommand{\writenomencl}[1]{%
  \closenomencl%
  \IfFileExists{#1.nlo}{%
    \write18{%
      makeindex -s nomencl.ist -o #1.nls -t #1.nlg #1.nlo%
    }% 
  }{\typeout{Nothing there}}%
}


\AtEndDocument{\writenomencl{\jobname}}
\renewcommand{\nomname}{Nomenklatur}
\usepackage{colortbl}
\usepackage{booktabs}

\xdefinecolor{gray95}{gray}{0.65}
\xdefinecolor{gray25}{gray}{0.8}


\usepackage{pgfplots}
\usepackage{setspace}
\usepackage{array}
\setstretch{1,2}
%% ---------------------------------
%% | Information about the thesis  |
%% ---------------------------------

%% Name of the author
\author{AA}

%% Title (and possibly subtitle) of the thesis
\title{AA}

%% Type of the thesis 
\thesistype{AA}

%% Change the institute here, ``IPD'' is default
\myinstitute{AA}

%% You can put a logo in the ``logos'' directory and include it here
%% instead of the SDQ logo
% \grouplogo{myfile}
%% Alternatively, you can disable the group logo
\nogrouplogo

%% The reviewers are the professors that grade your thesis
\reviewerone{AA}

%% The advisors are PhDs or Postdocs
\advisorone{AA} 

%% The second advisor can be omitted
\advisortwo{AA}

%% Please enter the start end end time of your thesis
\editingtime{AA}{AA}

\settitle

%% --------------------------------
%% | Settings for word separation |
%% --------------------------------

%% Describe separation hints here.
%% For more details, see 
%% http://en.wikibooks.org/wiki/LaTeX/Text_Formatting#Hyphenation
\hyphenation{
% me-ta-mo-del
}

%% --------------------------------
%% | Bibliography                 |
%% --------------------------------

%% Use biber instead of BibTeX, see README
%\usepackage[citestyle=numeric,style=numeric,backend=biber]{biblatex}
%\addbibresource{thesis.bib}
\usepackage{bibgerm}

%% ====================================
%% ====================================
%% ||                                ||
%% || Beginning of the main document ||
%% ||                                ||
%% ====================================
%% ====================================
\begin{document}

%% Set PDF metadata
\setpdf

%% Set the title
\maketitle

%% The Preamble begins here
\frontmatter

\include{sections/declaration}

\setcounter{page}{1}
\pagenumbering{roman}

%% ----------------
%% |   Abstract   |
%% ----------------

%% For theses written in English, an abstract both in English
%% and German is mandatory.
%%
%% For theses written in German, a German abstract is sufficient.
%%
%% The text is included from the following files:
%% - sections/abstract

\includeabstract

%% ------------------------
%% |   Table of Contents  |
%% ------------------------
\tableofcontents

\listoffigures
\listoftables

%% -----------------
%% |   Main part   |
%% -----------------

\mainmatter

\include{sections/introduction}
\include{sections/content}
%\include{sections/evaluation}
%\include{sections/conclusion}
\printnomenclature

%% --------------------
%% |   Bibliography   |
%% --------------------

%% Add entry to the table of contents for the bibliography
%\printbibliography[heading=bibintoc]
 %Literaturverzeichnis

%% ----------------
%% |   Appendix   |
%% ----------------
\appendix
\include{sections/appendix}

\bibliographystyle{geralpha} %Literaturverzeichnis
 \bibliography{thesis}

%\appendix
\include{sections/appendix2}


\end{document}

And the relevant file (I have shortened it) appendix2:

\iflanguage{english}
{\chapter*{Internetquellen}}    % english style
{\chapter*{Internetquellen}}      % german style
\label{chap:internet}


AIMMS B.V.: \grqq Homepage \grqq. Abgerufen von: \url{http://www.aimms.com/} (Abrufdatum: 04.09.2015)

\vspace{0.5cm}
\noindent
Amprion GmbH: \grqq Mechanismen des EEG \grqq. Abgerufen von: \url{http://www.amprion.net/erneuerbare-energien-gesetz} (Abrufdatum: 29.09.2015) 

\vspace{0.5cm}
\noindent
DS Digitale Seiten GmbH: \grqq Heizkörper -- Dank professioneller Heizkörperberechnung effektiv Energiekosten sparen! \grqq. Abgerufen von: \url{http://www.heizungsbau.net/heizkoerperberechnung-20131106} (Abrufdatum: 20.09.2015) 

\vspace{0.5cm}
\noindent
Statista GmbH: \grqq CO2-Emissionen bei der Stromerzeugung in Deutschland nach Art der Erzeugung* im Jahr 2010 (in Gramm pro Kilowattstunde) \grqq. Abgerufen von: \url{http://de.statista.com/statistik/daten/studie/233868/umfrage/co2-emissionen-bei-der-stromerzeugung-nach-erzeugungsart/} (Abrufdatum: 29.09.2015) 
1

I reduced your code to be shorter (BTW: That is named a MWE, a minimal working example ;-) ) and added with package filecontents a demo bib file.

Better than creating an extra code for your internet files would be to add all webcites into your bib file.

In the following MWE I did both:

  1. correct your not breaking urls (see lines 49-72; to correct the url breaking see line 24 and 33-38) and
  2. added one entry in my example bib file and called it in the code (see lines 27-31; line 4-10, line 43-44).

Please study the given code!

MWE:

% http://tex.stackexchange.com/questions/270248/problem-with-long-url#270248
\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@online{statista,
  title={CO2-Emissionen bei der Stromerzeugung in Deutschland nach Art 
         der Erzeugung* im Jahr 2010 (in Gramm pro Kilowattstunde)}, 
  editor={Statista GmbH},
  url={http://de.statista.com/statistik/daten/studie/233868/umfrage/co2-emissionen-bei-der-stromerzeugung-nach-erzeugungsart/}, 
  urldate={2015-09-29},
}
\end{filecontents*}


\documentclass[%
  ngerman,
%  draft,
]{report}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{csquotes}

\usepackage{microtype}
\usepackage{ragged2e}
\usepackage{showframe}
\usepackage[%
  backend=biber,
  style=numeric, 
]{biblatex}
\addbibresource{\jobname.bib}

\PassOptionsToPackage{hyphens}{url}
\usepackage{etoolbox}
\usepackage{hyperref}
\apptocmd{\UrlBreaks}{\do\z\do\o\do\c\do\e}{}{}% break at z,o,c,e

\hyphenation{Heizkörper-be-rech-nung Abruf-da-tum}


\begin{document}

\nocite{*}
\printbibliography[heading=bibliography]

\appendix
\chapter*{Internetquellen}

{\RaggedRight% Only left justified; use for bibliography too!!!
AIMMS B.V.: "`Homepage"'. Abgerufen von: \url{http://www.aimms.com/} 
(Abrufdatum: 04.09.2015)

\vspace{0.5cm}
Amprion GmbH: "`Mechanismen des EEG"'. Abgerufen von: 
\url{http://www.amprion.net/erneuerbare-energien-gesetz} 
(Abrufdatum: 29.09.2015) 

\vspace{0.5cm}
\noindent
DS Digitale Seiten GmbH: "`Heizkörper -- Dank professioneller 
Heizkörperberechnung effektiv Energiekosten sparen!"' Abgerufen 
von: \url{http://www.heizungsbau.net/heizkoerperberechnung-20131106} 
(Abrufdatum: 20.09.2015) 

\vspace{0.5cm}
\noindent
Statista GmbH: "`CO2-Emissionen bei der Stromerzeugung in Deutschland 
nach Art der Erzeugung* im Jahr 2010 (in Gramm pro Kilowattstunde)"'. 
Abgerufen von: 
\url{http://de.statista.com/statistik/daten/studie/233868/umfrage/co2-emissionen-bei-der-stromerzeugung-nach-erzeugungsart/} \\
(Abrufdatum: 29.09.2015)
}
\end{document}

Result Biblatex: enter image description here

Result your solution: enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.