5 目录一级标题需要显示为中文的“一、二、三”开头。

发布于 2021-06-06 16:32:24

问题

正文中的标题是一级标题已经是一、二、三开头的了,但目录中还是阿拉伯数字开头。不知道如何调整。
使用的宏包:
titlesec
titletoc

标题需要显示的目录格式如下:

image.png

实际显示的目录格式:
image.png

image.png

标题测试代码:

%设置标题格式
RequirePackage{titlesec}
titleformat{section}%设置section的样式
{centeringheitizihao{4}bfseries}%居中,4号字,加粗
{{chinese{section}、}}%标号后面有个点
{0.5em}%sep label和title之间的水平距离
{}%标题前没有内容

titleformat{subsection}%设置section的样式
{heitizihao{-4}bfseries}%右对齐,小4号字,加粗
{arabic{section}thinspace.thinspacearabic{subsection}}%标号后面有个点
{0.5em}%sep label和title之间的水平距离
{}%标题前没有内容

titleformat{subsubsection}%设置section的样式
{songtizihao{-4}bfseries}%右对齐,4号字,加粗
{thesubsectionthinspace.thinspacearabic{subsubsection}}%标号后面有个点
{0.5em}%sep label和title之间的水平距离
{}%标题前没有内容

%设置目录格式
% 节的目录格式
titlecontents{section}[0pt]{vspace{2mm}bfseries}
{thecontentslabelhskip.5em}{}{titlerule*[0.5pc]{.}contentspage}
% 小节的目录格式
titlecontents{subsection}[30pt]{songti}
{thecontentslabelhskip.5em}{}{titlerule*[0.5pc]{.}contentspage}
titlecontents{subsubsection}[55pt]{songti}
{thecontentslabelhskip.5em}{}{titlerule*[0.5pc]{.}contentspage}

查看更多

关注者
0
被浏览
2.2k
2 个回答
天空与大地
天空与大地 2021-06-06
这家伙很懒,什么也没写!

自问自答
这个不用宏包,却可行。
% 中文标题格式设置
% 目录深度
setcounter{secnumdepth}{3}
% 节标题格式, 居中, 使用chinese命令修改计数器
def@seccntformat#1{csname the#1endcsname }
renewcommandthesection{chinese{section}、}
renewcommandthesubsection{arabic{section}thinspace.thinspacearabic{subsection}}
renewcommandthesubsubsection{thesubsectionthinspace.thinspacearabic{subsubsection}}
renewcommandsection{@startsection{section}{1}{z@}%

{-3.5ex \@plus -1ex \@minus -.2ex}%
{2.3ex \@plus.2ex}%
{\centering\heiti\zihao{4}\bfseries}}

renewcommandsubsection{@startsection{subsection}{2}{z@}%

{-3.25ex\@plus -1ex \@minus -.2ex}%
{1.5ex \@plus .2ex}%
{\heiti\zihao{-4}\bfseries}}

renewcommandsubsubsection{@startsection{subsubsection}{3}{z@}%

{-3.25ex\@plus -1ex \@minus -.2ex}%
{1.5ex \@plus .2ex}%
{\songti\zihao{-4}\bfseries}}

renewcommandparagraph{@startsection{paragraph}{4}{z@}%

{3.25ex \@plus1ex \@minus.2ex}%
{-1em}%
{\normalfont\normalsize\bfseries}}

renewcommandsubparagraph{@startsection{subparagraph}{5}{parindent}%

{3.25ex \@plus1ex \@minus .2ex}%
{-1em}%
{\normalfont\normalsize\bfseries}}
如果您有什么不同意见,您是对的,我是错的。
这家伙很懒,什么也没写!

既然你用中文了,更推荐用 \ctexset 提供的接口,轻松简单

撰写答案

请登录后再发布答案,点击登录

发布
问题

分享
好友

手机
浏览

扫码手机浏览