3

I'm trying to use this answer: Fake small caps to use fake small caps with Times New Roman in my biblatex bibliography.

For some reason I get the error message "improper alphabetic constant". It seems to be some problem with the rest of my document. Because the linked solution works fine on its own.

Here is my MWE:

% !TEX encoding = UTF-8 Unicode
\documentclass{scrartcl}%
\usepackage[ngerman]{babel}%
\usepackage[utf8]{inputenc}%
\usepackage[T1]{fontenc}%
\usepackage{lipsum}%
\usepackage[%
backend=biber,%
bibstyle=authortitle,% BIBLIOGRAPHY
citestyle=authoryear,% CITATIONS
hyperref=true,%
backref=false,%
sorting=nty,%
maxnames=99,%
isbn=false,%
block=ragged,%
dashed=false,%
]{biblatex}
\usepackage{hyperref}
% ==========================================================
% ==========================================================
% ==========================================================
% FAKE SMALL CAPS 
\usepackage{fontspec,graphicx}
\setmainfont{Times New Roman}
%
%
%
\makeatletter
\newlength\fake@f
\newlength\fake@c
\def\fakesc#1{%
  \begingroup%
  \xdef\fake@name{\csname\curr@fontshape/\f@size\endcsname}%
  \fontsize{\fontdimen8\fake@name}{\baselineskip}\selectfont%
  \uppercase{#1}%
  \endgroup%
}
\makeatother
\newcommand\fauxsc[1]{\fauxschelper#1 \relax\relax}
\def\fauxschelper#1 #2\relax{%
  \fauxschelphelp#1\relax\relax%
  \if\relax#2\relax\else\ \fauxschelper#2\relax\fi%
}
\def\Hscale{.83}\def\Vscale{.72}\def\Cscale{1.00}
\def\fauxschelphelp#1#2\relax{%
  \ifnum`#1>``\ifnum`#1<`\{\scalebox{\Hscale}[\Vscale]{\uppercase{#1}}\else%
    \scalebox{\Cscale}[1]{#1}\fi\else\scalebox{\Cscale}[1]{#1}\fi%
  \ifx\relax#2\relax\else\fauxschelphelp#2\relax\fi}
%
\renewcommand*{\mkbibnamefamily}{\fauxsc}% 
% ==========================================================
% ==========================================================
% ==========================================================
%
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@COMMENTARY{beck.ok,
    MAINTITLE       = {Beck'scher Online-Kommentar BGB},
    SHORTTITLE      = {},
    EDITOR          = {Bamberger, Heinz Georg and Roth, Herbert and Hau, Wolfgang and Poseck, Roman},
    SHORTHAND       = {BeckOK},
    VOLUME          = {},
    TITLE           = {},
    YEAR            = {2018},
    EDITION         = {45},
    OPTIONS         = {howcited},
}

@COMMENTARY{muko.bd1,
    MAINTITLE       = {Münchener Kommentar zum Bürgerlichen Recht},
    SHORTTITLE      = {},
    SHORTHAND       = {MünchKomm},
    EDITOR          = {Säcker, Franz},
    SHORTAUTHOR     = {},
    VOLUME          = {1},
    TITLE           = {Allgemeiner Teil},
    YEAR            = {2015},
    ADDRESS         = {},
    EDITION         = {7},
    OPTIONS         = {howcited},
}

@INCOLLECTION{fs.roxin,
    AUTHOR          = {Beckemper, Katharina},
    TITLE           = {Unvernunft als Zurechnungskriterium in den „Retterfällen“},
    EDITOR          = {Manfred, Heinrich},
    BOOKTITLE       = {Strafrecht als Scientia Universalis - Festschrift f{\"u}r Claus Roxin zum 80. Geburtstag},
    SHORTTITLE      = {FS Roxin},
    YEAR            = {2011},
    PAGES           = {397--411},
    OPTIONS         = {fshowcited},
}

@ARTICLE{jus2007.881,
    author          = {Jörg Neuner},
    title           = {Was ist eine Willenserklärung?},
    journal         = {JuS},
    year            = {2007},
    pages           = {881--888},
}
%   
\end{filecontents}
\addbibresource{\jobname.bib}
%
%
%
% === merged files ====
%
%
% biblatex.cfg
% biblatex.cfg
% biblatex.cfg
%%%
\DeclareNameAlias{sortname}{family-given-bold}
\DeclareNameFormat{family-given-bold}{%
  \mkbibbold{%
    \ifgiveninits
      {\usebibmacro{name:family-given}
         {\namepartfamily}
         {\namepartgiveni}
         {\namepartprefix}
         {\namepartsuffix}}
      {\usebibmacro{name:family-given}
         {\namepartfamily}
         {\namepartgiven}
         {\namepartprefix}
         {\namepartsuffix}}%
    \usebibmacro{name:andothers}}}
% ==========================================================
% === Titel nicht kursiv ===
%
\DeclareFieldFormat*{citetitle}{#1}% Zitate: Schriftart der Titel
\DeclareFieldFormat*{title}{#1}% Titel im LitVZ
\DeclareFieldFormat*{maintitle}{#1}
\DeclareFieldFormat*{journaltitle}{#1}%
\DeclareFieldFormat*{booktitle}{#1}
%
% ==========================================================
% === kein Punkt in Library ===
%
\renewcommand{\finentrypunct}{}% Kein Punkt am Ende des Eintrags im LitVZ
% ==========================================================
% === Hrsg. ===
%
\DeclareFieldFormat{authortype}{\mkbibparens{#1}}% Authortyp in Klammern
\DeclareFieldFormat{editortype}{\mkbibparens{#1}}% Editortyp in Klammern
\DeclareFieldFormat[incollection]{editortype}{\mkbibparens{#1}}%
% ==========================================================
\DeclareDelimFormat{authortypedelim}{\addspace}% Kein Komma nach Autor
\DeclareDelimFormat{editortypedelim}{\addspace}% Kein Komma nach Editor
% ==========================================================
\DeclareDelimFormat[bib,biblist]{nametitledelim}{\addspace}%
% ==========================================================
% === Auflage/Aufl. ===
%
\DefineBibliographyStrings{german}{%
  edition          = {\ifbibliography{Auflage}{Aufl\adddot}},% 'Auflage' statt 'Aufl.'
}
% ==========================================================
% === kein S. bei @article & @incollection ===
%
\DeclareFieldFormat[article,incollection]{pages}{%
  \ifcitation
    {\mkfirstpage{#1}}
    {#1}}%
% ==========================================================
% === Erkennt Satzzeichen & setzt kein Komma ausser bei Abkurzungen ===
%
\DefineBibliographyExtras{german}{\DeclarePunctuationPairs{comma}{*}}
% ==========================================================
% === @article keine Titel zitieren ===
%
\DeclareFieldFormat[article]{citetitle}{}%
% ==========================================================
% === bei @article @incollection postnote in klammern fur seitenzahl ===
%
\AtEveryCite{%
    \DeclareFieldFormat[article, incollection]{postnote}{\mkbibparens{#1}}%
}

% ==========================================================
% === bib driver @commentary ===
%
\DeclareBibliographyDriver{commentary}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author/editor+others/translator+others}%
  \setunit{\printdelim{nametitledelim}}\newblock
  \usebibmacro{maintitle+title}%
  \newunit\newblock
  \usebibmacro{byauthor}%
  \newunit\newblock
  \usebibmacro{byeditor+others}%
  \newunit\newblock
  \printfield{edition}
  \newunit
  \usebibmacro{location+date}%
  \newunit\newblock
  \usebibmacro{finentry}}
% ==========================================================
% === @commentary prenote position === otherwise use: https://tex.stackexchange.com/a/430758/53779
%
\DeclareCiteCommand{\footcite}[\mkbibfootnote]%
  {\ifentrytype{commentary}{}{\usebibmacro{prenote}}}
  {\usebibmacro{citeindex}%
   \printtext[bibhyperref]{%
     \DeclareFieldFormat{bibhyperref}{####1}%
     \usebibmacro{cite}%
     \ifentrytype{commentary}
       {\textbf{\addslash}%
        \textit{\usebibmacro{prenote}}}
       {}}}
  {\multicitedelim}
  {\usebibmacro{postnote}}
%
\DeclareCiteCommand{\cite}%[\mkbibcite]%
  {\ifentrytype{commentary}{}{\usebibmacro{prenote}}}
  {\usebibmacro{citeindex}%
   \printtext[bibhyperref]{%
     \DeclareFieldFormat{bibhyperref}{####1}%
     \usebibmacro{cite}%
     \ifentrytype{commentary}
       {\textbf{\addslash}%
        \textit{\usebibmacro{prenote}}}
       {}}}
  {\multicitedelim}
  {\usebibmacro{postnote}}
% ==========================================================
% === @incollection herausgeber der festschrift nicht fett ===
%
\DeclareNameAlias{ineditor}{family-given}

\newbibmacro*{bbx:in:editor}[1]{%
  \ifboolexpr{
    test \ifuseeditor
    and
    not test {\ifnameundef{editor}}
  }
    {\printnames[ineditor]{editor}%
     \setunit{\printdelim{editortypedelim}}%
     \usebibmacro{#1}%
     \clearname{editor}}
    {}}
\newbibmacro*{in:editor}{%
  \usebibmacro{bbx:in:editor}{editorstrg}}
\newbibmacro*{in:editor+others}{%
  \usebibmacro{bbx:in:editor}{editor+othersstrg}}

\DeclareBibliographyDriver{incollection}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author/translator+others}%
  \setunit{\printdelim{nametitledelim}}\newblock
  \usebibmacro{title}%
  \newunit
  \printlist{language}%
  \newunit\newblock
  \usebibmacro{byauthor}%
  \newunit\newblock
  \usebibmacro{in:}%
  \newunit\newblock
  \usebibmacro{in:editor+others}%<----- new macro
  \newunit\newblock
  \usebibmacro{maintitle+booktitle}%
  \newunit\newblock
%  \usebibmacro{editor+others}% OLD
  \newunit\newblock
  \printfield{edition}%
  \newunit
  \iffieldundef{maintitle}
    {\printfield{volume}%
     \printfield{part}}
    {}%
  \newunit
  \printfield{volumes}%
  \newunit\newblock
  \usebibmacro{series+number}%
  \newunit\newblock
  \printfield{note}%
  \newunit\newblock
  \usebibmacro{publisher+location+date}%
  \newunit\newblock
  \usebibmacro{chapter+pages}%
  \newunit\newblock
  \iftoggle{bbx:isbn}
    {\printfield{isbn}}
    {}%
  \newunit\newblock
  \usebibmacro{doi+eprint+url}%
  \newunit\newblock
  \usebibmacro{addendum+pubstate}%
  \setunit{\bibpagerefpunct}\newblock
  \usebibmacro{pageref}%
  \newunit\newblock
  \iftoggle{bbx:related}
    {\usebibmacro{related:init}%
     \usebibmacro{related}}
    {}%
  \usebibmacro{finentry}}
% ==========================================================
% === Kommentare: zitiert als Option ===
%
\newtoggle{tnbcbx@howcited}
\DeclareEntryOption[boolean]{howcited}[true]{\settoggle{tnbcbx@howcited}{#1}}
\DeclareBibliographyOption[boolean]{howcited}[true]{\settoggle{tnbcbx@howcited}{#1}}
\DeclareTypeOption[boolean]{howcited}[true]{\settoggle{tnbcbx@howcited}{#1}}

\newbibmacro{howcited}{%
  \iftoggle{tnbcbx@howcited}
    {\iffieldundef{shorthand}
       {}
       {\setunit{\addspace}%
        \printtext[parens]{%
          \bibstring{citedas}%
          \setunit{\addcolon\space}%
          \printfield{shorthand}%
          \setunit{\addslash}%
          \bibstring[\emph]{bearbeiter}}}}
    {}}

\NewBibliographyString{bearbeiter}
\DefineBibliographyStrings{ngerman}{
  citedas    = {zitiert als},
  bearbeiter = {Bearbeiter},
}

% ==========================================================
% === Incollection zitiert als option ===
%
\newtoggle{tnbcbx@fshowcited}
\DeclareEntryOption[boolean]{fshowcited}[true]{\settoggle{tnbcbx@fshowcited}{#1}}
\DeclareBibliographyOption[boolean]{fshowcited}[true]{\settoggle{tnbcbx@fshowcited}{#1}}
\DeclareTypeOption[boolean]{fshowcited}[true]{\settoggle{tnbcbx@fshowcited}{#1}}

\newbibmacro{fshowcited}{%
  \iftoggle{tnbcbx@fshowcited}
    {\iffieldundef{shorttitle}
       {}
       {\setunit{\addspace}%
        \printtext[parens]{%
          \bibstring{citedas}%
          \setunit{\addcolon\space}%
          \begingroup
            \csuse{blx@hook@cite}%
            \csuse{blx@hook@citekey}%
            \DeclareFieldFormat{bibhyperref}{##1}%
            \printnames{labelname}%
            \setunit{\addcomma\space}%
            \printfield{shorttitle}%
          \endgroup
          }}}
    {}}

\renewbibmacro{finentry}{\usebibmacro{howcited}\usebibmacro{fshowcited}\finentry}
% ==========================================================
% ==========================================================
% ==========================================================
% mybiblatexcfg.tex
% mybiblatexcfg.tex
% mybiblatexcfg.tex
% ==========================================================
% ==========================================================
% ==========================================================
%
\renewcommand{\finentrypunct}{}% kein Punkt am Ende im LitVZ
% ==========================================================
%\renewcommand*{\mkbibnamefamily}{\fauxsc}% Autoren in Kapitaelchen
%==========================================================
\AtEveryCite{%
\renewcommand{\mkbibnamefamily}[1]{\mkbibemph{#1}}%
}%
% ==========================================================
\renewcommand*{\multinamedelim}{~\textbf{/}\space}%
  \renewcommand*{\finalnamedelim}{~\textbf{/}\space}%
% ==========================================================
\renewcommand*{\newunitpunct}{\addcomma\space}%
% ==========================================================
\renewbibmacro{in:}{% 
  \ifentrytype{article}
  {}
  {\printtext{\bibstring{in}\intitlepunct}}}
% ==========================================================
\renewbibmacro{issue+date}{%
    \printfield{issue}%
    \setunit*{\addspace}%
    \usebibmacro{date}%}%
  \newunit}
% ==========================================================
% =========== print 'Author, Journal Year, firstpage' =========
% ======================== 09.05.18 ====================
\newbibmacro*{cite:article:journal}{%
       \newunit
       \printfield{journaltitle}}
%
\newbibmacro*{cite:article:pages}{%
%\newunit%\addcomma
\printfield{pages}}
%
\newbibmacro*{cite:book:shorttitle}{%
  \printfield[citetitle]{labeltitle}}
%
\renewcommand*{\postnotedelim}{\addspace}
% ========================================================
\renewbibmacro{cite}{%
  \iffieldundef{shorthand}%
    {\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}%
       {\usebibmacro{cite:label}%
        \setunit{\printdelim{nonameyeardelim}}}
       {\printnames{labelname}%
        \setunit{\printdelim{nameyeardelim}}}%
     \ifentrytype{book}
       {\setunit{\printdelim{nametitledelim}}%
        \usebibmacro{cite:book:shorttitle}}
       {}%
     \ifentrytype{article}
       {\newunit
        \usebibmacro{cite:article:journal}%
        \setunit{\addspace}%
        \usebibmacro{cite:labeldate+extradate}%
        \newunit
        \usebibmacro{cite:article:pages}}
       {}%
     \ifentrytype{incollection}
       {\setunit{\printdelim{nametitledelim}}%
        \usebibmacro{cite:book:shorttitle}%
        \newunit
        \usebibmacro{cite:article:pages}}
       {}}
    {\usebibmacro{cite:shorthand}}}
%
% ==========================================================
% ==========================================================
%
\begin{document}
%
% ==========================================================
\printbibliography[title=Literaturverzeichnis alt,heading=bibintoc]
\tableofcontents% 
% ==========================================================
Test
\footcite[399]{fs.roxin}\footcite[Wendtland][§ 240 Rn. 63]{beck.ok}\footcite[888]{jus2007.881}
%-----
\end{document}

Any idea what went wrong? Thanks in advance!

5
  • 1
    You should either use fontspec with XeLaTeX/LuaLaTeX, or set up the legacy NFSS encodings with fontenc and inputenc, but not both. (UTF-8 input is also the default on recent versions of LaTeX.) If you’re using fontspec, your input and font encodings are Unicode.
    – Davislor
    Aug 2 '18 at 2:31
  • @Sebastiano Yes, I've linked that specific thread in my ask.
    – texnewbie
    Aug 2 '18 at 13:40
  • @texnewbie Ok. I have removed my comment. Good LaTeX.
    – Sebastiano
    Aug 2 '18 at 19:22
  • Thanks for the link to the other question. It’s an XY problem today (since Times New Roman does now come with small caps) but solving it with fontspec and l3kernel was a good exercise for learning expl3..
    – Davislor
    Aug 3 '18 at 12:18
  • For those stumbling upon this question later: the "improper alphabetic constant" can come up because \fauxsc isn't desgined to read macros in general. Steven B. Segletes mentions this in a comment to his original answer: Additionally, the \fauxsc macro is not set up to read macros in general. If the macro expands directly to your desired text, you would use \expandafter\fauxsc\expandafter{\foo}, so that \foo is expanded to text before it is seen by \fauxsc
    – Hippo
    Jun 16 '20 at 17:44
2

The answer by egreg would have worked if he hadn’t attempted to load a separate font for the small caps. Times New Roman has a small-caps feature that works just fine if you change \fauxsc to \textsc. With recent versions of either Times New Roman (I tested 7.00) or TeX Gyre Termes, there’s no need to fake small caps at all!

The reason the small caps were not the correct weight in egreg’s answer is that the small caps fonts for upright, bold, and so forth must be specified separately (q.v. section 3.1 of the fontspec manual).

\setmainfont{Times New Roman}[
   SmallCapsFeatures={Letters=SmallCaps, Scale=MatchUppercase},
   UprightFeatures={SmallCapsFont = TeX Gyre Termes},
   BoldFeatures={SmallCapsFont = TeX Gyre Termes Bold},
   ItalicFeatures={SmallCapsFont = TeX Gyre Termes Italic},
   BoldItalicFeatures={SmallCapsFont = TeX Gyre Termes Bold Italic}
]

As you can see, I scaled the small-caps font so its height matches.

You also need to, as egreg posted, change \fauxsc to \textsc.

\renewcommand*{\mkbibnamefamily}{\textsc}

I also made the following other minor changes to your document: removed the now-unused commands, removed fontenc and inputenc (fontspec always uses Unicode encodings anyway), and added \usepackage{csquotes}.

Bold small-caps now works properly and is correctly scaled:

Bibliography with bold small-caps

You’d probably also want to set the font for your captions, e.g. \setsansfont{TeX Gyre Heros}[Scale=MatchUppercase].

2
  • Actually small caps in Times New Roman work at least since version 6.98. Thanks for bringing that to my attention!!!
    – texnewbie
    Aug 2 '18 at 14:43
  • @texnewbie The thing to worry about in some older versions of fonts that shipped with MS Windows/Office was lowercase i turning into small-caps dotted İ, as in Turkish. I originally learned how to do this trick to fix Palatino Linotype. I think that was corrected years ago, but there are still copies of Office 2003 floating around.
    – Davislor
    Aug 2 '18 at 17:05
2

Use a Times clone supporting small caps. If I change the font loading into

\setmainfont{Times New Roman}[
  SmallCapsFont=TeX Gyre Termes,
  SmallCapsFeatures={Letters=SmallCaps},
]

and replace \fauxsc with \textsc,

\renewcommand*{\mkbibnamefamily}{\textsc}

I get

enter image description here

I believe this is typographically very dubious: the whole name should be in small caps.

4
  • I thought it was common in some European styles to have a small caps family name? Perhaps I'm mistaken. I agree the bold first name looks a bit jarring in combination. Aug 1 '18 at 23:42
  • @WillRobertson The surname not showing up in the correct weight or height is an error; see my answer.
    – Davislor
    Aug 2 '18 at 3:45
  • @WillRobertson By the way, great packages!
    – Davislor
    Aug 2 '18 at 3:47
  • Thanks, but I've already done that. And I don't like the TeX Gyre Termes small caps mixed with Times New Roman. As asked, I really want to use Times New Roman.
    – texnewbie
    Aug 2 '18 at 13:43

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.