Anhänge ohne Nummer

Anhänge ohne Nummer

Gibt es eine Möglichkeit, in LaTeX nur einen einzigen, unnummerierten Anhang zu haben? Ich habe ein Dokument mit einem einzigen Anhang. Daher macht eine Nummerierung der Anhänge keinen wirklichen Sinn.

Im Moment habe ich den folgenden Code:

\appendix
\appendixpage
\section{}

Dadurch erhalte ich am Anfang meines Anhangs folgenden Text:

Bildbeschreibung hier eingeben

Im Idealfall würde ich meinen Anhang gerne beginnen mitAnhangin derselben Größe/im selben Format wie der \section{}Befehl. Gibt es eine einfache Möglichkeit, dies zu erreichen?

Antwort1

Eigentlich brauchen Sie nichts Besonderes. Eine einfache Lösung \section*{Appendix}würde genügen, aber der folgende Code schlägt bei Bedarf weitere Verbesserungen vor.

\documentclass{article}

\usepackage{lipsum} % for mock text

\newcommand{\addappendix}{%
  \section*{\appendixname}% start the appendix
  \addcontentsline{toc}{section}{\appendixname}% add it to the toc
  \counterwithin*{figure}{section}% optional, if you want to reset the figure counter
  \stepcounter{section}% reset counters related to section
  \renewcommand{\thesection}{A}% we want A
  \renewcommand{\thefigure}{\thesection.\arabic{figure}}% optional
}

\begin{document}

\title{A document with a single appendix}
\author{Me}

\maketitle

\tableofcontents

\section{Introduction}

\lipsum[1-3]

\section{Another}

\lipsum[4-6]

\addappendix

\lipsum[1]

\begin{figure}[htp]
\centering

\fbox{A figure here}

\caption{This is a figure}

\end{figure}

\lipsum[3-4]

\end{document}

Bildbeschreibung hier eingeben

Antwort2

So mache ich es ... Sie können die Elemente des Stils anpassen. Verwenden Sie, \appendix*wenn Sie einen einzelnen Anhang wünschen, oder verwenden Sie, \appendixum einen Anhang mit Buchstaben zu erhalten. Im Fall des einzelnen Anhangs werden Abbildungen, Tabellen und Gleichungen mit der A-xNotation nummeriert.

Da Anhänge als Abschnitte unterteilt sind \section, würde man für die Unterteilung innerhalb eines Anhangs \subsectionund verwenden \subsubsection. Die Nummerierung erfolgt als A.1und A.1.1usw. Außerdem wird die Unterteilung innerhalb eines Anhangs im Inhaltsverzeichnis weggelassen.

\documentclass{article}
\makeatletter
\let\svaddcontentsline\addcontentsline
\newcounter{appndx}

%% Create commands to create an unnumbered (lone) appendix or a series of
%% appendices, as needed
\renewcommand\appendix{%
  \renewcommand\addcontentsline[3]{%
    \def\qtest{##2}%
    \def\qmatch{subsection}%
    \ifx\qmatch\qtest\else%
      \def\qmatch{subsubsection}%
      \ifx\qmatch\qtest\else%
        \svaddcontentsline{##1}{##2}{##3}%
    \fi\fi%
  }%
  \@ifstar{\loneappendix}{\anappendix}%
}

\newcommand\loneappendix[2][p]{
  \def\appendixtitle{\appendixname. #2}
  \appendixformat[#1]{#2}%
}

\newcommand\anappendix[2][p]{
  \def\appendixtitle{\appendixname~\Alph{appndx}. #2}
  \appendixformat[#1]{#2}%
}

\newcommand\appendixformat[2][p]{
  \clearpage
  \refstepcounter{appndx}
  \setcounter{section}{\arabic{appndx}}
  \renewcommand\thesection {\appendixname~\Alph{appndx}.}
  \setcounter{subsection}{0}
  \renewcommand\thesubsection {\Alph{appndx}.\@arabic\c@subsection}
  \setcounter{paragraph}{0}
  \setcounter{subparagraph}{0}
  \setcounter{equation}{0}
  \setcounter{figure}{0}
  \renewcommand\thefigure{\Alph{appndx}-\@arabic\c@figure}
  \setcounter{table}{0}
  \renewcommand\thetable{\Alph{appndx}-\arabic{table}}
  \renewcommand\theequation {\Alph{appndx}-\arabic{equation}}
  \setcounter{footnote}{0}
  \addcontentsline{toc}{section}\appendixtitle
  \if p#1\vspace*{\fill}\fi
  \theappendix\appendixtitle
  \if p#1\vspace*{\fill}\clearpage\fi
}

\newcommand\theappendix[1]{
  \section*{\centering#1}
}
\makeatother

\begin{document}
\tableofcontents
\clearpage

\def\blahblah{
blah

\begin{equation}
y = mx + b
\end{equation}

\begin{figure}[ht]
\centering
\rule{10ex}{5ex}
\caption{Appendix figure}
\end{figure}

\begin{table}[ht]
\centering
\caption{Appendix table}
\begin{tabular}{|c|c|}
\hline
a & bbb \\
\hline
ccc & d\\
\hline
\end{tabular}
\end{table}}

\section{Normal Section}

\blahblah

\appendix*{A Lone Appendix}

\blahblah

\appendix{One Appendix of a Multi-Appendix}

\blahblah
\end{document}

Bildbeschreibung hier eingeben

Bildbeschreibung hier eingeben

Bildbeschreibung hier eingeben

Bildbeschreibung hier eingeben

Bildbeschreibung hier eingeben

verwandte Informationen