我在文件中使用舊式數字,但我更喜歡在行編號環境(lineno
的\linenumbers
環境)中使用襯裡數字。我如何強制執行此操作(無需更改為其他字體)?
\documentclass{article}
\usepackage{fontspec,lineno}
\setmainfont[Numbers=OldStyle]{Linux Libertine O}
\renewcommand\linenumberfont{\normalfont\scriptsize\rmfamily}
\begin{document}
\begin{linenumbers}
\noindent Continual delighted\linelabel{1stword} as elsewhere am convinced unfeeling. Introduced stimulated attachment no by projection. To loud lady whom my mile sold four. Need miss all four case fine age tell. He families my pleasant speaking it bringing\linelabel{2ndword} it thoughts. View busy dine oh in knew if even. Boy these along far own other equal old fanny charm. Difficulty invitation put introduced\linelabel{3rdword} see middletons nor preference.
\end{linenumbers}
\vspace{\baselineskip}
\noindent I like the words I find in line \lineref{1stword}, \lineref{2ndword}, and \lineref{3rdword}.
\end{document}
答案1
若要僅變更數字,請使用指令fontspec
(\addfontfeatures{Numbers={Lining, Monospaced}}
請參閱第 10.3 節)fontspec
手動的)。 (您可能甚至不需要指定Monospaced
,但指定它也沒有壞處。)\normalfont
而且\rmfamily
也沒有必要。
\documentclass{article}
\usepackage{fontspec,lineno}
\setmainfont[Numbers=OldStyle]{Linux Libertine O}
\renewcommand{\linenumberfont}{\scriptsize\addfontfeatures{Numbers={Lining, Monospaced}}}
\begin{document}
\begin{linenumbers}
\noindent Continual delighted\linelabel{1stword} as elsewhere am convinced unfeeling.
Introduced stimulated attachment no by projection. To loud lady whom my mile sold
four. Need miss all four case fine age tell. He families my pleasant speaking it
bringing\linelabel{2ndword} it thoughts. View busy dine oh in knew if even. Boy these
along far own other equal old fanny charm. Difficulty invitation put
introduced\linelabel{3rdword} see middletons nor preference.
\end{linenumbers}
\vspace{\baselineskip}
\noindent I like the words I find in line \lineref{1stword}, \lineref{2ndword}, and
\lineref{3rdword}.
\end{document}
答案2
對於 Type 1 字型 (pdflatex) 用戶,以下操作可行:
\documentclass{article}
\usepackage[osf]{libertine}
\usepackage[T1]{fontenc}
\usepackage{lineno}
\renewcommand\linenumberfont{\fontfamily{LinuxLibertineT-TLF}\scriptsize\selectfont}
\begin{document}
\begin{linenumbers}
\noindent Continual delighted\linelabel{1stword} as elsewhere am convinced unfeeling. Introduced stimulated attachment no by projection. To loud lady whom my mile sold four. Need miss all four case fine age tell. He families my pleasant speaking it bringing\linelabel{2ndword} it thoughts. View busy dine oh in knew if even. Boy these along far own other equal old fanny charm. Difficulty invitation put introduced\linelabel{3rdword} see middletons nor preference.
\end{linenumbers}
\vspace{\baselineskip}
\noindent I like the words I find in line \lineref{1stword}, \lineref{2ndword}, and \lineref{3rdword}.
\end{document}