book第一章有附录,结果后续章节都是附录的样式,怎么改过来?

发布于 2021-10-12 20:23:05

请教大家个关键图书每个章节附录的问题Book_Appendix.rar
,小例子已经上传到群文件:Book_Appendix.rar
由于第1章有附录,结果后续章节都是附录的形式,见下面的截图,而且我希望目录中的附录是"附录2.1、附录2.2等“。感谢大家!

查看更多

关注者
0
被浏览
1.9k
啸行
啸行 2021-10-12
这家伙很懒,什么也没写!

chp03.tex 开始处加了一句 \renewcommand{\thesection}{\thechapter.\arabic{section}}
image.png

4 个回答
:
2021-10-12
这家伙很懒,什么也没写!

可以使用

\usepackage{appendix}
\renewcommand{\setthesection}{附录\thechapter.\arabic{section}}
\renewcommand{\setthesubsection}{附录\thesection.\arab{subsection}}

替代

\renewcommand\appendix{\par
\setcounter{section}{0}
\setcounter{subsection}{0}
\gdef\thesection{附录 \Alph{section}}}

然后把chp03.texchp02.tex中的appendix改成subappendices,还有注释掉\appendix,他会给后面的全部变成附录内容,然后编译就行了,我这里的结果是这样的
aa.png

如果您有什么不同意见,您是对的,我是错的。
这家伙很懒,什么也没写!
  1. ch03.tex 开头加上 \appendix
  2. \appendix 改为
\renewcommand\appendix{\par
    \setcounter{section}{0}
    \setcounter{subsection}{0}
    \gdef\thesection{附录 \Alph{section}}
    \ctexset{
        section/tocline = 附录 \thechapter.\arabic{##1} ##2
    }%
    }
LaTeXStudio
LaTeXStudio 2021-10-12
这家伙很懒,什么也没写!

这样的用法就比较奇怪了,最好使用 appendix 宏包来实现,看看这里:https://tex.stackexchange.com/questions/120716/appendix-after-each-chapter

\documentclass{book}
\usepackage{appendix}
\usepackage{chngcntr}
\usepackage{etoolbox}
\usepackage{lipsum}

\AtBeginEnvironment{subappendices}{%
\chapter*{Appendix}
\addcontentsline{toc}{chapter}{Appendices}
\counterwithin{figure}{section}
\counterwithin{table}{section}
}

\begin{document}

\tableofcontents
\chapter{Test Chapter One}
\section{A regular section}
\section{Another regular section}
\begin{subappendices}
\section{Some title for an appendix}
\lipsum[4]
\section{Some title for an appendix}
\lipsum[4]
\end{subappendices}
\chapter{Test Chapter Two}
\section{A regular section}
\section{Another regular section}
\begin{subappendices}
\section{Some title for an appendix}
\lipsum[4]
\section{Some title for an appendix}
\lipsum[4]
\section{Some title for an appendix}
\lipsum[4]
\end{subappendices}

\end{document}

image.png

撰写答案

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

发布
问题

分享
好友

手机
浏览

扫码手机浏览