3

The management of kerning appears in LaTeX not so effective in the case of note numbers. A magnificent solution for footnotes has been provided by David Purton in this thread:

Lining numbers for footnote

Now, since I have to produce an article with the notes at the end of the text, that solution does not work. Is there a way to re-adapt the code produced by David Purton to endnotes?

I enclose a MWE of the basic endnotes code, obviously without kerning.

\documentclass{article}
\usepackage{fontspec}
\usepackage[english]{babel}
\babelfont[english]{rm}[Ligatures=TeX,Numbers=Proportional,OldStyle},RawFeature=+calt]{Source Serif Pro}

\usepackage{endnotes}
\usepackage{etoolbox}
\preto{\theendnotes}{%
\renewcommand{\makeenmark}{\textsuperscript{\theenmark}\enspace}%
}
\let\footnote=\endnote

\begin{document}

text text «text»\footnote{Footnote text.}.

text text «text»\footnote{Footnote text.}.

text text «text»\footnote{Footnote text.}.

text text «text»\footnote{Footnote text.}.

text text «text»\footnote{Footnote text.}.

text text «text»\footnote{Footnote text.}.

\theendnotes

\end{document}

Thank you

ADDENDUM

A more complex test, with superscript footnotes numbers, but for bibliography:

\begin{filecontents*}{jobname.bib}
@book{ stegmuller:1976,
  author         = "Stegmüller, Wolfgang",
  title          = "The Structure and Dynamics of Theories",
  publisher  = "Springer",
  location   = "New-York Heidelberg Berlin",
  year       = "1976",
}
\end{filecontents*}{jobname.bib}

    \documentclass[a4paper,11pt]{article}
\usepackage{fontspec}
\usepackage[english]{babel}
\babelfont[english]{rm}[Ligatures=TeX,Numbers={Proportional,OldStyle},RawFeature=+supkern,RawFeature=+calt]{Source Serif Pro}

\usepackage{xpatch}
    \usepackage{etoolbox}
\preto{\theendnotes}{%
  \renewcommand{\makeenmark}{\textsuperscript{\theenmark}\enspace}%
}
\let\footnote=\endnote

\usepackage{realscripts}

