Text FormattingTable in appendix

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
jannetta
Posts: 46
Joined: Mon Dec 22, 2008 12:59 pm

Table in appendix

Post by jannetta »

Hi Folks

I have a table in an appendix. The problem is that this table has become "Table 1" even though it is not the first table in the document. I guess that happens because it is in the appendix. I don't mind that so much but now it is showing up in the "List of Tables" as 1 and not B1 (since it is appendix B).

What can I do to fix this?

Kind Regards
Jannetta

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
Stefan Kottwitz
Site Admin
Posts: 10321
Joined: Mon Mar 10, 2008 9:44 pm

Table in appendix

Post by Stefan Kottwitz »

Hi Jannetta,

perhaps post a Infominimal working example which shows your document setup. Such as if it has chapters, how the table numbering is defined, if appendixes are chapters or sections, etc. An example would make that clear. Otherwise it's hard to say, as we don't even know your document class or your preamble settings.

Stefan
LaTeX.org admin
jannetta
Posts: 46
Joined: Mon Dec 22, 2008 12:59 pm

Table in appendix

Post by jannetta »

Hi Stefan

Okay here goes. I hope this is minimal enough. I'm not good with MWEs because everytime I start stripping the document down I loose things or it stops working or it doesn't produce the error and I end up spending hours on the thing. As it is now it reproduces the problem that I have an one or two others that I still want to ask about.

Code: Select all

\documentclass[12pt, a4paper, onecolumn, oneside]{book}    % Current
\usepackage{setspace}
\renewcommand{\baselinestretch}{1.5} 
\setlength{\parskip}{\medskipamount} \setlength{\parindent}{0em}
\usepackage{acro}
\usepackage{etoolbox}
\usepackage{threeparttable}
\usepackage{mwe}
\usepackage{float}
\usepackage{listings}
\usepackage{xcolor}
\usepackage[titletoc,page]{appendix}
\usepackage[font=small,labelfont=bf]{caption}
\usepackage{newclude}
\usepackage{multirow}
\usepackage{array}
\usepackage{amsmath}
\usepackage[nonumberlist]{glossaries}

\definecolor{mygreen}{rgb}{0,0.6,0}
\definecolor{mygray}{rgb}{0.5,0.5,0.5}
\definecolor{mymauve}{rgb}{0.58,0,0.82}

\usepackage{hyperref}

