我使用pdflatex
withlibertine
作为我的主要字体。对于我的页面、章节、图表和表格(仅这些)的编号,我想使用旧式数字。关于如何实现此结果,有什么建议吗?
以下是 MWE:
\documentclass[
a4paper,
final,
12pt,
numbers=noendperiod,
BCOR=5.00mm,
bibliography=totoc,
listof=totoc,
headinclude
]{scrreprt}
\usepackage{libertine}
\usepackage[scaled=.83]{beramono}
\usepackage[libertine]{newtxmath}
\usepackage{blindtext}
\begin{document}
\blinddocument
\end{document}
编辑:下面的 tohecz 提供的解决方案有效,但是一旦hyperref
包含包就会显示冲突。
工作示例hyperref
:
\documentclass[
a4paper,
final,
12pt,
numbers=noendperiod,
BCOR=5.00mm,
bibliography=totoc,
listof=totoc,
headinclude
]{scrreprt}
\usepackage{libertine}
\usepackage[scaled=.83]{beramono}
\usepackage[libertine]{newtxmath}
\usepackage{blindtext}
\usepackage{hyperref}
\begin{document}
\blinddocument
\end{document}
不再适用于hyperref
:
\documentclass[
a4paper,
final,
12pt,
numbers=noendperiod,
BCOR=5.00mm,
bibliography=totoc,
listof=totoc,
headinclude
]{scrreprt}
\usepackage{libertine}
\usepackage[scaled=.83]{beramono}
\usepackage[libertine]{newtxmath}
\usepackage{blindtext}
\usepackage{hyperref}
\makeatletter
\renewcommand*\@arabic[1]{\oldstylenums{\number#1}}
\newcommand*\@Arabic[1]{\number#1}
\newcommand*\Arabic[1]{\expandafter\@newarabic\csname c@#1\endcsname}
\makeatother
\begin{document}
\blinddocument
\end{document}
答案1
您想更改数学模式下的数字:
\documentclass[
a4paper,
final,
12pt,
numbers=noendperiod,
BCOR=5.00mm,
bibliography=totoc,
listof=totoc,
headinclude
]{scrreprt}
\usepackage[oldstyle]{libertine}
\usepackage[scaled=.83]{beramono}
\usepackage[libertine]{newtxmath}
\usepackage{hyperref}
\DeclareSymbolFont{liningdigits}{\encodingdefault}{LinuxLibertineT-TLF}{m}{n}
\SetSymbolFont{liningdigits}{bold}{\encodingdefault}{LinuxLibertineT-TLF}{b}{n}
\DeclareMathSymbol{0}{\mathalpha}{liningdigits}{`0}
\DeclareMathSymbol{1}{\mathalpha}{liningdigits}{`1}
\DeclareMathSymbol{2}{\mathalpha}{liningdigits}{`2}
\DeclareMathSymbol{3}{\mathalpha}{liningdigits}{`3}
\DeclareMathSymbol{4}{\mathalpha}{liningdigits}{`4}
\DeclareMathSymbol{5}{\mathalpha}{liningdigits}{`5}
\DeclareMathSymbol{6}{\mathalpha}{liningdigits}{`6}
\DeclareMathSymbol{7}{\mathalpha}{liningdigits}{`7}
\DeclareMathSymbol{8}{\mathalpha}{liningdigits}{`8}
\DeclareMathSymbol{9}{\mathalpha}{liningdigits}{`9}
\begin{document}
Example\label{x}
\begin{enumerate}
\item math: $123$
\item text: 123
\item ref: \pageref{x}
\end{enumerate}
\end{document}
答案2
您可以通过重新定义内部宏将所有使用阿拉伯数字的计数器更改为旧式阿拉伯数字\@arabic
。此外,我提供了\Arabic
标准阿拉伯数字,因此,例如,如果您想enumerate
使用标准数字,您可以执行\renewcommand*\theenumi{\Arabic{enumi}}
。
page
但是,计数器和存在一些问题hyperref
。我解决这个问题的方法是,我们保持hyperref
其不变\thepage
,并在页脚中使用 new \Thepage
。这并不能解决页面引用将采用标准阿拉伯语而不是旧式阿拉伯语的问题,但这实在是太多了。(也许有一种简单的方法可以做到这一点?)
\documentclass[
a4paper,
final,
12pt,
numbers=noendperiod,
BCOR=5.00mm,
bibliography=totoc,
listof=totoc,
headinclude
]{scrreprt}
\usepackage{libertine}
\usepackage[scaled=.83]{beramono}
\usepackage[libertine]{newtxmath}
\makeatletter
% redefine arabic numbering to use \oldstylenums
\renewcommand*\@arabic[1]{\oldstylenums{\number#1}}
% keep old arabic as Arabic
\newcommand*\@Arabic[1]{\number#1}
\newcommand*\Arabic[1]{\expandafter\@Arabic\csname c@#1\endcsname}
% redefine \pagenumbering so that it affects both \thepage and \Thepage
\renewcommand\pagenumbering[1]{%
\global\c@page\@ne
\expandafter\ifx\csname @#1\endcsname\@arabic % if the desired numbering is arabic
\gdef\thepage{\csname @Arabic\endcsname\c@page}% \thepage in standard arabic
\gdef\Thepage{\csname @arabic\endcsname\c@page}% \Thepage in oldstylenums
\else
\gdef\thepage{\csname @#1\endcsname\c@page}% otherwise do whatever is requested
\gdef\Thepage{\csname @#1\endcsname\c@page}% and also define \Thepage to be used in header or footer
\fi
}
% ensure that the correct thing will happen
\pagenumbering{arabic}
\makeatother
% modify the header-footer to use \Thepage rather than \thepage
% use your prefered way of modifying the headers
\usepackage{fancyhdr}
\fancyhf{}
\fancyfoot[C]{\Thepage}
\pagestyle{fancy}
\usepackage{hyperref}
\usepackage{blindtext}
\begin{document}
\blinddocument
\end{document}