5

Today I unexpectedly received the dreaded character not set up for use with LaTeX from inputenc. In this case, I was also pretty sure the error came from a .bib file. However, I grepped everything in the working directory as well as all .bib files and, just in case, all of my custom .cls and .sty files as well. The only place I could find the character was in generated files. That is, it did not appear to be in the source at all:

$ grep ‑ * ~/texmf/bibtex/bib/*.bib ~/texmf/tex/latex/cfr/* ~/texmf/tex/latex/config/*

executed from my working directory gave the following (plus a couple of innocuous complaints about non-file like things):

filename.bbl:        {Oxford University Press/Clar‑endon}%
filename.log:! Package inputenc Error: Unicode char \u8:‑ not set up for use with LaTeX.

That is, although the character is not in any of my source files, it is in the file biber generates.

I can reproduce the error using the following file:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[backend=biber]{biblatex}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
  @book{mybook,
    title       =   {Great Book},
    author      =   {Author, Some},
    year        =   1055,
    publisher   =   {Oxford University Press/Clar\-endon},
    address     =   {Oxford}}
\end{filecontents}

\bibliography{\jobname}

\begin{document}

  \autocite{mybook}

  \printbibliography

\end{document}

Obviously, there are a couple of options I can use to work around this. I could remove \- from the .bib file in question. Or I could declare the relevant unicode character which biber is inserting. Or I could define the discretionary hyphenation somewhere outside the .bib file, I guess.

However, this worked fine until recently. I've used \- in Clar\-endon for a long time and it has never caused any trouble before. So I assume something has changed in the way biblatex/biber responds to the entry in the file. (Perhaps I should add that it is not that the hyphenation is being invoked. There is no need to break the line in this case, as it happens.)

Which raises the question: what is the correct way to specify discretionary hyphenation in .bib files so that they work correctly with inputenc and pdflatex in UTF8 encoding without special workarounds?

Note that I do know about XeLaTeX and LuaLaTeX, but I'm specifically interested in getting this to work with pdfLaTeX.

11
  • 2
    Curiously, \- is mapped to U+2011 NON-BREAKING HYPHEN, which I'd consider a bug. However, I'd use Press\slashb Clarendon, where \slashb is defined to do \slash\hspace{0pt} (if you'd like to break at the slash) or /\nobreak\hspace{0pt} (if a break at / is not desired). You should also add \hyphenation{Clar-en-don} if you use the US hyphenation patterns that give just Claren-don; with British hyphenation patterns, you get Clar-en-don.
    – egreg
    Jul 31 '14 at 21:49
  • @egreg Thanks. So probably I can just remove \- in this case if it should pick up the hyphenation patterns anyway. However, I guess my question remains since there certainly might be cases where it would be useful to specify a hyphenation point in a .bib file. I've had trouble with other escape sequences in .bib files since switching to biblatex/biber. Generally, I fix the errors by replacing the character with the unicode equivalent but I'm not sure that I should need to do this. (I know this is very counter-intuitive but something is odd about biber's replacements.)
    – cfr
    Jul 31 '14 at 21:56
  • Press/Clarendon wouldn't be hyphenated, because of the slash, that's why I proposed \slashb.
    – egreg
    Jul 31 '14 at 21:58
  • 1
    I can't test now. But it sounds like a bug, so I suggest a bug report. Besides this: the replacements can be configured, see the biber documentation. Jul 31 '14 at 22:01
  • @egreg Yes, I realised that. I didn't think about the effect of the slash. I've just changed my definition of / as a bib file string to \slash\hspace{0pt}. However, I have other cases where I use \- in my .bib files where this doesn't apply. That is, I've changed everything I can find using / in pub.bib which is my list of publishers. But I still have things like Harper\-San\-Francisco so I would still like to know how to specify hyphenation points correctly.
    – cfr
    Jul 31 '14 at 22:08
5

This was a bug and should be fixed in the 2.0 DEV version of biber on SF. When decoding to UTF8, "\-" shouldn't really be touched.

1
  • Thanks for letting me know and for fixing this so quickly!
    – cfr
    Aug 1 '14 at 22:17

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.