plk / biblatex

biblatex is a sophisticated bibliography system for LaTeX users. It has considerably more features than traditional bibtex and supports UTF-8
515 stars 118 forks source link

\textnohyphenation add spurious spaces #979

Closed maieul closed 4 years ago

maieul commented 4 years ago

Hi,

the last version of biblatex add \textnohyphenation in \mkbibnamefamily in french, which create spurious space in some specific cases.

Here a MWE showing the problem.

\documentclass{article}
\usepackage[style=verbose]{biblatex}
\usepackage[french]{babel}
\begin{document}

\mkbibnamefamily{Cambridge} : University Library

\textsc{Cambridge} : University Library

\renewcommand{\mkbibnamefamily}[1]{\textsc{\textnohyphenation{#1}\unskip}}

\mkbibnamefamily{Cambridge} : University Library
\end{document}
moewew commented 4 years ago

I may be a bit blind, but I can't see a difference in the three lines. Can you upload a picture of the incorrect output that you get and the complete .log file so we can compare package versions, please?

maieul commented 4 years ago

It seems that happens only with xelatex.

image

.log file

This is XeTeX, Version 3.14159265-2.6-0.999991 (TeX Live 2019) (preloaded format=xelatex 2020.2.17)  24 MAR 2020 13:14
entering extended mode
 restricted \write18 enabled.
 %&-line parsing enabled.
**toto.tex
(./toto.tex
LaTeX2e <2020-02-02> patch level 2
L3 programming layer <2020-02-14>
(/usr/local/texlive/2019/texmf-dist/tex/latex/base/article.cls
Document Class: article 2019/12/20 v1.4l Standard LaTeX document class
(/usr/local/texlive/2019/texmf-dist/tex/latex/base/size10.clo
File: size10.clo 2019/12/20 v1.4l Standard LaTeX file (size option)
)
\c@part=\count163
\c@section=\count164
\c@subsection=\count165
\c@subsubsection=\count166
\c@paragraph=\count167
\c@subparagraph=\count168
\c@figure=\count169
\c@table=\count170
\abovecaptionskip=\skip47
\belowcaptionskip=\skip48
\bibindent=\dimen134
)
(/usr/local/texlive/2019/texmf-dist/tex/latex/biblatex/biblatex.sty
Package: biblatex 2019/12/01 v3.14 programmable bibliographies (PK/MW)

(/usr/local/texlive/2019/texmf-dist/tex/latex/pdftexcmds/pdftexcmds.sty
Package: pdftexcmds 2019/11/24 v0.31 Utility functions of pdfTeX for LuaTeX (HO
)

(/usr/local/texlive/2019/texmf-dist/tex/generic/infwarerr/infwarerr.sty
Package: infwarerr 2019/12/03 v1.5 Providing info/warning/error messages (HO)
)
(/usr/local/texlive/2019/texmf-dist/tex/generic/iftex/iftex.sty
Package: iftex 2019/11/07 v1.0c TeX engine tests
)
(/usr/local/texlive/2019/texmf-dist/tex/generic/ltxcmds/ltxcmds.sty
Package: ltxcmds 2019/12/15 v1.24 LaTeX kernel commands for general use (HO)
)
Package pdftexcmds Info: \pdf@primitive is available.
Package pdftexcmds Info: \pdf@ifprimitive is available.
Package pdftexcmds Info: \pdfdraftmode not found.
)
(/usr/local/texlive/2019/texmf-dist/tex/latex/etoolbox/etoolbox.sty
Package: etoolbox 2019/09/21 v2.5h e-TeX tools for LaTeX (JAW)
\etb@tempcnta=\count171
)
(/usr/local/texlive/2019/texmf-dist/tex/latex/graphics/keyval.sty
Package: keyval 2014/10/28 v1.15 key=value parser (DPC)
\KV@toks@=\toks14
)
(/usr/local/texlive/2019/texmf-dist/tex/latex/kvoptions/kvoptions.sty
Package: kvoptions 2019/11/29 v3.13 Key value format for package options (HO)

(/usr/local/texlive/2019/texmf-dist/tex/generic/kvsetkeys/kvsetkeys.sty
Package: kvsetkeys 2019/12/15 v1.18 Key value parser (HO)
))
(/usr/local/texlive/2019/texmf-dist/tex/latex/logreq/logreq.sty
Package: logreq 2010/08/04 v1.0 xml request logger
\lrq@indent=\count172

(/usr/local/texlive/2019/texmf-dist/tex/latex/logreq/logreq.def
File: logreq.def 2010/08/04 v1.0 logreq spec v1.0
))
(/usr/local/texlive/2019/texmf-dist/tex/latex/base/ifthen.sty
Package: ifthen 2014/09/29 v1.1c Standard LaTeX ifthen package (DPC)
)
(/usr/local/texlive/2019/texmf-dist/tex/latex/url/url.sty
\Urlmuskip=\muskip16
Package: url 2013/09/16  ver 3.4  Verb mode for urls, etc.
)
\c@tabx@nest=\count173
\c@listtotal=\count174
\c@listcount=\count175
\c@liststart=\count176
\c@liststop=\count177
\c@citecount=\count178
\c@citetotal=\count179
\c@multicitecount=\count180
\c@multicitetotal=\count181
\c@instcount=\count182
\c@maxnames=\count183
\c@minnames=\count184
\c@maxitems=\count185
\c@minitems=\count186
\c@citecounter=\count187
\c@maxcitecounter=\count188
\c@savedcitecounter=\count189
\c@uniquelist=\count190
\c@uniquename=\count191
\c@refsection=\count192
\c@refsegment=\count193
\c@maxextratitle=\count194
\c@maxextratitleyear=\count195
\c@maxextraname=\count196
\c@maxextradate=\count197
\c@maxextraalpha=\count198
\c@abbrvpenalty=\count199
\c@highnamepenalty=\count266
\c@lownamepenalty=\count267
\c@maxparens=\count268
\c@parenlevel=\count269
\blx@tempcnta=\count270
\blx@tempcntb=\count271
\blx@tempcntc=\count272
\blx@maxsection=\count273
\blx@maxsegment@0=\count274
\blx@notetype=\count275
\blx@parenlevel@text=\count276
\blx@parenlevel@foot=\count277
\blx@sectionciteorder@0=\count278
\blx@entrysetcounter=\count279
\labelnumberwidth=\skip49
\labelalphawidth=\skip50
\biblabelsep=\skip51
\bibitemsep=\skip52
\bibnamesep=\skip53
\bibinitsep=\skip54
\bibparsep=\skip55
\bibhang=\skip56
\blx@bcfin=\read2
\blx@bcfout=\write3
\blx@langwohyphens=\language85
\c@mincomprange=\count280
\c@maxcomprange=\count281
\c@mincompwidth=\count282
Package biblatex Info: Trying to load biblatex default data model...
Package biblatex Info: ... file 'blx-dm.def' found.

(/usr/local/texlive/2019/texmf-dist/tex/latex/biblatex/blx-dm.def
File: blx-dm.def 2019/12/01 v3.14 biblatex localization (PK/MW)
)
Package biblatex Info: Trying to load biblatex style data model...
Package biblatex Info: ... file 'verbose.dbx' not found.
Package biblatex Info: Trying to load biblatex custom data model...
Package biblatex Info: ... file 'biblatex-dm.cfg' not found.
\c@afterword=\count283
\c@savedafterword=\count284
\c@annotator=\count285
\c@savedannotator=\count286
\c@author=\count287
\c@savedauthor=\count288
\c@bookauthor=\count289
\c@savedbookauthor=\count290
\c@commentator=\count291
\c@savedcommentator=\count292
\c@editor=\count293
\c@savededitor=\count294
\c@editora=\count295
\c@savededitora=\count296
\c@editorb=\count297
\c@savededitorb=\count298
\c@editorc=\count299
\c@savededitorc=\count300
\c@foreword=\count301
\c@savedforeword=\count302
\c@holder=\count303
\c@savedholder=\count304
\c@introduction=\count305
\c@savedintroduction=\count306
\c@namea=\count307
\c@savednamea=\count308
\c@nameb=\count309
\c@savednameb=\count310
\c@namec=\count311
\c@savednamec=\count312
\c@translator=\count313
\c@savedtranslator=\count314
\c@shortauthor=\count315
\c@savedshortauthor=\count316
\c@shorteditor=\count317
\c@savedshorteditor=\count318
\c@labelname=\count319
\c@savedlabelname=\count320
\c@institution=\count321
\c@savedinstitution=\count322
\c@lista=\count323
\c@savedlista=\count324
\c@listb=\count325
\c@savedlistb=\count326
\c@listc=\count327
\c@savedlistc=\count328
\c@listd=\count329
\c@savedlistd=\count330
\c@liste=\count331
\c@savedliste=\count332
\c@listf=\count333
\c@savedlistf=\count334
\c@location=\count335
\c@savedlocation=\count336
\c@organization=\count337
\c@savedorganization=\count338
\c@origlocation=\count339
\c@savedoriglocation=\count340
\c@origpublisher=\count341
\c@savedorigpublisher=\count342
\c@publisher=\count343
\c@savedpublisher=\count344
\c@language=\count345
\c@savedlanguage=\count346
\c@origlanguage=\count347
\c@savedoriglanguage=\count348
\c@pageref=\count349
\c@savedpageref=\count350
\shorthandwidth=\skip57
\shortjournalwidth=\skip58
\shortserieswidth=\skip59
\shorttitlewidth=\skip60
\shortauthorwidth=\skip61
\shorteditorwidth=\skip62
\locallabelnumberwidth=\skip63
\locallabelalphawidth=\skip64
\localshorthandwidth=\skip65
\localshortjournalwidth=\skip66
\localshortserieswidth=\skip67
\localshorttitlewidth=\skip68
\localshortauthorwidth=\skip69
\localshorteditorwidth=\skip70
Package biblatex Info: Trying to load enhanced support for Unicode engines...
Package biblatex Info: ... file 'blx-unicode.def' found.

(/usr/local/texlive/2019/texmf-dist/tex/latex/biblatex/blx-unicode.def)
Package biblatex Info: Trying to load compatibility code...
Package biblatex Info: ... file 'blx-compat.def' found.

(/usr/local/texlive/2019/texmf-dist/tex/latex/biblatex/blx-compat.def
File: blx-compat.def 2019/12/01 v3.14 biblatex compatibility (PK/MW)
)
Package biblatex Info: Trying to load generic definitions...
Package biblatex Info: ... file 'biblatex.def' found.

(/usr/local/texlive/2019/texmf-dist/tex/latex/biblatex/biblatex.def
File: biblatex.def 2019/12/01 v3.14 biblatex compatibility (PK/MW)
\c@textcitecount=\count351
\c@textcitetotal=\count352
\c@textcitemaxnames=\count353
\c@biburlbigbreakpenalty=\count354
\c@biburlbreakpenalty=\count355
\c@biburlnumpenalty=\count356
\c@biburlucpenalty=\count357
\c@biburllcpenalty=\count358
\biburlbigskip=\muskip17
\biburlnumskip=\muskip18
\biburlucskip=\muskip19
\biburllcskip=\muskip20
\c@smartand=\count359
)
Package biblatex Info: Trying to load bibliography style 'verbose'...
Package biblatex Info: ... file 'verbose.bbx' found.

(/usr/local/texlive/2019/texmf-dist/tex/latex/biblatex/bbx/verbose.bbx
File: verbose.bbx 2019/12/01 v3.14 biblatex bibliography style (PK/MW)
Package biblatex Info: Trying to load bibliography style 'authortitle'...
Package biblatex Info: ... file 'authortitle.bbx' found.

(/usr/local/texlive/2019/texmf-dist/tex/latex/biblatex/bbx/authortitle.bbx
File: authortitle.bbx 2019/12/01 v3.14 biblatex bibliography style (PK/MW)
Package biblatex Info: Trying to load bibliography style 'standard'...
Package biblatex Info: ... file 'standard.bbx' found.

(/usr/local/texlive/2019/texmf-dist/tex/latex/biblatex/bbx/standard.bbx
File: standard.bbx 2019/12/01 v3.14 biblatex bibliography style (PK/MW)
\c@bbx:relatedcount=\count360
\c@bbx:relatedtotal=\count361
)))
Package biblatex Info: Trying to load citation style 'verbose'...
Package biblatex Info: ... file 'verbose.cbx' found.

(/usr/local/texlive/2019/texmf-dist/tex/latex/biblatex/cbx/verbose.cbx
File: verbose.cbx 2019/12/01 v3.14 biblatex citation style (PK/MW)
Package biblatex Info: Redefining '\cite'.
Package biblatex Info: Redefining '\parencite'.
Package biblatex Info: Redefining '\footcite'.
Package biblatex Info: Redefining '\footcitetext'.
Package biblatex Info: Redefining '\smartcite'.
Package biblatex Info: Redefining '\textcite'.
Package biblatex Info: Redefining '\textcites'.
)
Package biblatex Info: Trying to load configuration file...
Package biblatex Info: ... file 'biblatex.cfg' found.

(/usr/local/texlive/2019/texmf-dist/tex/latex/biblatex/biblatex.cfg
File: biblatex.cfg 
))
(/usr/local/texlive/2019/texmf-dist/tex/generic/babel/babel.sty
Package: babel 2020/02/14 3.40 The Babel package

(/usr/local/texlive/2019/texmf-dist/tex/generic/babel/switch.def
File: switch.def 2020/02/14 3.40 Babel switching mechanism
)
(/usr/local/texlive/2019/texmf-dist/tex/generic/babel-french/french.ldf
Language: french 2020/01/30 v3.5g French support from the babel system

(/usr/local/texlive/2019/texmf-dist/tex/generic/babel/babel.def
File: babel.def 2020/02/14 3.40 Babel common definitions
\babel@savecnt=\count362
\U@D=\dimen135

(/usr/local/texlive/2019/texmf-dist/tex/generic/babel/xebabel.def
(/usr/local/texlive/2019/texmf-dist/tex/generic/babel/txtbabel.def))
\bbl@readstream=\read3
\bbl@dirlevel=\count363
)
Package babel Info: \l@acadian = using hyphenrules for french
(babel)             (\language28) on input line 91.
Package babel Info: \l@canadien = using hyphenrules for french
(babel)             (\language28) on input line 92.
\FB@nonchar=\count364
Package french.ldf Info: No need for active punctuation characters
(french.ldf)             with this version of XeTeX!
(french.ldf)             reported on input line 331.
\FB@punctthick=\XeTeXcharclass1
\FB@punctthin=\XeTeXcharclass2
\FB@punctnul=\XeTeXcharclass3
\FB@guilo=\XeTeXcharclass4
\FB@guilf=\XeTeXcharclass5
\FB@guilnul=\XeTeXcharclass6
\FBguill@level=\count365
\FBold@everypar=\toks15
\FB@Mht=\dimen136
LaTeX Info: Redefining \degres on input line 782.
\mc@charclass=\count366
\mc@charfam=\count367
\mc@charslot=\count368
\std@mcc=\count369
\dec@mcc=\count370
\c@FBcaption@count=\count371
\listindentFB=\dimen137
\descindentFB=\dimen138
\labelindentFB=\dimen139
\labelwidthFB=\dimen140
\leftmarginFB=\dimen141
\parindentFFN=\dimen142
\FBfnindent=\dimen143
))
(/usr/local/texlive/2019/texmf-dist/tex/latex/carlisle/scalefnt.sty)

Package biblatex Warning: 'babel/polyglossia' detected but 'csquotes' missing.
(biblatex)                Loading 'csquotes' recommended.

\@quotelevel=\count372
\@quotereset=\count373

(/usr/local/texlive/2019/texmf-dist/tex/latex/l3backend/l3backend-xdvipdfmx.def
File: l3backend-xdvipdfmx.def 2020-02-03 L3 backend support: xdvipdfmx
\g__graphics_track_int=\count374
\l__pdf_internal_box=\box45
\g__pdf_backend_object_int=\count375
\g__pdf_backend_annotation_int=\count376
) (./toto.aux)
\openout1 = `toto.aux'.

LaTeX Font Info:    Checking defaults for OML/cmm/m/it on input line 5.
LaTeX Font Info:    ... okay on input line 5.
LaTeX Font Info:    Checking defaults for OMS/cmsy/m/n on input line 5.
LaTeX Font Info:    ... okay on input line 5.
LaTeX Font Info:    Checking defaults for OT1/cmr/m/n on input line 5.
LaTeX Font Info:    ... okay on input line 5.
LaTeX Font Info:    Checking defaults for T1/cmr/m/n on input line 5.
LaTeX Font Info:    ... okay on input line 5.
LaTeX Font Info:    Checking defaults for TS1/cmr/m/n on input line 5.
LaTeX Font Info:    Trying to load font information for TS1+cmr on input line 5
.
 (/usr/local/texlive/2019/texmf-dist/tex/latex/base/ts1cmr.fd
File: ts1cmr.fd 2019/12/16 v2.5j Standard LaTeX font definitions
)
LaTeX Font Info:    ... okay on input line 5.
LaTeX Font Info:    Checking defaults for TU/lmr/m/n on input line 5.
LaTeX Font Info:    ... okay on input line 5.
LaTeX Font Info:    Checking defaults for OMX/cmex/m/n on input line 5.
LaTeX Font Info:    ... okay on input line 5.
LaTeX Font Info:    Checking defaults for U/cmr/m/n on input line 5.
LaTeX Font Info:    ... okay on input line 5.
Package biblatex Info: Trying to load language 'french'...
Package biblatex Info: ... file 'french.lbx' found.

(/usr/local/texlive/2019/texmf-dist/tex/latex/biblatex/lbx/french.lbx
File: french.lbx 2019/12/01 v3.14 biblatex localization (PK/MW)
)
Package biblatex Info: XeTeX detected.
(biblatex)             Assuming input encoding 'utf8'.
Package biblatex Info: Automatic encoding selection.
(biblatex)             Assuming data encoding 'utf8'.
\openout3 = `toto.bcf'.

Package biblatex Info: Trying to load bibliographic data...
Package biblatex Info: ... file 'toto.bbl' found.

(./toto.bbl)
Package biblatex Info: Reference section=0 on input line 5.
Package biblatex Info: Reference segment=0 on input line 5.
LaTeX Info: Redefining \dots on input line 5.
LaTeX Info: Redefining \up on input line 5.
 [1

] (./toto.aux)

 *File List*
 article.cls    2019/12/20 v1.4l Standard LaTeX document class
  size10.clo    2019/12/20 v1.4l Standard LaTeX file (size option)
biblatex.sty    2019/12/01 v3.14 programmable bibliographies (PK/MW)
pdftexcmds.sty    2019/11/24 v0.31 Utility functions of pdfTeX for LuaTeX (HO)
infwarerr.sty    2019/12/03 v1.5 Providing info/warning/error messages (HO)
   iftex.sty    2019/11/07 v1.0c TeX engine tests
 ltxcmds.sty    2019/12/15 v1.24 LaTeX kernel commands for general use (HO)
etoolbox.sty    2019/09/21 v2.5h e-TeX tools for LaTeX (JAW)
  keyval.sty    2014/10/28 v1.15 key=value parser (DPC)
kvoptions.sty    2019/11/29 v3.13 Key value format for package options (HO)
kvsetkeys.sty    2019/12/15 v1.18 Key value parser (HO)
  logreq.sty    2010/08/04 v1.0 xml request logger
  logreq.def    2010/08/04 v1.0 logreq spec v1.0
  ifthen.sty    2014/09/29 v1.1c Standard LaTeX ifthen package (DPC)
     url.sty    2013/09/16  ver 3.4  Verb mode for urls, etc.
  blx-dm.def    2019/12/01 v3.14 biblatex localization (PK/MW)
blx-unicode.def
blx-compat.def    2019/12/01 v3.14 biblatex compatibility (PK/MW)
biblatex.def    2019/12/01 v3.14 biblatex compatibility (PK/MW)
standard.bbx    2019/12/01 v3.14 biblatex bibliography style (PK/MW)
authortitle.bbx    2019/12/01 v3.14 biblatex bibliography style (PK/MW)
 verbose.bbx    2019/12/01 v3.14 biblatex bibliography style (PK/MW)
 verbose.cbx    2019/12/01 v3.14 biblatex citation style (PK/MW)
biblatex.cfg    
   babel.sty    2020/02/14 3.40 The Babel package
  french.ldf    2020/01/30 v3.5g French support from the babel system
scalefnt.sty    
l3backend-xdvipdfmx.def    2020-02-03 L3 backend support: xdvipdfmx
  ts1cmr.fd    2019/12/16 v2.5j Standard LaTeX font definitions
  french.lbx    2019/12/01 v3.14 biblatex localization (PK/MW)
    toto.bbl
 ***********

Package logreq Info: Writing requests to 'toto.run.xml'.
\openout1 = `toto.run.xml'.

 ) 
Here is how much of TeX's memory you used:
 8931 strings out of 479819
 165071 string characters out of 5893613
 819313 words of memory out of 5000000
 26019 multiletter control sequences out of 15000+600000
 532354 words of font info for 26 fonts, out of 8000000 for 9000
 1348 hyphenation exceptions out of 8191
 35i,4n,35p,819b,3877s stack positions out of 5000i,500n,10000p,200000b,80000s

Output written on toto.xdv (1 page, 1548 bytes).
moewew commented 4 years ago

Thanks. Yes, I can only reproduce this with XeLaTeX. You can see the same effects in

\documentclass[french]{article}
\usepackage{babel}
\usepackage{hyphenat}

\begin{document}
Cambridge : University

\nohyphens{Cambridge} : University

\texttt{Cambridge} : University

\verb|Cambridge| : University

Cambridge\relax : University

\nohyphens{Cambridge}\relax : University

\texttt{Cambridge}\relax : University

\verb|Cambridge|\relax : University
\end{document}

Note that the behaviour can be suppressed by adding \relax, so this seems very fragile.

I have no idea if I'll be able to come up with a suitable solution here. This seems to be either a XeLaTeX issue or an issue with how babel-french does punctuation spacing in XeLaTeX and I know next to nothing about both issues.


edit biblatex MWE

\documentclass[french]{article}
\usepackage{babel}
\usepackage{csquotes}

\usepackage[style=authortitle, backend=biber]{biblatex}

\DeclareDelimFormat*{nametitledelim}{\addcolon\space}
\DeclareDelimFormat[textcite]{nametitledelim}{\addspace}

\addbibresource{biblatex-examples.bib}

\begin{document}
\cite{sigfridsson}

\textsc{Sigfridsson} et \textsc{Ryde}: \enquote{Comparison of methods
for deriving atomic charges from the electrostatic potential and moments}

\textsc{Sigfridsson} : Lorem

\mkbibnamefamily{Sigfridsson} : Lorem

\printbibliography
\end{document}
maieul commented 4 years ago

I think that is most linked to xelatex, as it is the seems problem with polyglossia.

Maybe we should ask help to SE, with your MWE?

moewew commented 4 years ago

Sure, go ahead.

maieul commented 4 years ago

https://tex.stackexchange.com/questions/534015/xetex-nohyphen-space-and-babel-polyglossia

moewew commented 4 years ago

https://github.com/plk/biblatex/commit/cd0cccf5cc8144b27786c21ea55c413d0ac3a297 implements Ulrike's workaround from https://tex.stackexchange.com/a/544914/35864. From what I can see so far I don't think this is 'our' bug (the LaTeX kernel uses the same method to avoid hyphenation in \verb, I stole the idea from hyphenat), it appears to be a XeTeX issue. Fingers crossed that the fix does not cause any other issues.

moewew commented 4 years ago

The fix discussed here is included in biblatex 3.15 which was released a few days back and is now available in both MikTeX and TeX live.

The MWE from the first post should now produce the desired result in XeLaTeX. Please open a new issue in case the fix causes other difficulties.

moewew commented 4 months ago

But see https://tex.stackexchange.com/q/720152/35864, which we hopefully fix with https://github.com/plk/biblatex/commit/23f654df8f8f51002b686203b559cbe06dbb941c.