BibTeX, biblatex and biber ⇒ BiBTeX and hyphenation
BiBTeX and hyphenation
Is it possible to define hyphenation points for entries in bibliography (.bib) file? I'm using jurabib package. Example: I've got an entry goes by title: "El-Mutetahhirun" for which I need these hyphenation points: "El-Mu-te-tah-hi-run" (the first one, after 'El', is real dash, not a hyphenaton point, and must not be breakable, so I used \mbox{-} to prevent this (El\mbox{-}); if there is a better solution for nonbreakable hyphens, I'd be grateful to hear it too).
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
BiBTeX and hyphenation

Re: BiBTeX and hyphenation
Re: BiBTeX and hyphenation

BiBTeX and hyphenation
Code: Select all
@article {
uuu,
title = "uuu",
journal = "uuu",
author = "{aaaaaa aaaaaa aaaaaa aaaaaa aaaaaa aaaaaa aaaaaa aaaaaa El\nobreakhyphen Mutetahhirun}",
year = "1234"
}
Code: Select all
\documentclass{article}
\hyphenation{Mu-te-tah-hi-run}
\makeatletter
\newcommand*\nobreakhyphen{\hbox{-}\nobreak\hskip\z@skip}
\makeatother
\begin{document}
\cite{uuu}
\bibliographystyle{plain}
\bibliography{BibTeXHyphenation}
\end{document}
BiBTeX and hyphenation
1. Content of bibliography file (named: bib.bib):
Code: Select all
@book{ik-vs,
author = {Ibn\nbh Kajjim},
title = {Ibn\nbh Kajjim El\nbh Vabilus\nbh sajjib -- El-Vabilus-sajjib},
}
2. Main file:
Code: Select all
\documentclass[a4paper,10pt]{scrbook}
\usepackage{jurabib}
\jurabibsetup{%
authorformat={allreversed},
titleformat={italic,commasep,all},
titleformat={italic,noreplace},
citefull=all,
commabeforerest,
ibidem=strict,
oxford=true,
super,
dotafter=bibentry,
bibformat={numbered}
}
\renewcommand{\bibansep}{, }
\renewcommand{\bibbdsep}{,}
\renewcommand{\bibatsep}{}
\renewcommand{\bpubaddr}{,}
\renewcommand{\biblnfont}{\normalfont}
\renewcommand{\bibfnfont}{\normalfont}
\renewcommand{\bibtfont}[1]{\textit{#1}}
\usepackage{bibtopic}
\bibliographystyle{jurabib}
\makeatletter
\newcommand\nbh{\hbox{-}\nobreak\hskip\z@skip}
\makeatother
\begin{document}
Test\cite{ik-vs}
\begin{btSect}{bib}
\chapter{Bibliography}
\btPrintCited
\end{btSect}
\end{document}
BiBTeX and hyphenation
BibTeX tries to parse the author names to be able to sort and format them. To prevent this, put them into a pair of braces. Because ordinary strings are already delimited either by braces or by quotation marks, you'll have to type "{ ... }" or {{ ... }}. I chose the former in my example. You should do the same in the title tag, too, because it is converted to lowercase letters otherwise.meho_r wrote:Thank you for the example, phi, it was very helpful. I managed to solve the part with the book titles in .bib file, but for some reason, if I put \nobreakhyphen in author field, I always get a space after the hyphen.
Your requirement is a bit uncommon. The TeX standards (always break at hyphens, never break automatically if there is a hard or soft hyphen in the same word) are OK for the English language where there are only short words and few hyphens. It is not sufficient for languages with long words and many hyphens, like German. So the language support for German in the babel package enables some shorthands: "~ for a non-breaking hyphen, "- for a soft hyphen without disabling automatic hyphenation, "" for enabling automatic hyphenations if they were disabled, and so on. "~ is basically \leavevmode\hbox{-} and "" is \nobreak\hskip\z@skip, like in my \nobreakhyphen command. (I simply copied the definition from there.) So these definition do exist for languages that need them. But as I said, your request is perhaps too uncommon so no one has created a specific package yet.BTW, just a thought, there are many packages for many purposes in LaTeX, have anybody created a package that controls hyphens and dashes (nonbreakable ones and "no-break-after-hyphen/dash" in particular?)
Re: BiBTeX and hyphenation

I don't think the idea about creating a package for nonbreaking hyphens/dashes or "no-line-breaking" after them is so uncommon though. Even in English language, you don't want that after an en-dash in, let say, 123--456, the last number, 456, goes in the next line. It isn't nice to have em-dash at the end of a line too. And in languages in my area (bosnian, croatian, serbian) if we get a hyphen at the end of a line (like in writing arabic terms like El-Kitab), it should be repeated at the beginning of the next line too so it can be clearly distinguished of normally hyphenated words (with only one hyphen -- at the end of the line, as usual). But it is preferrable to have the word with a hyphen hyphenated before or after the actual hyphen (like in English, as far as I know). The good thing is of course TeX "programmability" so one can define his own commands that do things right, but the text can look a little bit messy
