如何删除附录中的编号

如何删除附录中的编号

我的文档中只有一个附录,我需要删除附录中的“A”字符(在目录中和实际页面中)。

我的MWE如下:

\documentclass[a4paper,12pt]{report}
\usepackage[utf8]{inputenc}

\title{TEST}

\usepackage{listings}

\makeatletter
\AtBeginDocument{%
\renewcommand\lstlistoflistings{\bgroup
  \let\contentsname\lstlistlistingname
  \def\l@lstlisting##1##2{\@dottedtocline{1}{0em}{2.3em}{Listing ##1}{##2}}
  \let\lst@temp\@starttoc \def\@starttoc##1{\lst@temp{lol}}%
  \clearpage %<---------------
  \addcontentsline{toc}{chapter}{Listings}%
  \tableofcontents \egroup}
}
\makeatother

\begin{document}

\maketitle

\tableofcontents
\listoffigures
\listoftables

\lstlistoflistings

\chapter{INTRODUCTION}\label{chp:Introduction}

Interest in exploring the genetic data of organisms is growing everyday.

Miusov, as a man man of breeding and deilcacy, could not but feel some inwrd qualms, when he reached the Father Superior's with Ivan: he felt ashamed of havin lost his temper. He felt that he ought to have disdaimed that despicable wretch, Fyodor Pavlovitch, too much to have been upset by him in Father Zossima's cell, and so to have forgotten himself. "Teh monks were not to blame, in any case," he reflceted, on the steps. "And if they're decent people here (and the Father Superior, I understand, is a nobleman) why not be friendly and courteous withthem? I won't argue, I'll fall in with everything, I'll win them by politness, and show them that I've nothing to do with that Aesop, thta buffoon, that Pierrot, and have merely been takken in over this affair, just as they have."

He determined to drop his litigation with the monastry, and relinguish his claims to the wood-cuting and fishery rihgts at once. He was the more ready to do this becuase the rights had becom much less valuable, and he had indeed the vaguest idea where the wood and river in quedtion were.

\begin{lstlisting}[caption={My Code},language=C]
#include<stdio.h>

int main(int argc,char **argv)
{
  printf("Hello World!\n");
  return(0);
}
\end{lstlisting}

\appendix
%\addcontentsline{toc}{chapter}{\numberline{}Appendix}


\chapter{SOURCE CODES}
\label{chp:appendix_a}

\end{document}

答案1

如果您只想删除Appendix和中的章节编号TOC,则尝试使用\renewcommand{\thechapter}{\relax}MWE

\documentclass[a4paper,12pt]{report}
\usepackage[utf8]{inputenc}

\title{TEST}

\usepackage{listings}

\makeatletter
\AtBeginDocument{%
\renewcommand\lstlistoflistings{\bgroup
  \let\contentsname\lstlistlistingname
  \def\l@lstlisting##1##2{\@dottedtocline{1}{0em}{2.3em}{Listing ##1}{##2}}
  \let\lst@temp\@starttoc \def\@starttoc##1{\lst@temp{lol}}%
  \clearpage %<---------------
  \addcontentsline{toc}{chapter}{Listings}%
  \tableofcontents \egroup}
}
\makeatother

\begin{document}

\maketitle

\tableofcontents
\listoffigures
\listoftables

\lstlistoflistings

\chapter{INTRODUCTION}\label{chp:Introduction}

Interest in exploring the genetic data of organisms is growing everyday.

Miusov, as a man man of breeding and deilcacy, could not but feel some inwrd qualms, when he reached the Father Superior's with Ivan: he felt ashamed of havin lost his temper. He felt that he ought to have disdaimed that despicable wretch, Fyodor Pavlovitch, too much to have been upset by him in Father Zossima's cell, and so to have forgotten himself. "Teh monks were not to blame, in any case," he reflceted, on the steps. "And if they're decent people here (and the Father Superior, I understand, is a nobleman) why not be friendly and courteous withthem? I won't argue, I'll fall in with everything, I'll win them by politness, and show them that I've nothing to do with that Aesop, thta buffoon, that Pierrot, and have merely been takken in over this affair, just as they have."

He determined to drop his litigation with the monastry, and relinguish his claims to the wood-cuting and fishery rihgts at once. He was the more ready to do this becuase the rights had becom much less valuable, and he had indeed the vaguest idea where the wood and river in quedtion were.

\begin{lstlisting}[caption={My Code},language=C]
#include<stdio.h>

int main(int argc,char **argv)
{
  printf("Hello World!\n");
  return(0);
}
\end{lstlisting}

\appendix
%\addcontentsline{toc}{chapter}{\numberline{}Appendix}
\renewcommand{\thechapter}{\relax}

\chapter{SOURCE CODES}
\label{chp:appendix_a}

\end{document}

请注意,除此以外我没有修改您现有的标签......

相关内容