2

I'm using @mastersthesis entries into the bib file of my document and I noticed that the title of the @mastersthesis entry does not follow the right margin. The title is out of the right margin limit.

I found the following posts, but couldn't fix the error.

References spilling out of margin in bibliography
My references to PhD thesis go out of the margins in the bibliography

Any suggestion, how to limit the title of @mastersthesis entry within the margin?

Bibliography Output:

Right Margin Error

MWE:

\documentclass{article}

\usepackage[
backend=biber,
style=numeric,
sortlocale=de_DE,
natbib=true,
url=true, 
doi=true,
eprint=false
]{biblatex}
\addbibresource{jobname.bib}

\begin{filecontents}{jobname.bib}
@mastersthesis{jan,
title={Analyse der Auswirkungen des Betriebsverhaltens von dezentralen Kraft-W{\"a}rme-gekoppelten Erzeugungseinheiten auf die Energieeffizienz sowie Wirtschaftlichkeit der Anlagen},
author={Jan Teuwsen},
year={2010},
school={Technische Universit{\"a}t Dortmund}
}
\end{filecontents}

\begin{document}

\citet{jan} 
\printbibliography

\end{document}
  • Looks like your mwe could be trimmed. Also, the bib item can be considered too, as a mweb. Also it'd be more clear if you state a direct question. "many related posts and tried many, in the last two hours": "in the last two hours" is unnecessary info. Related posts? You can specify. – nilon Oct 22 '16 at 18:25
  • I have specified the posts but I'm not sure if it wasn't direct enough to understand the question. @nilon – Yousaf Oct 22 '16 at 18:43
  • @ArslanYousaf compiling your MWE it looks alright to me, could you check your MWE illustrates your problem and if so it may be helpful to post a picture of the output to highlight which part of the output you object to. – Dai Bowen Oct 22 '16 at 18:50
  • 1
    note that your document hasn't specified a language so will be trying to hyphenate that as English, which clearly it isn't, you might want to locally set a language or add some \- to the bib file Wirt\-schaft\-lich\-keit or whever appropriate breaks are – David Carlisle Oct 22 '16 at 19:06
  • 1
    @ArslanYousaf - Providing the option ngerman at the document class stage is of little use unless the babel package is loaded as well -- which isn't the case, at least not in the MWE you posted. – Mico Oct 22 '16 at 19:14
2

I suggest you add the instruction

\hyphenation{wirt-schaft-lich-keit}

to the preamble. Evidently, left to its own devices, TeX doesn't know how to hyphenate this word. This isn't all that surprising, really, as the system's default language is English, not German.

enter image description here

If you omit the instruction \hyphenation{wirt-schaft-lich-keit}, the full word will be placed on line two, just as in your screenshot.

\documentclass{article}
\usepackage{filecontents}
\begin{filecontents}{jobname.bib}
@mastersthesis{jan,
  title={Analyse der Auswirkungen des Betriebsverhaltens von 
  dezentralen Kraft-W{\"a}rme-gekoppelten Erzeugungseinheiten 
  auf die Energieeffizienz sowie Wirtschaftlichkeit der 
  Anlagen},
  author={Jan Teuwsen},
  year={2010},
  school={Technische Universit{\"a}t Dortmund},
}
\end{filecontents}

\hyphenation{wirt-schaft-lich-keit}

\usepackage[textwidth=5.25in]{geometry} % educated guess...
\usepackage[
backend=biber,
style=numeric,
sortlocale=de_DE,
natbib=true,
url=true, 
doi=true,
eprint=false
]{biblatex}
\addbibresource{jobname.bib}

\begin{document}
\nocite{*} 
\printbibliography
\end{document}
  • Thanks @Mico Can I define \hyphenation the way I want? And will this work for url entries? – Yousaf Oct 22 '16 at 19:18
  • 1
    @ArslanYousaf - Not entirely sure what you mean by "the way I want". The macro expects a list of space-separated words, where each permissible hyphenation point is indicated by a -. E.g., \hyphenation{be-dwarf obst-feld gott-lieb heath-row wirt-schaft-lich-keit}. (The words in this list are all examples where TeX either can't find the correct hyphenation points -- the first three words -- or finds none at all -- the final two.) BTW, if you do load the babel package, be sure to provide the \hyphenation instruction after loading babel. – Mico Oct 22 '16 at 19:22
  • 1
    @ArslanYousaf - \hyphenation will most definitely not operate on the contents of a \url directive. – Mico Oct 22 '16 at 19:26
  • I meant by "the way I want" like we can write for any word, as long as we follow the \hyphenation syntax. I actually have another citation in my bibliography, which is out of the margin, and its from url entry. I tried the way you suggested for @mastersthesis entry but does not work for url. – Yousaf Oct 22 '16 at 19:28
  • 1
    @ArslanYousaf - Are you loading the url package with the options hyphens, spaces, and obeyspaces? If not, do give it a try. – Mico Oct 22 '16 at 19:30

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.