在我的目录中,我希望显示“附录 A 回归结果”。但是我的代码给出以下输出:
我的代码如下
\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage[margin=1.25in]{geometry}
\usepackage{booktabs}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{float}
\usepackage{caption}
\usepackage{booktabs}
\usepackage{ltxtable}
\usepackage{ltablex}
\usepackage{longtable}
\usepackage{tabularx}
\usepackage{multirow}
\usepackage[titletoc,page]{appendix}
\usepackage[nottoc,notlot,notlof]{tocbibind}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@misc{A01,
author = {Author, A.},
year = {2001},
title = {Alpha},
}
\end{filecontents}
\usepackage{blindtext}
\renewcommand\appendix{\par
\setcounter{section}{0}
\setcounter{subsection}{0}
\setcounter{figure}{0}
\setcounter{table}{0}
\renewcommand\thesection{Appendix \Alph{section}}
\renewcommand\thefigure{\Alph{section}\arabic{figure}}
\renewcommand\thetable{\Alph{section}\arabic{table}}
}
\usepackage{hyperref}
\hypersetup{
colorlinks,
citecolor=black,
filecolor=black,
linkcolor=black,
urlcolor=black
}
\setlength{\parskip}{1em}
\renewcommand{\baselinestretch}{1.5}
\begin{document}
\tableofcontents
\appendix
\section{Regression tables}
Here is the
\clearpage
\end{document}
希望这能帮助您理解这个问题。非常感谢!
答案1
使用\begin{appendices}...\end{appendices}
将提供所请求的大多数功能,而不是改变\thesection
。
如果使用了,则\Alph
- 计数样式是\thesection
默认的,会将标题等添加到目录中的条目前面。 article
appendix
titletoc
Appendix A
为了应用 中的图形/表格计数器重置section
,请在的开头使用包\counterwithin
中的,手动或chngcntr
appendices
\AtBeginEnvironment{appendices}{...}
\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage[margin=1.25in]{geometry}
\usepackage{booktabs}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{float}
\usepackage{caption}
\usepackage{booktabs}
\usepackage{ltxtable}
\usepackage{ltablex}
\usepackage{longtable}
\usepackage{tabularx}
\usepackage{multirow}
\usepackage[titletoc,page]{appendix}
\usepackage[nottoc,notlot,notlof]{tocbibind}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@misc{A01,
author = {Author, A.},
year = {2001},
title = {Alpha},
}
\end{filecontents}
\usepackage{blindtext}
\usepackage{etoolbox}
\usepackage{chngcntr}
\AtBeginEnvironment{appendices}{%
\counterwithin{figure}{section}
\counterwithin{table}{section}
}
\usepackage{hyperref}
\hypersetup{
colorlinks,
citecolor=black,
filecolor=black,
linkcolor=black,
urlcolor=black
}
\setlength{\parskip}{1em}
\renewcommand{\baselinestretch}{1.5}
\begin{document}
\tableofcontents
%\appendix
\begin{appendices}
\section{Regression tables}
\begin{figure}
\caption{A figure}
\end{figure}
\begin{table}
\caption{A table}
\end{table}
\end{appendices}
Here is the
\clearpage
\end{document}