使 cfr-lm 和 titlesec 协同工作

使 cfr-lm 和 titlesec 协同工作

在下面的最小示例中,我想使用 cfr-lm 包使所有数字变为 oldstylenums,但在标题中使用粗体和小写字母。

我使用 pdflatex 和 TexMaker 作为前端。

\documentclass[12pt,a4paper]{article}
\usepackage[
    left = 2cm, 
    right = 2.5cm, 
    top = 1.5cm, 
    bottom = 2cm
]{geometry}
\usepackage[T1]{fontenc}
\usepackage{cfr-lm}
\usepackage{microtype}
\usepackage{titlesec}
\usepackage{fancyhdr}


%\titleformat{\section}{\Large\sc\bfseries}{}{0cm}{}[\titlerule]
%\titleformat{\subsection}[runin]{\bfseries\sc}{}{0cm}{}[ --]
%\titleformat{\subsubsection}{\large\bfseries\sc}{}{0cm}{}


%\renewcommand{\labelitemi}{--}
%\newcommand{\tabitem}{\makebox[0pt][r]{--}}


\titleformat{\chapter}[display]
{\huge\scshape\bfseries}{{\chaptertitlename}~{\thechapter}}{10pt}{\Huge}
\titleformat{\section}{\Large\scshape\bfseries}{\thesection}{0.5cm}{}[\titlerule]
\titleformat{\subsection}{\large\bfseries\scshape}{\thesubsection}{0.5cm}{}
\titleformat{\subsubsection}{\bfseries\scshape}{}{0cm}{}[]


%Manipulation of headers and footers
\pagestyle{fancy}
%Clear fields
\fancyhf{}
%Page numbering in footer
\fancyfoot[C]{\thepage}
%Separation line header and footer
\renewcommand{\footrulewidth}{0.4pt}
\renewcommand{\headrulewidth}{0pt}  

\begin{document}
\thispagestyle{fancy}

\begin{center}
\Huge \textbf{\textsc{Eating\hspace{0.5cm}Foods}}
\end{center}

\section{How to eat food}
Food is important
\subsection{Using hands}
Most versatile. I have 2 hands.
\subsection{Using chopsticks}
Requires practice. I have 54 chopsticks.
\subsection{Using spoons}
Kind of a middle ground. Around 55 spoons were kept in 14 boxes.
\subsubsection{Types of spoons}
There are many types of spoons. I have 4 types of spoons

\end{document}

我发现当我注释掉 cfr-lm 包时,我得到了正确格式的标题,但失去了花哨的数字格式。如何让这两个一起工作?

相关内容