0

I am trying to get the "Chapter number" in the \begin{appendices} to be a number instead of a Letter.

Since I need 2 appendice chapters, one called appendix and one called "Bilag", where Appendix have to be with letters, and bilag have to be with numbers, I have made a new environment that should be able to do it, but I can´t seem to figure out the right command

%Bilag
\newenvironment{Bilag}[1]{
%Reset Appendix counter, and making it into numbers
\makeatletter
\setcounter{@ppsaveapp}{0}

\renewcommand{\the@apps}{\arabic{@apps}} %This is the one that is supposed to work?

\makeatother

%Choosing the name of the new environment and adding it
\renewcommand\appendixtocname{Bilag}
  \renewcommand\appendixname{Bilag}
  \renewcommand\appendixpagename{Bilag}
\begin{appendices}#1}
{\end{appendices}}
1
  • Can you post a compilable MWE, i.e., from \documentclass{...}...\begin{document}...\end{document}
    – MadyYuvi
    May 17, 2018 at 12:38

2 Answers 2

1

I think the main reason your code is not working is that you are using the wrong counter. The @pps counter doesn't count appendix chapters/sections, but appendices environments. The counter used to number individual appendix chapters/sections is either chapter or section, depending on your document class.

Because the appendices environment redefines \thechapter or \thesection, you should moreover redefine these macros after \begin{appendices}.

I think the following probably does what you want. If you are using the article class you should replace all instances of chapter below by section.

\documentclass{report}

\usepackage[toc,page]{appendix}
\renewcommand{\restoreapp}{} %% <- Start numbering at 1 in every 'appendices'

% \usepackage[danish]{babel} %% <- Uncomment if you are using babel
% \addto\captionsdanish{ %% <- Uncomment if you are using babel
  \renewcommand\appendixname{Appendiks}
  \renewcommand\appendixtocname{Appendikser}
  \renewcommand\appendixpagename{Appendikser}
% } %% <- Uncomment if you are using babel

\newenvironment{bilag}{
  \renewcommand\appendixname{Bilag}
  \renewcommand\appendixtocname{Bilag}
  \renewcommand\appendixpagename{Bilag}
  \appendices %% <- would be called as part of \begin{appendices}
  % \setcounter{chapter}{0} %% <- Not needed if you redefine \restoreapp above
  \renewcommand\thechapter{\arabic{chapter}} %% <- Should come AFTER \appendices
}{
  \endappendices %% <- would be called as part of \end{appendices}
}

\begin{document}

\tableofcontents

\chapter{First chapter}
\section{A section}
\chapter{Second chapter}
\section{A section}

\begin{appendices}
\chapter{First appendix}
\section{A section}
\chapter{Second appendix}
\section{A section}
\end{appendices}

\begin{bilag}
\chapter{First bilag}
\section{A section}
\chapter{Second bilag}
\section{A section}
\end{bilag}

\end{document}

enter image description here

0

I am afraid I don't understand what you want, but here is a guess:

\documentclass{book}
\begin{document}
\frontmatter
\tableofcontents
\chapter{Abstract}
\mainmatter
\chapter{First Chapter}
\chapter{Second Chapter}

\appendix
\chapter{Appendix}
\section{First Appendix section}
\renewcommand{\thechapter}{\arabic{chapter}}
\chapter{Bilag}
\section{First Bilag section}

\backmatter
\chapter{Final thoughts}
\end{document}

Table of contents

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .