# How to hyphenate a reference that has a lastname with a hyphen?

I need to hyphenate a long lastname with a hyphen in it in a reference, e.g.:

@article{LastHyphenName:2013xy,
author = {Longlast-Namewithhyphen, Antonio and Anotherlastname, David},
title = {{How to hyphenate a reference that has a lastname with a hyphen?}},
journal = {Contributions To the TeX Stackexchange},
year = {2013},
volume = {2},
pages = {539--557},
}


I read in Line breaking (or hyphenation?) of references in apalike that one can hyphenate even a word from the .bib file with \hyphenation, but words that already have a hyphen cannot be hyphenated, or you do something like it's done in this SO thread. However, I think there has to be another way than manipulating the BibTeX entries.

Any solutions for this?

EDIT:

• I'm editing my library externally and it is still growing as I'm adding new references to the bibliography during the writing process, thus substituting the hyphens with a shorthand in the final (exported) .bib file is not very efficient time-wise.

• Also, my bibliography has a ton of authors with their last names being of hispanic origin which would mean time-costly, manual editing of the .bib file (I know that hispanic last names are normally not connected with a hyphen, but the hyphens is internationally introduced to avoid confusion).

I'm writing my thesis with \classicthesis, so the preamble is much more complex, but here's a MWE:

\documentclass{scrbook} % KOMA-Script article
\usepackage[english]{babel}
\usepackage{lipsum}
\usepackage[round]{natbib}
\usepackage{fontspec}
\usepackage{xunicode}
\setmainfont[Mapping=tex-text]{Minion Pro}
\usepackage[english]{babel}

\begin{document}
\hyphenchar\font=\string"7F

\parbox{1cm}{\cite{LastHyphenName:2013xy}}

\bibliographystyle{kluwer}
\bibliography{lib}

\end{document}


.bib file

@article{LastHyphenName:2013xy,
author = {Longlast-Namewithhyphen, Antonio and Anotherlastname, David},
title = {{How to hyphenate a reference that has a lastname with a hyphen?}},
journal = {Contributions To the TeX Stackexchange},
year = {2013},
volume = {2},
pages = {539--557},
}


Changing the hyphenchar is not working.

• My impression is that changing the names (adding a hyphen) adds to confusion. One should always use the name: is "Paulo-Roberto Massa-Cereda" the same author as "Paulo Roberto Massa Cereda" or not? (Paulo will forgive me for using his name.) – egreg Feb 19 '13 at 10:55
• You could change the hyphenchar. See egreg's answer here tex.stackexchange.com/questions/63232/… – Ulrike Fischer Feb 19 '13 at 11:03
• @egreg OK, but the hispanic authors' names are spelled like this in the actual paper. Also, there's also last names that actually contain two names connected with a hyphen, e.g. married couples who paired their last names. – Paglia Orba Feb 19 '13 at 12:31
• @Christian I just used the parbox to demonstrate that the hyphenation (i.e. line break) is not working by changing the hyphenchar. – Paglia Orba Feb 19 '13 at 13:44
• it's about hyphenating a reference in the main body text and the reference is not wrapped correctly because the author has a lastname with a hyphen in it. it's all in the the question :) – Paglia Orba Feb 19 '13 at 14:00

with package babel use

\defineshorthand{"=}{\penalty1000-\hskip0pt}


and then

author = {Longlast"=Namewithhyphen, Antonio and Anotherlastname, David},

• This would be one solution. But I edit my bibliography externally (like BibDesk) and the bibliography is still changing during the writing process, thus, I would have to edit the bib file every time after I added a new reference to the bibliography (the bibliography has tons of spanish/hispanic authors with hypenated last names). – Paglia Orba Feb 19 '13 at 10:11
• @PagliaOrba Two solutions: (1) have the name as written here in BibDesk – I do that to some extent (although I use LaTeX commands). (2) Write a script to post-process your .bib file accordingly and include it into your build process. Do not manually edit generated files (such as the .bib file in this case). BibDesk also has a script hook for saving files but I don’t know how to use that and if it helps here. – Konrad Rudolph Mar 19 '13 at 19:47

I use \hyp{} from the hyphenat package and have Biber replace all hyphens in the author field with it. Put this in your preamble:

\usepackage{hyphenat}
\DeclareSourcemap{
\maps[datatype = bibtex]{
\map{
\step[fieldsource = author, match = \regexp{-}, replace = \regexp{\{\\hyp\{\}\}}]
}
}
}


For some reason, Biber started to include abstract and annotation in the .bbl file after that, which may give you issues with special characters. To solve that, you can include this in your .biber.conf:

<?xml version="1.0" encoding="UTF-8"?>
<config>
<sourcemap>
<maps datatype="bibtex" map_overwrite="1">
<map>
<map_step map_field_set="abstract" map_null="1"/>
<map_step map_field_set="annote" map_null="1"/>
</map>
</maps>
</sourcemap>
</config>


Use two hyphen signs.

For instance, author = {Longlast--Namewithhyphen, Antonio and Anotherlastname, David}

It's not required to use any additional packages.

• -- would not be a hyphen, but an en-dash. – Paul Gessler Sep 29 '14 at 0:37