\newcommand*{\bookappendix}[2]{%
	\setcounter{secnumdepth}{-1}\chapter{#1}\setcounter{secnumdepth}{2}%
	\setcounter{section}{0}\renewcommand*{\thesection}{{#2}.\arabic{section}}%
}
\hypersetup{
	unicode=false,          % non-Latin characters in Acrobat’s bookmarks
	pdftoolbar=true,        % show Acrobat’s toolbar?
	pdfmenubar=true,        % show Acrobat’s menu?
	pdffitwindow=true,      % page fit to window when opened
	pdftitle={Analysis and Modelling of the PY Complex in the Pyloric Circuit of the Crab Stomatogastric Ganglion},    % title
	pdfauthor={Jannetta S. Steyn},     % author
	pdfsubject={Subject},   % subject of the document
	pdfnewwindow=true,      % links in new window
	pdfkeywords={keywords}, % list of keywords
	colorlinks=true,       % false: boxed links; true: colored links
	linkcolor=cyan,          % color of internal links
	linkcolor=blue,
	citecolor=red,        % color of links to bibliography
	filecolor=green,      % color of file links
	urlcolor=blue           % color of external links
}



\setlength{\topmargin}{-0.8cm}
\setlength{\textheight}{24cm}
\raggedbottom

\newcommand{\note}[1]{}
\newcommand{\species}[1]{\textit{#1}}
\newcommand{\matlab}{MATLAB\textsuperscript{\textregistered}}
\AtBeginEnvironment{tablenotes}{\Large\color{red}}
%\section{{Abbreviations}}
\label{acro}
\DeclareAcronym{AB}{short=AB, long=anterior burster}
\DeclareAcronym{ADHD}{short=ADHD, long=Attention Deficit Hyperactivity Disorder}
\DeclareAcronym{avn}{short=avn, long=anterior dilator nerve}

\renewcommand{\bibname}{References}
\makeglossaries
\begin{document}
	%--------------------------------------------------------------------------
	% Title page
	\pagenumbering{gobble}
	\clearpage\thispagestyle{empty}
	\begin{titlepage}
		\newpage
		\begin{center}
			\vspace{25mm}
			{\bf\LARGE
				
				\label{Title Page}
			Short title
			}
			
			\vspace{25mm}
			{\Large\bf Jannetta S. Steyn}
			
			\large School of Computing Science
			
			\large Newcastle University
			
			\vspace{25mm}
			
			\begin{minipage}[t]{4in}
				\begin{center}
					\large This thesis is submitted in partial fulfilment of the requirement for the degree of
					
					\large\textit{Doctor of Philosophy}
					
					\vspace{5mm}
					
					\Large August 2015                    % Submission date
				\end{center}
			\end{minipage}
			
		\end{center}
	\end{titlepage}
	
	
	%--------------------------------------------------------------------------
	% Initial matter
	
	\frontmatter
	\pagestyle{empty}
\acresetall

\chapter{Abstract}
\label{chap:Abstract}
An Abstract  	

\cleardoublepage
\thispagestyle{empty}
\vspace*{\stretch{1}}
\begin{flushright}
	\itshape
	A dedication
\end{flushright}
\vspace{\stretch{3}}
\cleardoublepage

\chapter{Acknowledgements}
\label{chap:acknowledgements}
Some acknowledgements	

\chapter{Declaration}
\label{chap:declaration}

A declaration
	
	\pagestyle{plain}
	
\chapter{Publications}
\label{chap:Publications}

Some publications

%\acresetall % Reset acronyms - they'll be displayed in full again
	
	
	%\begin{singlespace}
	\setcounter{tocdepth}{3}
	\setcounter{secnumdepth}{3}
	
	%\cleardoublepage
	\pdfbookmark{\contentsname}{Contents}
	\tableofcontents
	
	%\cleardoublepage
	\pdfbookmark{List of Figures}{lof}
	\addcontentsline{toc}{chapter}{\listfigurename}
	\listoffigures
	
	%\cleardoublepage
	\pdfbookmark{List of Tables}{lot}
	\addcontentsline{toc}{chapter}{\listtablename}
	\listoftables
	
	\pdfbookmark{Acronyms}{acro}
	\addcontentsline{toc}{chapter}{Acronyms}
	\printacronyms[name=Acronyms]
	\cleardoublepage
	%\end{singlespace}
	
	\include{abbrevs3}
	\glsaddall
	\printglossaries
	
	\mainmatter
	\pagenumbering{arabic}
	%\printglossaries
	
	\setcounter{secnumdepth}{15}
	%\acresetall % Reset acronyms - they'll be displayed in full again

\acresetall
\chapter{Introduction}
\label{chap:intro}
Chapter one

\acresetall
\chapter{Background}
\label{chap:back}
Chapter two

	
	%--------------------------------------------------------------------------
	\backmatter
	%\pagestyle{plain}
	
	
	% Appendix
	%\renewcommand{\thechapter} {\Alph{appendix}}
	\appendix
	
	\label{Appendices}
	\begin{appendices}
		
		\bookappendix{Some appendix}{A}
		\label{app:HH}
		
		
		\bookappendix{Another appendix}{B}
		\label{app:dissection}
		Some stuff

		\begin{table}[H]
			\centering
			\caption{\species{Cancer pagurus} saline}
			\label{tab:saline}
			\begin{tabular}{lrrrrr}
				\hline 
				\textbf{Salt} & \textbf{(mM)} & \textbf{g/Liter} & \textbf{g/2 Liter} & \textbf{g/5 Liter} & \textbf{g/8 Liter} \\ \hline
				KCl   & 11.00    & 0.83  & 1.66  & 4.15  & 6.64 \\
				NaCl  & 440.00   & 25.80  & 51.60  & 129.00   & 206.40 \\
				CaCl2H2O & 13.00    & 1.90   & 3.80   & 9.50   & 15.20 \\
				MgCl26H2O & 26.00    & 5.30   & 10.60  & 26.50  & 42.40 \\
				Trizma base & 11.2  &  1.50  &  3.00  &  7.30  &  12.00 \\
				Maleic Acid &  5.00  &  0.60  &  1.20  &  3.00  &  4.80 \\
				Hepes &  10.00 &  2.38 &  4.76 &  9.52 & 19.04 \\
				\multicolumn{6}{l}{\textit{(Hepes can be used instead of Tris+Maleate)}} \\
				\hline
			\end{tabular}%
		\end{table}%
		
	\end{appendices}
	
	\bibliographystyle{acm}
	\cleardoublepage
	\pdfbookmark{References}{bib}
	\bibliography{research}
	\addcontentsline{toc}{chapter}{References}
	
	
\end{document}
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Re: Table in appendix

Post by Johannes_B »

It does not reproduce the problem. The example (which is huge) only contains one table, so it being numbered as one is no surprise. If i add another table earlier, it is correctly numbered.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
jannetta
Posts: 46
Joined: Mon Dec 22, 2008 12:59 pm

Re: Table in appendix

Post by jannetta »

Aw man! Sorry about that, stupidity struck again! However, when I add another table (say just copy the existing table into the Introduction section), then the Table is still numbered 1. I'm attaching my generated pdf. Do you get something different when you compile?
Attachments
mwe.pdf
(119.71 KiB) Downloaded 381 times
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Table in appendix

Post by Johannes_B »

Ok, i was able to reproduce it.

Code: Select all

\documentclass{book}
\newcommand*{\bookappendix}[2]{%
	\setcounter{secnumdepth}{-1}\chapter{#1}\setcounter{secnumdepth}{2}%
	\setcounter{section}{0}\renewcommand*{\thesection}{{#2}.\arabic{section}}%
}
%\newcommand{\bookappendix}[2]{\chapter{#1}\renewcommand{\thesection}{#2}}

\begin{document}
\listoftables
\chapter{Introduction}

\begin{table} \caption{} \end{table}%
\appendix
\chapter{}
\chapter{}
\chapter{}
\chapter{}
\bookappendix{Another appendix}{B}

\begin{table} \caption{} \end{table}%
\begin{table} \caption{} \end{table}%
\begin{table} \caption{} \end{table}%
\end{document}
What you have done with your bookappendix command, is simply slapping LaTeX in the face.

What are you trying to achieve?
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
jannetta
Posts: 46
Joined: Mon Dec 22, 2008 12:59 pm

Table in appendix

Post by jannetta »

:lol: My sincere apologies LaTeX. I promise I'll do better. Hopefully the folks here can save my soul. :lol:

To tell you the truth. I have no idea. I probably found that fudge somewhere on the Internet or asked for help on this forum. I think it is to get the page numbering to work correctly. If you look at the pdf that I uploaded, then you can see what I want. Apart from the Acronyms that appeared directly after the List of Tables, the document looks like I want it to. I managed to fix this problem now by moving the \cleardoublepage that used be after :

Code: Select all

	\include{abbrevs3}
	\addcontentsline{toc}{chapter}{Neuropeptide Acronyms}
	\glsaddall
	\printglossaries
to just before it.
Now the only problem is still to get a B in front of the 1 in the index entry for appendix B.

I am happy to make the LaTeX syntax more elegant but to tell you the truth I just don't have any more time to struggle to get LaTeX to format the document properly. I feel like I have spent more time on LaTeX than on writing the contents of my thesis and I just don't have the time anymore.
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Table in appendix

Post by Johannes_B »

Sorry, i still don't know what you mean by getting a B in front of the index entry.

What exactly should be numbered with a B, and what is the malicious code block supposed to do? I think we can find a better solution.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
jannetta
Posts: 46
Joined: Mon Dec 22, 2008 12:59 pm

Table in appendix

Post by jannetta »

Okay, here is (as minimal as I can get it) MWE again with the "malicious code" removed. The first appendix now numbers it sections as .1 and .2 in stead of A.1 and A.2. Let's sort this first and then we can come back to the table problem.

Code: Select all

\documentclass[12pt, a4paper, onecolumn, oneside]{book}    % Current
\usepackage{setspace}
\renewcommand{\baselinestretch}{1.5} 
\setlength{\parskip}{\medskipamount} \setlength{\parindent}{0em}
\usepackage{acro}
\usepackage{etoolbox}
\usepackage{threeparttable}
\usepackage{mwe}
\usepackage{float}
\usepackage{listings}
\usepackage{xcolor}
\usepackage[titletoc,page]{appendix}
\usepackage[font=small,labelfont=bf]{caption}
\usepackage{newclude}
\usepackage{multirow}
\usepackage{array}
\usepackage{amsmath}
\usepackage[nonumberlist]{glossaries}

\definecolor{mygreen}{rgb}{0,0.6,0}
\definecolor{mygray}{rgb}{0.5,0.5,0.5}
\definecolor{mymauve}{rgb}{0.58,0,0.82}

\usepackage{hyperref}

\hypersetup{
	unicode=false,          % non-Latin characters in Acrobat’s bookmarks
	pdftoolbar=true,        % show Acrobat’s toolbar?
	pdfmenubar=true,        % show Acrobat’s menu?
	pdffitwindow=true,      % page fit to window when opened
	pdftitle={Analysis and Modelling of the PY Complex in the Pyloric Circuit of the Crab Stomatogastric Ganglion},    % title
	pdfauthor={Jannetta S. Steyn},     % author
	pdfsubject={Subject},   % subject of the document
	pdfnewwindow=true,      % links in new window
	pdfkeywords={keywords}, % list of keywords
	colorlinks=true,       % false: boxed links; true: colored links
	linkcolor=cyan,          % color of internal links
	linkcolor=blue,
	citecolor=red,        % color of links to bibliography
	filecolor=green,      % color of file links
	urlcolor=blue           % color of external links
}



\setlength{\topmargin}{-0.8cm}
\setlength{\textheight}{24cm}
\raggedbottom

\newcommand{\note}[1]{}
\newcommand{\species}[1]{\textit{#1}}
\newcommand{\matlab}{MATLAB\textsuperscript{\textregistered}}
\AtBeginEnvironment{tablenotes}{\Large\color{red}}
%\section{{Abbreviations}}
\label{acro}
\DeclareAcronym{AB}{short=AB, long=anterior burster}
\DeclareAcronym{ADHD}{short=ADHD, long=Attention Deficit Hyperactivity Disorder}
\DeclareAcronym{avn}{short=avn, long=anterior dilator nerve}

\renewcommand{\bibname}{References}
\makeglossaries
\begin{document}
	%--------------------------------------------------------------------------
	% Title page
	\pagenumbering{gobble}
	\clearpage\thispagestyle{empty}
	\begin{titlepage}
		\newpage
		\begin{center}
			\vspace{25mm}
			{\bf\LARGE
				
				\label{Title Page}
			Short title
			}
			
			\vspace{25mm}
			{\Large\bf Jannetta S. Steyn}
			
			\large School of Computing Science
			
			\large Newcastle University
			
			\vspace{25mm}
			
			\begin{minipage}[t]{4in}
				\begin{center}
					\large This thesis is submitted in partial fulfilment of the requirement for the degree of
					
					\large\textit{Doctor of Philosophy}
					
					\vspace{5mm}
					
					\Large August 2015                    % Submission date
				\end{center}
			\end{minipage}
			
		\end{center}
	\end{titlepage}
	
	
	%--------------------------------------------------------------------------
	% Initial matter
	
	\frontmatter
	\pagestyle{empty}
\acresetall

\chapter{Abstract}
\label{chap:Abstract}
An Abstract  	

\cleardoublepage
\thispagestyle{empty}
\vspace*{\stretch{1}}
\begin{flushright}
	\itshape
	A dedication
\end{flushright}
\vspace{\stretch{3}}
\cleardoublepage

\chapter{Acknowledgements}
\label{chap:acknowledgements}
Some acknowledgements	

\chapter{Declaration}
\label{chap:declaration}

A declaration
	
	\pagestyle{plain}
	
\chapter{Publications}
\label{chap:Publications}

Some publications

%\acresetall % Reset acronyms - they'll be displayed in full again
	
	
	%\begin{singlespace}
	\setcounter{tocdepth}{3}
	\setcounter{secnumdepth}{3}
	
	%\cleardoublepage
	\pdfbookmark{\contentsname}{Contents}
	\tableofcontents
	
	%\cleardoublepage
	\pdfbookmark{List of Figures}{lof}
	\addcontentsline{toc}{chapter}{\listfigurename}
	\listoffigures
	
	%\cleardoublepage
	\pdfbookmark{List of Tables}{lot}
	\addcontentsline{toc}{chapter}{\listtablename}
	\listoftables
	\cleardoublepage
	
	\pdfbookmark{Acronyms}{acro}
	\addcontentsline{toc}{chapter}{Acronyms}
	\printacronyms[name=Acronyms]
	%\end{singlespace}
	
	\include{abbrevs3}
	\addcontentsline{toc}{chapter}{Neuropeptide Acronyms}
	\glsaddall
	\printglossaries
	
	\mainmatter
	\pagenumbering{arabic}
	%\printglossaries
	
	\setcounter{secnumdepth}{15}
	%\acresetall % Reset acronyms - they'll be displayed in full again

\acresetall
\chapter{Introduction}
\label{chap:intro}
Chapter one using \ac{AB}
		\begin{table}[H]
			\centering
			\caption{\species{Cancer pagurus} saline}
			\label{tab:salin1e}
			\begin{tabular}{lrrrrr}
				\hline 
				\textbf{Salt} & \textbf{(mM)} & \textbf{g/Liter} & \textbf{g/2 Liter} & \textbf{g/5 Liter} & \textbf{g/8 Liter} \\ \hline
				KCl   & 11.00    & 0.83  & 1.66  & 4.15  & 6.64 \\
				NaCl  & 440.00   & 25.80  & 51.60  & 129.00   & 206.40 \\
				CaCl2H2O & 13.00    & 1.90   & 3.80   & 9.50   & 15.20 \\
				MgCl26H2O & 26.00    & 5.30   & 10.60  & 26.50  & 42.40 \\
				Trizma base & 11.2  &  1.50  &  3.00  &  7.30  &  12.00 \\
				Maleic Acid &  5.00  &  0.60  &  1.20  &  3.00  &  4.80 \\
				Hepes &  10.00 &  2.38 &  4.76 &  9.52 & 19.04 \\
				\multicolumn{6}{l}{\textit{(Hepes can be used instead of Tris+Maleate)}} \\
				\hline
			\end{tabular}%
		\end{table}%

\acresetall
\chapter{Background}
\label{chap:back}
Chapter two using \ac{ADHD}

	
	%--------------------------------------------------------------------------
	\backmatter
	%\pagestyle{plain}
	
	
	% Appendix
	%\renewcommand{\thechapter} {\Alph{appendix}}
	\appendix
	
	\label{Appendices}
	\begin{appendices}
		
		\chapter{Some appendix}
		\label{app:HH}
		Some text 
		\section{the first bit}
		\section{the second bit}
		
		\chapter{Another appendix}
		\label{app:dissection}
		Some stuff

		\begin{table}[H]
			\centering
			\caption{\species{Cancer pagurus} saline}
			\label{tab:saline}
			\begin{tabular}{lrrrrr}
				\hline 
				\textbf{Salt} & \textbf{(mM)} & \textbf{g/Liter} & \textbf{g/2 Liter} & \textbf{g/5 Liter} & \textbf{g/8 Liter} \\ \hline
				KCl   & 11.00    & 0.83  & 1.66  & 4.15  & 6.64 \\
				NaCl  & 440.00   & 25.80  & 51.60  & 129.00   & 206.40 \\
				CaCl2H2O & 13.00    & 1.90   & 3.80   & 9.50   & 15.20 \\
				MgCl26H2O & 26.00    & 5.30   & 10.60  & 26.50  & 42.40 \\
				Trizma base & 11.2  &  1.50  &  3.00  &  7.30  &  12.00 \\
				Maleic Acid &  5.00  &  0.60  &  1.20  &  3.00  &  4.80 \\
				Hepes &  10.00 &  2.38 &  4.76 &  9.52 & 19.04 \\
				\multicolumn{6}{l}{\textit{(Hepes can be used instead of Tris+Maleate)}} \\
				\hline
			\end{tabular}%
		\end{table}%
		
	\end{appendices}
	
	\bibliographystyle{acm}
	\cleardoublepage
	\pdfbookmark{References}{bib}
	\bibliography{research}
	\addcontentsline{toc}{chapter}{References}
	
	
\end{document}
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Table in appendix

Post by Johannes_B »

\backmatter, kick it out.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Post Reply