josephwright / biblatex-ieee

A biblatex implementation of the IEEE bibliography style
LaTeX Project Public License v1.3c
46 stars 14 forks source link

Accented letters are not protected from case change in titles #32

Closed josephwright closed 7 years ago

josephwright commented 7 years ago

From TeX-sx:

\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@Article{Demo,
  author  = {{\"{U}}ding, G{\"{u}}nther},
  title   = {{\"{U}}ber {\"{U}}berlegungen zur {\"{U}}berwindung des {Ü}bels},
  year    = {1996}
}
\end{filecontents*}
\documentclass{article}
\listfiles
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[style=ieee]{biblatex}
\addbibresource{\jobname.bib}
\begin{document}
\nocite{*}
\printbibliography
\end{document}
josephwright commented 7 years ago

Ah, 'it's not my fault'! The above gives .bbl file

% $ biblatex auxiliary file $
% $ biblatex bbl format version 2.8 $
% Do not modify the above lines!
%
% This is an auxiliary file used by the 'biblatex' package.
% This file may safely be deleted. It will be recreated by
% biber as required.
%
\begingroup
\makeatletter
\@ifundefined{ver@biblatex.sty}
  {\@latex@error
     {Missing 'biblatex' package}
     {The bibliography requires the 'biblatex' package.}
      \aftergroup\endinput}
  {}
\endgroup

\refsection{0}
  \sortlist[entry]{none/global/}
    \entry{Demo}{article}{}
      \name{author}{1}{}{%
        {{hash=e93b30a4aacc2949f9c71b603690c2a8}{%
           family={Üding},
           familyi={Ü\bibinitperiod},
           given={Günther},
           giveni={G\bibinitperiod}}}%
      }
      \strng{namehash}{e93b30a4aacc2949f9c71b603690c2a8}
      \strng{fullhash}{e93b30a4aacc2949f9c71b603690c2a8}
      \strng{authornamehash}{e93b30a4aacc2949f9c71b603690c2a8}
      \strng{authorfullhash}{e93b30a4aacc2949f9c71b603690c2a8}
      \field{sortinit}{1}
      \field{sortinithash}{27a2bc5dfb9ed0a0422134d636544b5d}
      \field{labelnamesource}{author}
      \field{labeltitlesource}{title}
      \field{title}{Über Überlegungen zur Überwindung des Übels}
      \field{year}{1996}
    \endentry
  \endsortlist
\endrefsection
\endinput

which has lost the brace protection. If you do the same using the BibTeX back-end, the braces are retained:

% $ biblatex auxiliary file $
% $ biblatex bbl format version 2.8 $
% Do not modify the above lines!
%
% This is an auxiliary file used by the 'biblatex' package.
% This file may safely be deleted. It will be recreated as
% required.
%
\begingroup
\makeatletter
\@ifundefined{ver@biblatex.sty}
  {\@latex@error
     {Missing 'biblatex' package}
     {The bibliography requires the 'biblatex' package.}
      \aftergroup\endinput}
  {}
\endgroup

\sortlist[entry]{none/global/}
  \entry{Demo}{article}{}
    \name{author}{1}{}{%
      {{hash=UG}{%
         family={{\"{U}}ding},
         familyi={{\"{U}}\bibinitperiod},
         given={G{\"{u}}nther},
         giveni={G\bibinitperiod},
      }}%
    }
    \strng{namehash}{UG1}
    \strng{fullhash}{UG1}
    \field{labelnamesource}{author}
    \field{labeltitlesource}{title}
    \field{title}{{\"{U}}ber {\"{U}}berlegungen zur {\"{U}}berwindung des
  {Ü}bels}
    \field{year}{1996}
  \endentry
\endsortlist
\endinput

and tracing through the issue is with \MakeSentenceCase. I'll track the latter down at the biblatex core level but the Biber issue will need to go to @plk.

u-fischer commented 7 years ago

Imho it would be better if the style would use \MakeSentenceCase* to allow to suppress the case change by language/langid. But the one would need to redefine \bbx@colon@search. Currently one gets an unwanted star:

\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@Article{Demo,
  author  = {{\"{U}}ding, G{\"{u}}nther},
  title   = {{\"{U}}ber {\"{U}}berlegungen zur {\"{U}}berwindung des {Ü}bels},
  year    = {1996}
}
\end{filecontents*}
\documentclass{article}
\listfiles
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[style=ieee]{biblatex}
\addbibresource{\jobname.bib}
\makeatletter
\DeclareFieldFormat{sentencecase}{\bbx@colon@search
                                   \MakeSentenceCase*{#1}}
\makeatother
\begin{document}
\nocite{*}
\printbibliography
\end{document}
plk commented 7 years ago

Yes, I already had to do this for the APA style:

\newcommand*{\bbx@colon@search}[3]{%
  \bbx@colon@search@aux#1#2\empty#3: \stop
}
\long\def\bbx@colon@search@aux#1#2#3: #4\stop{%
  \expandafter#1\expandafter#2\expandafter{#3}%
  \ifblank{#4}
    {}
    {%
      : %
      \bbx@colon@search@aux#1#2\empty#4\stop
    }%
}
plk commented 7 years ago

The biber recoding issue should be fixed in 2.8 DEV.

josephwright commented 7 years ago

I've switched to \MakeSentencecase* here, but I'll log an issue in the biblatex core to remind me to look at the behaviour of \MakeSentencecase itself.