尾注的字距调整数字

尾注的字距调整数字

在 LaTeX 中,字距管理在注释编号的情况下似乎不太有效。David Purton 在此线程中提供了一个出色的脚注解决方案:

脚注的内衬编号

现在,由于我必须制作一篇在文本末尾带有注释的文章,因此该解决方案不起作用。有没有办法将 David Purton 制作的代码重新适配到尾注?

我附上了基本尾注代码的 MWE,显然没有进行字距调整。

\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}

谢谢

附录

更复杂的测试,带有上标脚注数字,但用于参考书目:

\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}

\footcite 对上标数字有不同的处理方法吗?

最后更新

当我尝试编译该源代码时:

  \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)第一次使用 lualates 编译工作正常

2)使用 biber 编写书目很方便

3)使用 lualates 进行新的最终编译会产生此错误:

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

? 

我意识到错误来自edition = "2",于书目记录。这就是编纂停止的原因!

答案1

幸运的是,可以直接修改我以前的答案这里这里与尾注一起使用。

笔记edition您上次更新时使用书目条目中的字段示例揭示了我的代码中的弱点。它假设参数\textsuperscript是完全可扩展的,但情况并非如此(并且\mkbibsuperscript用于biblatex-philosophy格式化的情况并非如此edition)。我已经在下面的 MWE 中解决了这个问题,但您会遇到其他问题。

\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}

输出

相关内容