\ExplSyntaxOn
\cs_new_protected:Nn \__realscripts_numtosup:n
  {
    \str_set:Nn \l_tmpa_str {#1}
    \str_map_inline:Nn \l_tmpa_str
      {
        \str_if_in:nnTF {0123456789} {##1}
          {
            \int_set:Nn \l_tmpa_int {##1}
            \if_case:w \l_tmpa_int ⁰
              \or: ¹
              \or: ²
              \or: ³
              \or: ⁴
              \or: ⁵
              \or: ⁶
              \or: ⁷
              \or: ⁸
              \or: ⁹
            \fi:
          }
          { { \addfontfeature {VerticalPosition=Superior} ##1 } }
      }
  }
\cs_generate_variant:Nn \__realscripts_numtosup:n { x }
\DeclareDocumentCommand \realsuperscript { m }
  {
    \fontspec_if_fontspec_font:TF
      {
        \fontspec_if_opentype:TF
          {
            \fontspec_if_feature:nTF { +sups }
              { \__realscripts_numtosup:x {#1} }
              { \fakesuperscript {#1} }
          }
          {
            \fontspec_if_aat_feature:nnTF {10} {1}
              { \__realscripts_numtosup:x {#1} }
              { \fakesuperscript {#1} }
          }
      }
      { \fakesuperscript {#1} }
  }
\ExplSyntaxOff
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%% BIBLIOGRAPHY
\usepackage[babel]{csquotes}

\usepackage[backend=biber,style=philosophy-verbose,scauthors=all,%
lowscauthors=true,giveninits,classical=true,volnumformat=strings,%
volumeformat=romansc,sorting=nyt,commacit=true,citepages=omit,%
editionformat=superscript,indexing]%
{biblatex}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\addbibresource{jobname.bib}
\nocite{*}

\begin{document}

Text\footnote{Footnote text} more «text»\footcite[220]{stegmuller:1976}. Further text

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\linespread{0.9}
\theendnotes

\printbibliography[heading=bibintoc]

\end{document}

Does \footcite have a different approach to superscript numbers?

LAST UPDATE

When I try to compile this source:

  \begin{filecontents*}{\jobname.bib}
  @book{ stegmuller:1976,
  author     = "Stegmüller, Wolfgang",
  title      = "The Structure and Dynamics of Theories",
  publisher  = "Springer",
  location   = "New-York Heidelberg Berlin",
  year       = "1976",
  edition    = "2",
}
\end{filecontents*}

\documentclass{article}

\directlua {
  fonts.handlers.otf.addfeature {
    name = "supkern",
    type = "kern",
    data = {
      ["¹"] = { ["."] =  -180,
                [","] =  -180 },
      ["²"] = { ["."] =  -180,
                [","] =  -180 },
      ["³"] = { ["."] =  -180,
                [","] =  -180 },
      ["⁴"] = { ["."] =  -180,
                [","] =  -180 },
    },
  }
}

\usepackage{realscripts}
\usepackage[english]{babel}
\usepackage[babel]{csquotes}
\babelfont[english]{rm}[Ligatures=TeX,Language=Default,Numbers={Proportional,OldStyle},RawFeature=+supkern]{Source Serif Pro}

\ExplSyntaxOn
\cs_new_protected:Nn \__realscripts_numtosup:n
  {
    \str_set:Nn \l_tmpa_str {#1}
    \str_map_inline:Nn \l_tmpa_str
      {
        \str_if_in:nnTF {0123456789} {##1}
          {
            \int_set:Nn \l_tmpa_int {##1}
            \if_case:w \l_tmpa_int ⁰
              \or: ¹
              \or: ²
              \or: ³
              \or: ⁴
              \or: ⁵
              \or: ⁶
              \or: ⁷
              \or: ⁸
              \or: ⁹
            \fi:
          }
          { { \addfontfeature {VerticalPosition=Superior} ##1 } }
      }
  }
\cs_generate_variant:Nn \__realscripts_numtosup:n { x }
\DeclareDocumentCommand \realsuperscript { m }
  {
    \fontspec_if_fontspec_font:TF
      {
        \fontspec_if_opentype:TF
          {
            \fontspec_if_feature:nTF { +sups }
              { \__realscripts_numtosup:x {#1} }
              { \fakesuperscript {#1} }
          }
          {
            \fontspec_if_aat_feature:nnTF {10} {1}
              { \__realscripts_numtosup:x {#1} }
              { \fakesuperscript {#1} }
          }
      }
      { \fakesuperscript {#1} }
  }
\ExplSyntaxOff

\usepackage{endnotes}
\usepackage{etoolbox}
\preto{\theendnotes}{%
  \renewcommand{\makeenmark}{\textsuperscript{\theenmark}\enspace}%
}
\makeatletter
\def\@makeenmark{\unpenalty{\footnotemarkfont\textsuperscript{\@theenmark}}}
\makeatother
\let\footnote\endnote

\usepackage[style=philosophy-verbose, scauthors=all, lowscauthors=true,
  giveninits, classical=true, volnumformat=strings, volumeformat=romansc,
  sorting=nyt, commacit=true, citepages=omit, editionformat=superscript,
  indexing]{biblatex}
\addbibresource{\jobname.bib}
\nocite{*}

\begin{document}

A\footnote{Footnote text}.

A\footnote{Footnote text},

A\footnote{Footnote text};

A\footcite[53]{stegmuller:1976}.

\theendnotes

\printbibliography
\end{document}

1) first compilation with lualates works fine

2) bibliography compilation with biber works fine

3) new final compilation with lualates produces this error:

! Illegal parameter number in definition of \l__exp_internal_tl.
<to be read again> 
1
l.17 {footcite}{}{53}{stegmuller:1976}{}}}

? 

I realized that the error comes from edition = "2",in the bibliographical record. That is the very reason for the compilation stops!

3

Fortunately, it's straight forward to modify things from my previous answers here and here to work with end notes.

Note that your last update with the example of the edition field in the bibliography entry reveals a weakness in my code. It assumes that the argument to \textsuperscript is fully expandable, but this is not necessarily the case (and isn't the case for \mkbibsuperscript which is used by biblatex-philosophy to format the edition). I've worked around this in the MWE below, but you will run into other problems.

\documentclass{article}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
  @book{ stegmuller:1976,
  author     = "Stegmüller, Wolfgang",
  title      = "The Structure and Dynamics of Theories",
  publisher  = "Springer",
  location   = "New-York Heidelberg Berlin",
  year       = "1976",
  edition    = "2",
}
\end{filecontents}

\directlua {
  fonts.handlers.otf.addfeature {
    name = "supkern",
    type = "kern",
    data = {
      ["¹"] = { ["."] =  -180,
                [","] =  -180 },
      ["²"] = { ["."] =  -180,
                [","] =  -180 },
      ["³"] = { ["."] =  -180,
                [","] =  -180 },
      ["⁴"] = { ["."] =  -180,
                [","] =  -180 },
    },
  }
}

\usepackage{realscripts}
\usepackage[english]{babel}
\usepackage[babel]{csquotes}
\babelfont[english]{rm}[Ligatures=TeX,Language=Default,Numbers={Proportional,OldStyle},RawFeature=+supkern]{Source Serif Pro}

\ExplSyntaxOn
\cs_new_protected:Nn \__realscripts_numtosup:n
  {
    \str_set:Nn \l_tmpa_str {#1}
    \str_map_inline:Nn \l_tmpa_str
      {
        \str_if_in:nnTF {0123456789} {##1}
          {
            \int_set:Nn \l_tmpa_int {##1}
            \if_case:w \l_tmpa_int ⁰
              \or: ¹
              \or: ²
              \or: ³
              \or: ⁴
              \or: ⁵
              \or: ⁶
              \or: ⁷
              \or: ⁸
              \or: ⁹
            \fi:
          }
          { { \addfontfeature {VerticalPosition=Superior} ##1 } }
      }
  }
\cs_generate_variant:Nn \__realscripts_numtosup:n { x }
\DeclareDocumentCommand \realsuperscript { m }
  {
    \fontspec_if_fontspec_font:TF
      {
        \fontspec_if_opentype:TF
          {
            \fontspec_if_feature:nTF { +sups }
            { \__realscripts_numtosup:x {#1} }
              { \fakesuperscript {#1} }
          }
          {
            \fontspec_if_aat_feature:nnTF {10} {1}
              { \__realscripts_numtosup:x {#1} }
              { \fakesuperscript {#1} }
          }
      }
      { \fakesuperscript {#1} }
  }
\ExplSyntaxOff

\usepackage{endnotes}
\usepackage{etoolbox}
\preto{\theendnotes}{%
  \renewcommand{\makeenmark}{\textsuperscript{\theenmark}\enspace}%
}
\makeatletter
\def\@makeenmark{\unpenalty{\footnotemarkfont\textsuperscript{\@theenmark}}}
\makeatother
\let\footnote\endnote

\usepackage[style=philosophy-verbose, scauthors=all, lowscauthors=true,
  giveninits, classical=true, volnumformat=strings, volumeformat=romansc,
  sorting=nyt, commacit=true, citepages=omit, editionformat=superscript,
  indexing]{biblatex}
\addbibresource{\jobname.bib}
\nocite{*}

\makeatletter
\DeclareFieldFormat{edition}{%
  \ifinteger{#1}{%
    \ifdefstring{\bbx@editionformat}{arabic}
    {\mkbibordedition{#1}~\bibstring{edition}}
    {\ifdefstring{\bbx@editionformat}{Roman}%
      {\RN{#1}~\bibstring{edition}}%
      {\ifdefstring{\bbx@editionformat}{romansc}%
        {\textsc{\Rn{#1}}~\bibstring{edition}}%
        {\ifdefstring{\bbx@editionformat}{roman}%
          {\Rn{#1}~\bibstring{edition}}
          {\ifdefstring{\bbx@editionformat}{superscript}%
            {\textsuperscript{#1}}%
            {\optionerror{editionformat}}}}}}}{#1}}%\isdot??
\makeatother

\begin{document}

A\footnote{Footnote text}.

A\footnote{Footnote text},

A\footnote{Footnote text};

A\footcite[53]{stegmuller:1976}.

\theendnotes

\printbibliography
\end{document}

output

  • Thanx a lot!! I add an update for a more complex situation – user41063 Apr 9 at 18:14
  • @user41063, it works fine with biblatex. Your MWE has some errors in it and you haven't included the custom kerning between super scripts and punctuation which is not present in Source Serif Pro. I'll update my answer to show that it works. – David Purton Apr 10 at 1:24
  • Yes, you're right. For a copy/paste error the original code didn't work. I made some trial, your code works fine. But in the original text I'm working around I've a (for me) incomprehensible. I added a LAST UPDATE with that code. Thank you again – user41063 Apr 10 at 17:26
  • @user41063 one error is that you should not have jobname.bib after \end{filecontents}. – David Purton Apr 10 at 21:54
  • 1
    @user41063. That's the only error. BTW, typically we use \jobname.bib, rather than jobname.bib. This makes the temporary bib file have the same name as the tex file. – David Purton Apr 11 at 0:38

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.