![更改附录格式的问题](https://linux22.com/image/387481/%E6%9B%B4%E6%94%B9%E9%99%84%E5%BD%95%E6%A0%BC%E5%BC%8F%E7%9A%84%E9%97%AE%E9%A2%98.png)
我相信关于这个主题的许多问题已经得到解答。然而,我尝试了所有方法,但没有一个对我有用。也许有人能帮我找到这个问题。
我使用附录包尝试了这个解决方案:https://stackoverflow.com/questions/5690679/add-appendix-before-a-in-thesis-toc 但它不起作用,编译时它会挂起。下面您可以看到我的代码和我正在使用的所有包。也许其中一些有冲突。
%% document class
\documentclass[a4paper]{book}
\usepackage[table]{xcolor}
\usepackage[spanish,es-tabla]{babel}
\usepackage{ragged2e}
\usepackage[numbers]{natbib}
\usepackage{hyperref}
\usepackage{amssymb}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{longtable}
\usepackage{enumerate} % needed for some options in enumerate
\usepackage{makeidx} % needed for creating an index
\usepackage{blindtext}
\usepackage{amsmath}
\usepackage{bigstrut}
\usepackage{upgreek}
\usepackage{listings}
\usepackage{color}
\usepackage{graphicx}
\usepackage{array}
\usepackage{tikz}
\usepackage[nottoc]{tocbibind}
\usepackage{fancyhdr}
\usepackage{titlesec}
\usepackage{pdfpages}
\usepackage{pdflscape}
\usepackage{titletoc}
\usepackage{appendix}
\titleformat*{\section}{\LARGE\bfseries}
\titleformat*{\subsection}{\Large\bfseries}
\titleformat*{\subsubsection}{\large\bfseries}
\titleformat*{\paragraph}{\large\bfseries}
\titleformat*{\subparagraph}{\large\bfseries}
\hypersetup{%
colorlinks=true,
citecolor=black,
linkcolor=black,
urlcolor=black}
\addto\captionsspanish{% Replace "english" with the language you use
\renewcommand{\contentsname}%
{Contenido}%
}
\newcommand\myhline{\noalign{\global\arrayrulewidth=1pt}\arrayrulecolor{white}\hline}
\arrayrulecolor{gray!80}
%% page settings
\input{settings/page}
%% own commands
\newcommand{\imp}[1]{\underline{\textit{#1}}}
\newcommand{\q}[1]{``#1''}
\input{settings/macros}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
My document, table of content, Chapters, Sections, etc
\bibliographystyle{ieeetran}
\bibliography{literature/library}
\begin{appendix}
\chapter{Just an example appendix}
\label{app_ex1}
\section{Section of appendix A}
\end{appendix}
\end{document}
答案1
\documentclass{book}
\usepackage[table]{xcolor}
\usepackage[spanish,es-tabla]{babel}
\usepackage[titletoc]{appendix}
\usepackage{ragged2e}
\usepackage[numbers]{natbib}
\usepackage{amssymb}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{longtable}
\usepackage{enumerate} % needed for some options in enumerate
\usepackage{makeidx} % needed for creating an index
\usepackage{blindtext}
\usepackage{amsmath}
\usepackage{bigstrut}
\usepackage{upgreek}
\usepackage{listings}
\usepackage{color}
\usepackage{graphicx}
\usepackage{array}
\usepackage{tikz}
\usepackage[nottoc]{tocbibind}
\usepackage{fancyhdr}
\usepackage{titlesec}
\usepackage{pdfpages}
\usepackage{pdflscape}
\usepackage{titletoc}
%\titleformat*{\chapter}{\LARGE\bfseries}
\titleformat*{\section}{\LARGE\bfseries}
\titleformat*{\subsection}{\Large\bfseries}
\titleformat*{\subsubsection}{\large\bfseries}
\titleformat*{\paragraph}{\large\bfseries}
\titleformat*{\subparagraph}{\large\bfseries}
\addto\captionsspanish{% Replace "english" with the language you use
\renewcommand{\contentsname}%
{Contenido}%
}
\newcommand\myhline{\noalign{\global\arrayrulewidth=1pt}\arrayrulecolor{white}\hline}
\arrayrulecolor{gray!80}
%% page settings
%\input{settings/page}
\usepackage{bookmark}
\hypersetup{% colorlinks=true, citecolor=green, linkcolor=red,
urlcolor=pink}
%% own commands
\newcommand{\imp}[1]{\underline{\textit{#1}}}
\newcommand{\q}[1]{``#1''}
%\input{settings/macros}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\tableofcontents
\newpage
My document, table of content, Chapters, Sections, etc
\chapter{sadfs}
asdfds
\bibliographystyle{ieeetran}
\bibliography{literature/library}
\begin{appendices}
\chapter{Just an example appendix}
\label{app_ex1}
\section{Section of appendix A}
\end{appendices}
\end{document}
使用\usepackage[titletoc]{appendix}
然后使用appendices
环境就会产生结果。
希望这能有所帮助