Page Layout ⇒ Appendix in an article
Appendix in an article
I'm writing a report for a project using the article document class, and am having issues with the Appendix.
I have been able to add the word "appendix" before the A and make it appear OK in the toc, but am not happy with the numbering of the tables/figures/equations.
In a report, any table/figure/equation inserted in Appendix A is labelled Table A.1, or equivalent for figure/equation. However, in an article, the labelling simply follows from the rest of the document.
How do I by-pass this and force LaTeX to rework the numbering so that it is labelled with the Appendix it is in?
Thanks,
Victor
PS: I'm relatively new to LaTex.
This is the code I would be kind of working with (esp. the appendix end);
\documentclass{article}
\usepackage{amsmath}
\usepackage{amssymb}
\makeatletter
\newcommand\appendix@section[1]{%
\refstepcounter{section}%
\orig@section*{Appendix \@Alph\c@section: #1}%
\addcontentsline{toc}{section}{Appendix \@Alph\c@section: #1}%
}
\let\orig@section\section
\g@addto@macro\appendix{\let\section\appendix@section}
\makeatother
\begin{document}
\tableofcontents
\section{Part 1}
\label{a}
This is sec~\ref{a}
\section{Part 2}
\label{b}
This is sec~\ref{b}
\appendix
\section{Additional Data}
\label{c}
This is app~\ref{c}
%Kinetic data table
\begin{table}[htdp]
\begin{center}
\caption{Kinetic Data} \label{table:kineticdata}
\begin{tabular}{ccc}
\hline \hline
$j$ & $E_{j}$ & $k_{0,j}$ \\
& (kcal.kmol$^{-1})$ & (kmol.m$^{-3}$.hr$^{-1}$.kPa$^{-2}$) \\ \hline
1 & $15000$ & $1.59\times10^5$ \\
2 & $20000$ & $8.83\times10^5$ \\
3 & $25000$ & $1.81\times10^8$ \\ \hline \hline
\end{tabular}
\end{center}
\end{table}
\subsection{Selectivity}
\begin{eqnarray}
S_{i} &=& \frac{\xi_{i}}{\sum_{i}\xi_{i}} \\
\therefore \ \xi_{2} &=& \frac{S_{2} \xi_{2}}{S_{1}} \\
\text{and} \ \xi_{3} &=& \frac{\xi_{1}}{S_{1}}-\xi_{1}-\xi_{2}
\end{eqnarray}\\
\end{document}
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Appendix in an article
You can load the caption package with some options to get the desired numbering with in sections.
Code: Select all
\usepackage[%
figurewithin=section,
tablewithin=section
]{caption}
Best regards and welcome to the board
Thorsten
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Re: Appendix in an article
Sorry about not loading the code in the correct place, this is the first time I am using this forum and wasn't quite sure how to do so.
Thank you very much for your reply. This works really well for tables and figures but does not seem to do so for equations. Furthermore, now that I have loaded the package, I have a table embedded in a subsection which does not get referenced anymore (I simply obtain "??").
My questions would be;
1. Can this specific labelling be applied to equations? If so how?
2. Can this specific labelling go further than simply section, such as subsection? i.e. table 2.1.1 or figure 2.1.1 (table & figure situated in section 2, subsection 1)?
Thank you.
Victor
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Appendix in an article
Read the Important Announcements of the forum team. The code button is very easy to find in the button list right above the input window when composing a post.dill03 wrote:[...] Sorry about not loading the code in the correct place, this is the first time I am using this forum and wasn't quite sure how to do so. [...]
Oh. Seems that I missed this point. I give the solution below.dill03 wrote:[...] Thank you very much for your reply. This works really well for tables and figures but does not seem to do so for equations. [...]
You have to run (pdf)latex at least twice to get all references right. In case the problem persists, build a minimal working example (MWE) that reproduces the misbehaviour.dill03 wrote:[...] Furthermore, now that I have loaded the package, I have a table embedded in a subsection which does not get referenced anymore (I simply obtain "??"). [...]
This cannot be done with the suggested package. It needs the amsmath package followed by a command for the desired numbering.dill03 wrote:[...] 1. Can this specific labelling be applied to equations? If so how? [...]
Code: Select all
...
\usepackage{amsmath}
...
\numberwithin{equation}{section}
From the code I gave in my last reply you should be able to recognize what you have to do to get the numbering within »subsection«.dill03 wrote:[...] 2. Can this specific labelling go further than simply section, such as subsection? i.e. table 2.1.1 or figure 2.1.1 (table & figure situated in section 2, subsection 1)? [...]
For all packages there exist manuals which can be found on CTAN. It is strongly recommendable to read those manuals because they give detailed information about the capabilities and the usage.
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Re: Appendix in an article
I got the equations labelled as per section. From the caption package, I found out how to specify the labelling of tables and figures (on page 16 of the english help document found on CTAN).
For this I used
\renewcommand\thetable{\Alph{section}.\arabic{subsection}.\arabic{table}}
For tables labelled A.1.1. (table 1 in appendix A.1.)
And equivalently for figures.
\renewcommand\thefigure{\Alph{section}.\arabic{subsection}.\arabic{figure}}
Placing these two commands at the begining of my appendix ensures that this labelling applies only to the appendix and not to the rest of the document.
Thanks again!

Victor
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Appendix in an article
Code: Select all
\captionsetup{%
figurewithin=subsection,
tablewithin=subsection
}
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10