
Estou interessado em adicionar um apêndice com duas ou três seções após cada capítulo de um livro, igual à pergunta respondidaaqui.
A resposta fornecida funciona bem, mas tem efeito indesejável na numeração de figuras, etc. Na book
aula, as figuras são numeradas de uma forma específica do capítulo (por exemplo, 1.1, 1.2,...,2.1, 2.2) que eu gosto, porém a resposta redefine isso para a numeração específica da seção em todos os capítulos após o novo subappendices
ambiente ser usado, o que produz uma numeração específica da seção estranha - 1.1, 1.2 (capítulo 1 bom), subapêndices, 2.1, 2.2 (figuras do capítulo 2 na primeira seção), 2.1, 2.2 (ch 2 figuras na segunda seção). Como redefinir a numeração para um capítulo específico?
Aqui está o MWE:
\documentclass{book}
\usepackage{appendix}
\usepackage{chngcntr}
\usepackage{etoolbox}
\usepackage{lipsum}
\usepackage{tikz}
\usepackage{float}
\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}
\begin{figure};
\begin{tikzpicture}; \draw (0,0) --(1,2);\end{tikzpicture}; \caption{some caption}
\end{figure}
\begin{figure};
\begin{tikzpicture}; \draw (0,0) --(1,2);\end{tikzpicture}; \caption{some caption}
\end{figure}
\section{Another regular section}
\begin{figure};
\begin{tikzpicture}; \draw (0,0) --(1,2);\end{tikzpicture}; \caption{some caption}
\end{figure}
\begin{figure};
\begin{tikzpicture}; \draw (0,0) --(1,2);\end{tikzpicture}; \caption{some caption}
\end{figure}
\begin{subappendices}
\section{Some title for an appendix}
\begin{figure};
\begin{tikzpicture}; \draw (0,0) --(1,2);\end{tikzpicture}; \caption{some caption}
\end{figure}
\begin{figure};
\begin{tikzpicture}; \draw (0,0) --(1,2);\end{tikzpicture}; \caption{some caption}
\end{figure}
\section{Some title for an appendix}
\lipsum[4]
\end{subappendices}
\chapter{Test Chapter Two}
\section{A regular section}
\begin{figure};
\begin{tikzpicture}; \draw (0,0) --(1,2);\end{tikzpicture}; \caption{some caption}
\end{figure}
\begin{figure};
\begin{tikzpicture}; \draw (0,0) --(1,2);\end{tikzpicture}; \caption{some caption}
\end{figure}
\section{Another regular section}
\begin{figure};
\begin{tikzpicture}; \draw (0,0) --(1,2);\end{tikzpicture}; \caption{some caption}
\end{figure}
\begin{figure};
\begin{tikzpicture}; \draw (0,0) --(1,2);\end{tikzpicture}; \caption{some caption}
\end{figure}
\end{document}
Responder1
O que funcionou bem foi definir o fim do subappendices
ambiente da seguinte forma
\AtEndEnvironment{subappendices}{%
\counterwithout{figure}{section}
\counterwithin{figure}{chapter}
\counterwithout{table}{section}
\counterwithin{table}{chapter}
}
O exemplo completo:
\documentclass{book}
\usepackage{appendix}
\usepackage{chngcntr}
\usepackage{etoolbox}
\usepackage{lipsum}
\usepackage{tikz}
\usepackage{float}
\AtBeginEnvironment{subappendices}{%
\chapter*{Appendix}
\addcontentsline{toc}{chapter}{Appendices}
\counterwithin{figure}{section}
\counterwithin{table}{section}
}
\AtEndEnvironment{subappendices}{%
\counterwithout{figure}{section}
\counterwithin{figure}{chapter}
\counterwithout{table}{section}
\counterwithin{table}{chapter}
}
\begin{document}
\tableofcontents
\chapter{Test Chapter One}
\section{A regular section}
\begin{figure};
\begin{tikzpicture}; \draw (0,0) --(1,2);\end{tikzpicture}; \caption{some caption}
\end{figure}
\begin{figure};
\begin{tikzpicture}; \draw (0,0) --(1,2);\end{tikzpicture}; \caption{some caption}
\end{figure}
\section{Another regular section}
\begin{figure};
\begin{tikzpicture}; \draw (0,0) --(1,2);\end{tikzpicture}; \caption{some caption}
\end{figure}
\begin{figure};
\begin{tikzpicture}; \draw (0,0) --(1,2);\end{tikzpicture}; \caption{some caption}
\end{figure}
\begin{subappendices}
\section{Some title for an appendix}
\begin{figure};
\begin{tikzpicture}; \draw (0,0) --(1,2);\end{tikzpicture}; \caption{some caption}
\end{figure}
\begin{figure};
\begin{tikzpicture}; \draw (0,0) --(1,2);\end{tikzpicture}; \caption{some caption}
\end{figure}
\section{Some title for an appendix}
\lipsum[4]
\end{subappendices}
\chapter{Test Chapter Two}
\section{A regular section}
\begin{figure};
\begin{tikzpicture}; \draw (0,0) --(1,2);\end{tikzpicture}; \caption{some caption}
\end{figure}
\begin{figure};
\begin{tikzpicture}; \draw (0,0) --(1,2);\end{tikzpicture}; \caption{some caption}
\end{figure}
\section{Another regular section}
\begin{figure};
\begin{tikzpicture}; \draw (0,0) --(1,2);\end{tikzpicture}; \caption{some caption}
\end{figure}
\begin{figure};
\begin{tikzpicture}; \draw (0,0) --(1,2);\end{tikzpicture}; \caption{some caption}
\end{figure}
\end{document}
Responder2
Mude essas duas linhas
\counterwithin{figure}{section}
\counterwithin{table}{section}
para
\counterwithin{figure}{chapter}
\counterwithin{table}{chapter}
ou deixe-os completamente de fora (é o padrão).