这是如何使用微类型通过 \fnsymbol 启用脚注的突出功能?,我的答案就在那里。
我在那里提供的 MWE
\documentclass[10pt]{article}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{etoolbox}
\usepackage{fixltx2e} %% <- this gives problems
\usepackage{geometry}
\geometry{a5paper,showframe}
\usepackage[colorlinks]{hyperref}
\usepackage[protrusion=alltext,factor=2000]{microtype}
\DeclareMicrotypeSet{alltextAndFootnotes}{%
encoding = {OT1,T1,T2A,LY1,OT4,QX,T5,TS1,EU1,EU2}, %% alltext
font = {OMS/lmsy/m/n/scriptsize},
}
\microtypesetup{protrusion=alltextAndFootnotes}
\SetProtrusion[context=footnote]{encoding=OMS, family=lmsy,series=m, shape=n, size=scriptsize}{%
"03={,650},%% *
"78={,650},%% \mathsection
"79={,650},%% \dagger
"7A={,650},%% \ddagger
"7B={,650},%% \mathparagraph
"6B={,650},%% \|
}
\SetProtrusion[context=footnote,load=lmr-T1,factor = 700]
{encoding=T1, family=lmr, series=m, shape=n, size=scriptsize}
{ }
\SetProtrusion[context=footnote,load=cmr-OT1,factor = 700]
{encoding=OT1, family=lmr, series=m, shape=n}
{ }
\makeatletter
\newcommand*\new@makefnmark{\hbox{\@textsuperscript{\normalfont
\microtypecontext{protrusion=footnote}\@thefnmark}}}
\patchcmd{\@footnotemark}
{\@makefnmark}
{\new@makefnmark}{}{}
\makeatother
\renewcommand{\thefootnote}{\fnsymbol{footnote}}
%% --------------------------------------------------------------
%% --------------------------------------------------------------
\begin{document}
Here's some text to show the behaviour of footnote marker at%
\footnote{A footnote}
the end of a line, which disappears when the code for setting microtypecontext is used in fnmark redefinition.
Here's some text to show the behaviour of footnote marker at%
\footnote{B}
the end of a line, which disappears when the code for setting microtypecontext is used in fnmark redefinition.
Here's some text to show the behaviour of footnote marker at%
\footnote{C}
the end of a line, which disappears when the code for setting microtypecontext is used in fnmark redefinition.
Here's some text to show the behaviour of footnote marker at%
\footnote{D}
the end of a line, which disappears when the code for setting microtypecontext is used in fnmark redefinition.
Here's some text to show the behaviour of footnote marker at%
\footnote{E}
the end of a line, which disappears when the code for setting microtypecontext is used in fnmark redefinition.
Here's some text to show the behaviour of footnote marker at%
\footnote{F}
the end of a line, which disappears when the code for setting microtypecontext is used in fnmark redefinition.
Here's some text to show the behaviour of footnote marker at%
\footnote{G}
the end of a line, which disappears when the code for setting microtypecontext is used in fnmark redefinition.
Here's some text to show the behaviour of footnote marker at%
\footnote{H}
the end of a line, which disappears when the code for setting microtypecontext is used in fnmark redefinition.
Here's some text to show the behaviour of footnote marker at%
\footnote{I}
the end of a line, which disappears when the code for setting microtypecontext is used in fnmark redefinition.
\end{document}
对我来说很好,直到我添加fixltx2e
包。
我知道这个包改变\@fnsymbol
了
\def\@fnsymbol#1{\ensuremath {\ifcase #1\or *\or \dagger \or \ddagger \or \mathsection \or \mathparagraph \or \|\or **\or \dagger \dagger \or \ddagger \ddagger \else \@ctrerr \fi }}
到
\def\@fnsymbol#1{\ifcase #1\or \TextOrMath \textasteriskcentered *\or \TextOrMath \textdagger \dagger \or \TextOrMath \textdaggerdbl \ddagger \or \TextOrMath \textsection \mathsection \or \TextOrMath \textparagraph \mathparagraph \or \TextOrMath \textbardbl \|\or \TextOrMath {\textasteriskcentered \textasteriskcentered }{**}\or \TextOrMath {\textdagger \textdagger }{\dagger \dagger }\or \TextOrMath {\textdaggerdbl \textdaggerdbl }{\ddagger \ddagger }\else \@ctrerr \fi }
这意味着现在\textsection
用作脚注符号,并且它是唯一不突出的符号:
我不明白 有什么特别之处\textsection
,例如,当\textparagraph
工作正常时。这种行为的原因是什么?我该如何解决?
答案1
该命令\textsection
很特殊,因为与其他命令不同,它也存在于T1
编码中(在 中声明t1enc.def
,由 加载fontenc
)。现在,当要求 latex 排版文本符号时,它将首先检查该符号是否在当前编码中声明,在本例中为T1
。有两种方法可以解决这个问题:
- 添加
\textsection
到T1
集合中:
\SetProtrusion[context=footnote]
{encoding=T1, family=lmr, series=m, shape=n, size=scriptsize}
{ \textsection={,650} }
- 或者,这看起来更干净的方法,取消声明
\textsection
中的命令T1
,以便使用来自的符号OMS
(在中声明omsenc.def
,由格式加载):
\UndeclareTextCommand{\textsection}{T1}
另一点说明:尽管fixltx2e
将脚注定义更改为使用文本符号而不是数学符号,但字形实际上仍然来自数学字体(OMS
)。要真正使用文本字体中的符号,您可能需要另外加载包,并声明而textcomp
不是 的突起设置。( 的问题必须以与上述相同的方式解决。)TS1/lmr
OMS/lmsy
\textsection
虽然这对 Latin 或 Computer Modern 没有任何影响,因为数学和文本字体中的符号相同,但对其他不附带数学字体的字体(例如 Times New Roman)则有影响。如果没有textcomp
,脚注符号将从 Computer Modern 中选择,这不是您想要的。
因此,总结一下,我建议执行以下操作:
\usepackage{textcomp}
\UndeclareTextCommand{\textsection}{T1}
\SetProtrusion[context=footnote]{font=TS1/*/m/n/scriptsize}{%
\textasteriskcentered={,650},
\textsection={,650},
\textdagger={,650},
\textdaggerdbl={,650},
\textparagraph={,650},
\textbardbl={,650},
}
\SetProtrusion[context=footnote] % dummy declaration
{font=T1/*/m/n/scriptsize}
{ }