• LaTeX使用titlesec宏包改变章节编号形式的方法


    1.titleformat宏包命令详解

    LaTeX中可以用titlesec宏包中的titleformat命令来改变标题形式:

    导入宏包:

    \usepackage{titlesec}
    

    改变标题的代码如下:

    \titleformat{command}[shape]{format}{label}{sep}{before}[after]
    

    不要看晕了,改变章节号的形式,主要修改label参数

    各个参数含义如下:

    command 是要重新定义的各种标题命令,比如 \part,\chapter,\section,\s section,\s s section,\paragraph,\subparagraph等;

    shape 是用来设定段落形状的,可选的参数有hang、block、display等,详见 titlesec 文档;

    format 用于定义标题外观,比如使标题居中、字体加粗等;

    label 用于定义定义标题的标签,就是标题内容前面的标号;

    sep 定义标题的标签与标题内容之间的间隔距离;

    before 用于在标题内容前再加些内容;

    after 用于在标题内容后再加些内容。

    举个例子

    \titleformat{\chapter}{\centering\Huge\bfseries}{第\,\thechapter\,章}{1em}{}
    

    format参数将章标题设置为居中(\centering)显示、字号为 \Huge,字体被加粗显示\bfseries ; label 参数将标题的标签设置为 “第 xxx 章”格式;sep 参数设置标签与标题内容之间以一个字(1em)的宽度为间隔。

    以上设置的章标题效果如下图所示:

     

     

    2.修改编号的方法

    刚才我们已经知道,编号的样式可以由label参数修改。

    现在进一步讲,怎样把章节编号修改成下面那样:

    其他的编号形式如下:

    \arabic (1, 2, 3, ...)
    \alph (a, b, c, ...)
    \Alph (A, B, C, ...)
    \roman (i, ii, iii, ...)
    \Roman (I, II, III, ...)
    \fnsymbol (∗, †, ‡, §, ¶, ...)
    

    其实,默认的编号\thesubsection有点类似下面的代码:

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

    也就是说1.1这样的编号相当于把label修改成\arabic{section}.\arabic{subsection}

     如果我们要把标题的编号改成图中的形式,就可以这么写:

    \titleformat{\section}[block]{\LARGE\bfseries}{第 \arabic{section} 章}{1em}{}
    \titleformat{\subsection}[block]{\Large\bfseries}{ \Roman{subsection}}{1em}{}
    \titleformat{\subsubsection}[block]{\large\bfseries}{\Roman{subsection}-\alph{subsubsection}}{1em}{}
    \titleformat{\paragraph}[block]{\normalsize\bfseries}{[\arabic{paragraph}]}{1em}{}
    

    温馨提示,章节号从paragraph开始就没有记了

    可以用以下命令设置计数层次

    \setcounter{secnumdepth}{数字}
    

    比如想让paragraph计数,就设置为

    \setcounter{secnumdepth}{4}
    

    参考连接:

    如何改变章节序号:http://tex.stackexchange.com/questions/3177/how-to-change-the-numbering-of-part-chapter-section-to-alphabetical-r/3183#3183

    LaTex中titlesec宏包的使用:http://www.cnblogs.com/aoublog/p/4430313.html

    paragraph如何让标题后内容换行:http://bbs.ctex.org/forum.php?mod=viewthread&tid=48274

  • 相关阅读:
    Java的注释,标识符,标识符的命名规范
    Java入门程序(Java的开发流程)
    EasyMock使用总结
    【转载】 Java并发编程:深入剖析ThreadLocal
    java.util.Stack类中的peek()方法
    Jquery和Ajax
    关于HTTP协议及SOCKET通信
    (转载)session token机制
    TCP/IP知识总结(TCP/IP协议族读书笔记四)
    TCP/IP知识总结(TCP/IP协议族读书笔记三)
  • 原文地址:https://www.cnblogs.com/Arago/p/5974181.html
Copyright © 2020-2023  润新知