美文网首页
latex定制标题样式

latex定制标题样式

作者: 真人找个 | 来源:发表于2019-02-02 19:54 被阅读0次
主要说明下标题格式的设置方式,包括字体、字号、段前后间距、标题标签等

用\CTEXsetup命令

如下:


\CTEXsetup[name={第,章 },format={\centering\heitiB\zihao{3}},aftername={\enspace},beforeskip={24bp},afterskip={18bp}]{section}  %name选项中不要使用中文逗号

\CTEXsetup[format={\raggedright\heiti\zihao{-3}},aftername={\enspace},beforeskip={24bp},afterskip={6bp}]{subsection}

\CTEXsetup[format={\raggedright\heiti\zihao{4}},aftername={\enspace},beforeskip={12bp},afterskip={6bp}]{subsubsection}

存在的还未解决的问题有三点:

  • 字体命令对标签中的数字编号不起作用

  • 生成的目录格式没有按上面设置的标题格式展示

  • 低一级标题紧接高一级标题时,两级标题之间的间距以高级标题的段后间距为准,而不是以段前间距和段后间距的最大值为准

修改底层命令(姑且这么说)

如下:


\makeatletter  %可行

\renewcommand\section{\@startsection{section}{1}{\z@}%

{24bp\@plus 1ex \@minus .2ex}%

{18bp \@plus .2ex}%

{\heitiB\centering\zihao{3}}}

\renewcommand\subsection{\@startsection{subsection}{2}{\z@}%

{24bp\@plus 1ex \@minus .2ex}%

{6bp \@plus .2ex}%

{\heiti\zihao{-3}}}

\renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}

{12bp\@plus 1ex \@minus .2ex}%

{6bp \@plus .2ex}%

{\heiti\zihao{4}}}

\makeatother

\renewcommand{\thesection}{第\arabic{section}章}

\renewcommand{\thesubsection}{\arabic{section}.\arabic{subsection}}

\renewcommand{\thesubsubsection}{\arabic{section}.\arabic{subsection}.\arabic{subsubsection}}

第二中方式的三个\renewcommand可以使目录中的标题展示为我们想要的样式。

但仍存在两个问题:

  • 字体命令仍不能对数字编号起作用

  • \makeatletter...\makeatother这种用法不熟悉,而且其中符号\z@的含义还不清楚

最后给出代码供大家调试


\documentclass{ctexart}

%可行

%\CTEXsetup[name={第,章 },format={\centering\heiti\zihao{3}},aftername={\enspace},beforeskip={24bp},afterskip={18bp}]{section}  %name选项中不要使用中文逗号

%\CTEXsetup[format={\raggedright\heiti\zihao{-3}},aftername={\enspace},beforeskip={24bp},afterskip={6bp}]{subsection}

%\CTEXsetup[format={\raggedright\heiti\zihao{4}},aftername={\enspace},beforeskip={12bp},afterskip={6bp}]{subsubsection}



\makeatletter  %可行

\renewcommand\section{\@startsection{section}{1}{\z@}%

{24bp\@plus 1ex \@minus .2ex}%

{18bp \@plus .2ex}%

{\heiti\centering\zihao{3}}}

\renewcommand\subsection{\@startsection{subsection}{2}{\z@}%

{24bp\@plus 1ex \@minus .2ex}%

{6bp \@plus .2ex}%

{\heiti\zihao{-3}}}

\renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}

{12bp\@plus 1ex \@minus .2ex}%

{6bp \@plus .2ex}%

{\heiti\zihao{4}}}

\makeatother

\renewcommand{\thesection}{第\arabic{section}章}

\renewcommand{\thesubsection}{\arabic{section}.\arabic{subsection}}

\renewcommand{\thesubsubsection}{\arabic{section}.\arabic{subsection}.\arabic{subsubsection}}



\begin{document}

    \tableofcontents

    \section{咚咚咚}

    \subsection{咚咚咚咚咚}

    咚咚咚咚咚咚咚咚咚咚咚咚咚咚咚咚咚咚咚咚\\咚咚咚咚咚咚咚咚咚咚咚咚咚咚咚咚咚咚咚咚

    \subsubsection{咚咚咚咚咚咚咚}

    咚咚咚咚咚咚咚咚咚咚咚咚咚咚咚咚咚咚咚咚\\咚咚咚咚咚咚咚咚咚咚咚咚咚咚咚咚咚咚咚咚

    \section{锵锵锵}

    \subsection{锵锵锵锵锵}

    \subsubsection{锵锵锵锵锵锵锵}

\end{document}

相关文章

  • latex定制标题样式

    主要说明下标题格式的设置方式,包括字体、字号、段前后间距、标题标签等 用\CTEXsetup命令 如下: 存在的还...

  • LaTeX目录定制——titlecontents

    完全部分转自LaTeX目录定制\titlecontents{标题名}[左间距]{标题格式}{标题标志}{无序号标题...

  • R2 | #30天专注橙长计划#~SAS~Day 27

    5.7定制标题和注脚 通过在在ti tle和footnote语句中插入一个简单的选项,可以改变注脚和标题的样式,t...

  • LaTeX修改参考文献样式

    前言 使用LaTeX写学位论文中,会有各种不同的参考文献样式。 关于LaTeX使用参考文献的基础知识,可以参考已写...

  • Markdown语法参考

    https://www.zybuluo.com/mdeditor#fn:latex 一级标题 二级标题 五级标题 ...

  • LaTeX 学习网站

    Typesetters 该网站提供少量的免费LaTeX模板资源,可以付费定制需要的模板。 Overleaf 在线...

  • LaTeX学习资源网站2019-09-28

    Typesetters 该网站提供少量的免费LaTeX模板资源,可以付费定制需要的模板。 Overleaf 在线...

  • LaTeX参考文献样式——bibliographystyle

    完全转自Latex\bibliographystyleLaTeX 参考文献标准选项及其样式共有以下8种:plain...

  • 显示隐藏样式

    在【开始】—【样式】功能区,在样式库中默认只显示16钟内置样式。如果要给三级标题设置【标题3】样式,给四级标题设置...

  • Markdown 语法

    ---- 标题 ”#“ 号 代表标题样式 总共分六级标题 "#" 越多字体样式越小 我是标题 我是标题 我是...

网友评论

      本文标题:latex定制标题样式

      本文链接:https://www.haomeiwen.com/subject/onqesqtx.html