我有以下乳胶代码:
\documentclass[a4paper,11pt]{article}
\usepackage{latexsym}% Package loading the LaTeX symbol.
\usepackage[center,tight,small]{subfigure}
\usepackage[singlelinecheck=false,justification=centering]{caption}
\usepackage[latin1, utf8]{inputenc}
\usepackage{siunitx}
\usepackage{etoolbox}
\usepackage{epstopdf}
\usepackage{titlesec}
\usepackage{makecell}
\usepackage[hang]{footmisc}
\setlength{\footnotemargin}{2mm}
\usepackage[hmargin=2.5cm,vmargin=3.5cm]{geometry}
\usepackage{setspace}
\setstretch{1.5}
\counterwithin*{footnote}{section}
% CHANGE SECTION STYLE
\titleformat{\section}
{\LARGE\bfseries}{\thesection.}{1em}{}
\titleformat{\subsection}
{\Large\bfseries}{\thesubsection.}{1em}{}
\addtolength{\skip\footins}{2pc plus 5pt}
%APPENDIX
% Renumbering equations and figures within the appendix.
\renewcommand\appendix{\par
\setcounter{section}{0}%
\setcounter{subsection}{0}%
\setcounter{equation}{0}
\setcounter{table}{0}
\gdef\thefigure{\Alph{section}.\arabic{figure}}%
\gdef\thetable{\Alph{section}.\arabic{table}}%
\gdef\thesection{\Alph{section}}%
\gdef\thesubsection{\Alph{section}.\arabic{subsection}}%
%\@addtoreset{equation}{section}%
\gdef\theequation{\Alph{section}.\arabic{equation}}%
}
\def\appendixname{Appendix}
\usepackage{color}
\definecolor{CommentColor}{rgb}{0.953,0.371,0.258}
\definecolor{LinkColor}{rgb}{0,0.2,0.5}
\definecolor{RefColor}{rgb}{0,0.2,0.5}
\usepackage{xr-hyper}
\usepackage[colorlinks=true,pdfstartview=FitH,citecolor=blue,urlcolor=blue,linkcolor=blue]{hyperref} %option dvipdfm for dvi
\usepackage{atbegshi}% http://ctan.org/pkg/atbegshi
\AtBeginDocument{\AtBeginShipoutNext{\AtBeginShipoutDiscard}}
%PDF Farben einstellen
\hypersetup{colorlinks=true,%
linkcolor=RefColor,%
citecolor=LinkColor,%
filecolor=LinkColor,%
menucolor=LinkColor,%
urlcolor=LinkColor
}
\let\orgautoref\autoref
\providecommand{\Autoref}{%
\def\equationautorefname{Equation}%
\def\figureautorefname{Figure}%
\def\subfigureautorefname{Figure}%
\orgautoref}
% \autoref is used inside the sentence
\renewcommand{\autoref}{%
\def\figureautorefname{Figure}%
\def\tableautorefname{Table}%
\def\sectionautorefname{Section}%
\def\subsectionautorefname{Section}%
\def\appendixrefname{Appendix}%
%\def\propositionrefname{Proposition}%
%\def\theoremrefname{Proposition}%
\orgautoref}
\newcommand{\subfigureautorefname}{\figureautorefname} % subfloat
\newcommand{\bc}{\color{CommentColor}}
\newcommand{\ac}{\color{black}}
\begin{document}
\title{\bf \LARGE{Title}\\
\Large{Title 2}}
\author{Rollo99$^*$ \\
(\small{University})}\thanks{Email: \url{[email protected]}.}
\date{(September 2021)}
\maketitle
\thispagestyle{empty}
\renewcommand{\thefootnote}{\fnsymbol{footnote}}
\renewcommand{\thefootnote}{\arabic{footnote}} \setcounter{footnote}{0}
\setcounter{page}{1}\pagenumbering{Roman}
\vspace{-10mm}
%\newpage
\begin{abstract}
\singlespacing
Abstract
\end{abstract}
\newpage
\setcounter{page}{1}\pagenumbering{arabic}
\section{Introduction}\label{sec:intro}
Introduction. Then I want to refer to \autoref{sec: app}.
Need to fix it because now I see displayed \autoref{sec: app_a} and \autoref{sec: app_a0} and \autoref{sec: app_a1}
\newpage
\appendix
\counterwithin{figure}{section}
\counterwithin{table}{section}
\section*{APPENDIX}\label{sec: app}
This Appendix is organised as follows.
\section{Ciao 0}\label{sec: app_a}
Ciao ciao ciao
\subsection{Ciao 1} \label{sec: app_a0}
The aim of this paragraph is to .....
\subsection{Ciao 2} \label{sec: app_a1}
Ciao ciao ciao
\end{document}
问题是现在显示:第 1 节、第 A.1 节和第 A.2 节(见下文):
我希望看到显示的内容为:附录、附录 A.1、附录 A.2 等。
有人能帮我做吗?
谢谢!
答案1
更新和写入目录的内容所需的自动化和复杂程度,\autoref
以便超链接能够自动更新前缀Appendix
,以及与附录的引用偏差没有分段数量可能比通过 进行内部手动超链接的使用更为重要\hyperref[<link>]{<stuff>}
。
\documentclass{article}
%APPENDIX
% Renumbering equations and figures within the appendix.
\renewcommand\appendix{\par
\setcounter{section}{0}%
\setcounter{subsection}{0}%
\setcounter{equation}{0}
\setcounter{table}{0}
\gdef\thefigure{\Alph{section}.\arabic{figure}}%
\gdef\thetable{\Alph{section}.\arabic{table}}%
\gdef\thesection{\Alph{section}}%
\gdef\thesubsection{\Alph{section}.\arabic{subsection}}%
%\@addtoreset{equation}{section}%
\gdef\theequation{\Alph{section}.\arabic{equation}}%
}
\def\appendixname{Appendix}
\usepackage{color}
\definecolor{CommentColor}{rgb}{0.953,0.371,0.258}
\definecolor{LinkColor}{rgb}{0,0.2,0.5}
\definecolor{RefColor}{rgb}{0,0.2,0.5}
\usepackage[colorlinks=true,pdfstartview=FitH,citecolor=blue,urlcolor=blue,linkcolor=blue]{hyperref} %option dvipdfm for dvi
%PDF Farben einstellen
\hypersetup{colorlinks=true,%
linkcolor=RefColor,%
citecolor=LinkColor,%
filecolor=LinkColor,%
menucolor=LinkColor,%
urlcolor=LinkColor
}
\begin{document}
\section{Introduction}
Introduction. Then I want to refer to the \hyperref[sec:app]{Appendix}.
Need to fix it because now I see displayed \hyperref[sec:app_a]{Appendix~\ref*{sec:app_a}} and
\hyperref[sec:app_a0]{Appendix~\ref*{sec:app_a0}} and
\hyperref[sec:app_a1]{Appendix~\ref*{sec:app_a1}}.
\newpage
\appendix
\section*{APPENDIX}\label{sec:app}
This Appendix is organised as follows.
\section{Ciao 0}\label{sec:app_a}
The aim of this paragraph is to \ldots
\subsection{Ciao 1} \label{sec:app_a0}
The aim of this paragraph is to \ldots
\subsection{Ciao 2} \label{sec:app_a1}
The aim of this paragraph is to \ldots
\end{document}
\ref
您可以使用星号版本的( )构建超链接字符串Appendix~\ref*{<label>}
。如果您只有少量参考资料,那么这肯定是可行的方法。
答案2
您可以考虑在附录开头添加以下内容:
% %% ==========================================================
\addcontentsline{toc}{chapter}{Appendices}
\appendix
\setcounter{figure}{0} \renewcommand{\thefigure}{\Alph{chapter}.\arabic{figure}}
\setcounter{table}{0} \renewcommand{\thetable}{\Alph{chapter}.\arabic{table}}
\setcounter{algorithm}{0} \renewcommand{\thealgorithm}{\Alph{chapter}.\arabic{algorithm}}