正文中为旧式数字,章节标题中为新式数字

正文中为旧式数字,章节标题中为新式数字

我正在使用该eco包来获取手稿中的旧式数字,但我试图将章节数字(在主要内容和目录中)变为“新式数字”(即衬线数字),但却遇到了困难。

有人可以解释一下此事吗?

附言:如果能在表格中添加线条数字,并且还能给数字编号就更好了。

编辑:在下面发布一个 mwe(关于 doncherry 的建议)。

\documentclass{book}

\usepackage{eco}

\setcounter{secnumdepth}{5}
\setcounter{tocdepth}{5}

\renewcommand{\thechapter}{{\fontfamily{cmr}\selectfont\arabic{chapter}}}
\renewcommand{\thesection}{{\fontfamily{cmr}\selectfont\arabic{section}}}
\renewcommand{\thesubsection}{{\fontfamily{cmr}\selectfont\arabic{subsection}}}
\renewcommand{\thesubsubsection}{{\fontfamily{cmr}\selectfont\arabic{subsubsection}}}
\renewcommand{\theparagraph}{{\fontfamily{cmr}\selectfont\arabic{paragraph}}}
\renewcommand{\thesubparagraph}{{\fontfamily{cmr}\selectfont\arabic{subparagraph}}}
\renewcommand{\thefigure}{{\fontfamily{cmr}\selectfont\arabic{figure}}}
\renewcommand{\thetable}{{\fontfamily{cmr}\selectfont\arabic{table}}}

\begin{document}

  \tableofcontents{}

  \part{One}
    \chapter{One--One}
      \section{One--One--One}
        \subsection{One--One--One--One}
          \subsubsection{One--One--One--One--One}
            \paragraph{One--One--One--One--One--One}
              \subparagraph{One--One--One--One--One--One--One}
              \subparagraph{One--One--One--One--One--One--Two}
              \subparagraph{One--One--One--One--One--One--Three}
            \paragraph{One--One--One--One--One--Two}
              \subparagraph{One--One--One--One--One--Two--One}
              \subparagraph{One--One--One--One--One--Two--Two}
              \subparagraph{One--One--One--One--One--Two--Three}

\end{document}

输出

答案1

cmr将相关计数器的字体改回 Computer Modern ( ),类似于eco\newstylenumbers{}操作:

\documentclass{article}

\usepackage{eco}
\usepackage[T1]{fontenc}

\renewcommand{\thesection}{\fontfamily{cmr}\selectfont\arabic{section}}

\renewcommand{\thefigure}{{\fontfamily{cmr}\selectfont\arabic{figure}}}

\renewcommand{\thetable}{{\fontfamily{cmr}\selectfont\arabic{table}}}

\begin{document}

% setting the counters to higher values just to see some more digits
\setcounter{page}{123}
\setcounter{figure}{455}
\setcounter{table}{788}

\tableofcontents

\listoffigures

\listoftables

\section{Section 9876543210}

\begin{figure}[bh]
123456789
\caption{123456789}
\end{figure}

\subsection{Subsection 9876543210}

\begin{table}[bh]
123456789
\caption{123456789}
\end{table}

\subsubsection{Subsubsection 9876543210}
\end{document}

页码仍为旧式数字,我无法更改它们,您也没有要求这样做。章节(等)标题和说明中的数字也仍为 osf。


编辑:

无需重新定义您使用的最高级别,更改的字体将在整个节级数字,你只需要去掉多余的{},它们组成一个组,限制了更改字体的范围。另外,注意到在你的例子中它们都只是一个数字,但应该像“1.1.1.1.1.1”?只需去掉除chapter(和tablefigure当然)之外的所有重新定义。此外,如果你输入一个实际的标题而不是一个未知的、笨拙的长词,如“One-One-One-One-One-One-One”,页码就不会被推到一边。用--空格替换破折号就足够了:

\documentclass{book}

\usepackage{eco}

\setcounter{secnumdepth}{5}
\setcounter{tocdepth}{5}

\renewcommand{\thechapter}{\fontfamily{cmr}\selectfont\arabic{chapter}}
%\renewcommand{\thesection}{{\fontfamily{cmr}\selectfont\arabic{section}}}
%\renewcommand{\thesubsection}{{\fontfamily{cmr}\selectfont\arabic{subsection}}}
%\renewcommand{\thesubsubsection}{{\fontfamily{cmr}\selectfont\arabic{subsubsection}}}
%\renewcommand{\theparagraph}{{\fontfamily{cmr}\selectfont\arabic{paragraph}}}
%\renewcommand{\thesubparagraph}{{\fontfamily{cmr}\selectfont\arabic{subparagraph}}}

\renewcommand{\thefigure}{{\fontfamily{cmr}\selectfont\arabic{figure}}}
\renewcommand{\thetable}{{\fontfamily{cmr}\selectfont\arabic{table}}}

\begin{document}

  \tableofcontents{}

  \part{One}
    \chapter{One One}
      \section{One One One}
        \subsection{One One One One}
          \subsubsection{One One One One One}
            \paragraph{One One One One One One}
              \subparagraph{One One One One One One One}
              \subparagraph{One One One One One One Two}
              \subparagraph{One One One One One One Three}
            \paragraph{One One One One One Two}
              \subparagraph{One One One One One Two One}
              \subparagraph{One One One One One Two Two}
              \subparagraph{One One One One One Two Three}

\end{document}

如果标题比这更长,它们将被分成几行,但您可能需要考虑使用目录的简短标题,然后使用\section[short title for ToC and header]{long title for the place in the paper where it actually appears}

相关内容