I'm using a LaTeX template to produce my master thesis and I've encountered the following problem in appendix with tables.
In tese.tex where the document is set I have the following:
\begin{appendices}
\begin{appendix}
\pagenumbering{bychapter}
\input{Appendices/appendixA.tex}
\cleardoublepage
\end{appendix}
\end{appendices}
And in appendixA.tex:
\fancychapter{Title of AppendixA}
\label{ap:a}
And then in my introduction for example I write \ref{ap:a} and everything works just fine.
The problem appears when I had a table to the appendix, for example
\begin{table}[]
\centering
\caption{My caption}
\label{my-label}
\begin{tabular}{lll}
& & \\
& & \\
& &
\end{tabular}
\end{table}
Now if try to do \ref{ap:a} I get Reference `ap:a' on page 4 undefined.
Other important things are that I can reference the table (doing \ref{my-label} works perfectly and if add another appendix, let's image:
\begin{appendices}
\begin{appendix}
\pagenumbering{bychapter}
\input{Appendices/appendixA.tex}
\input{Appendices/appendixB.tex}
\cleardoublepage
\end{appendix}
\end{appendices}
Where appendixB.tex may be a copy of appendixA.tex but with a different label, then the problem migrates to appendix B and I start being abbe to reference appendix A.
All this example files I've named here, along with other configuration and tex files are in this GitHub repository. I've created an issue for this but so far I got nothing.
Update
According to comments added the file list adding \listfiles to the preamble, and my .log has the following:
*File List*
01.thesis.cls 2011/08/23
report.cls 2014/09/29 v1.4h Standard LaTeX document class
size10.clo 2014/09/29 v1.4h Standard LaTeX file (size option)
indentfirst.sty 1995/11/23 v1.03 Indent first paragraph (DPC)
ifthen.sty 2014/09/29 v1.1c Standard LaTeX ifthen package (DPC)
ulem.sty 2012/05/18
graphicx.sty 2014/10/28 v1.0g Enhanced LaTeX Graphics (DPC,SPQR)
keyval.sty 2014/10/28 v1.15 key=value parser (DPC)
graphics.sty 2016/07/10 v1.0t Standard LaTeX Graphics (DPC,SPQR)
trig.sty 2016/01/03 v1.10 sin cos tan (DPC)
graphics.cfg 2016/06/04 v1.11 sample graphics configuration
pdftex.def 2016/07/10 v0.06j Graphics/color for pdfTeX
infwarerr.sty 2016/05/16 v1.4 Providing info/warning/error messages (HO)
ltxcmds.sty 2016/05/16 v1.23 LaTeX kernel commands for general use (HO)
epsf.sty
00.textpos.sty 2007/03/30 v1.7d
everyshi.sty 2001/05/15 v3.00 EveryShipout Package (MS)
helvet.sty 2005/04/12 PSNFSS-v9.2a (WaS)
amsmath.sty 2016/06/28 v2.15d AMS math features
amstext.sty 2000/06/29 v2.01 AMS text
amsgen.sty 1999/11/30 v2.0 generic functions
amsbsy.sty 1999/11/29 v1.2d Bold Symbols
amsopn.sty 2016/03/08 v2.02 operator names
amsthm.sty 2015/03/04 v2.20.2
amssymb.sty 2013/01/14 v3.01 AMS font symbols
amsfonts.sty 2013/01/14 v3.01 Basic AMSFonts support
00.Definitions/packages.tex
babel.sty 2016/04/23 3.9r The Babel package
bblopts.cfg 2005/09/08 v0.1 add Arabic and Farsi to "declared" options of b
abel
english.ldf 2012/08/20 v3.3p English support from the babel system
portuges.ldf 2008/03/18 v1.2q Portuguese support from the babel system
inputenc.sty 2015/03/17 v1.2c Input encoding file
utf8.def 2016/02/28 v1.1s UTF-8 support for inputenc
t1enc.dfu 2016/02/28 v1.1s UTF-8 support for inputenc
ot1enc.dfu 2016/02/28 v1.1s UTF-8 support for inputenc
omsenc.dfu 2016/02/28 v1.1s UTF-8 support for inputenc
fontenc.sty
t1enc.def 2016/06/19 v1.99m Standard LaTeX file
datetime.sty 2015/03/20 v2.60 Date Time Package
etoolbox.sty 2015/08/02 v2.2a e-TeX tools for LaTeX (JAW)
fmtcount.sty 2015/05/05 v3.01
xkeyval.sty 2014/12/03 v2.7a package option processing (HA)
xkeyval.tex 2014/12/03 v2.7a key=value parser (HA)
fcprefix.sty 2012/09/28
fcnumparser.sty 2012/09/28
ifxetex.sty 2010/09/12 v0.6 Provides ifxetex conditional
fc-english.def 2013/08/17
fc-portuges.def 2014/06/09
datetime-defaults.sty 2013/09/10
latexsym.sty 1998/08/17 v2.2e Standard LaTeX package (lasy symbols)
multirow.sty
colortbl.sty 2012/02/13 v1.0a Color table columns (DPC)
array.sty 2014/10/28 v2.4c Tabular extension package (FMi)
color.sty 2016/07/10 v1.1e Standard LaTeX Color (DPC)
color.cfg 2016/01/02 v1.6 sample color configuration
supertabular.sty 2004/02/20 v4.1e the supertabular environment
pdflscape.sty 2016/05/14 v0.11 Display of landscape pages in PDF (HO)
lscape.sty 2000/10/22 v3.01 Landscape Pages (DPC)
ifpdf.sty 2016/05/14 v3.1 Provides the ifpdf switch
epsfig.sty 1999/02/16 v1.7a (e)psfig emulation (SPQR)
subfigure.sty 2002/07/30 v2.1.4 subfigure package
subfigure.cfg
dcolumn.sty 2014/10/28 v1.06 decimal alignment package (DPC)
bm.sty 2016/07/07 v1.2b Bold Symbol Support (DPC/FMi)
booktabs.sty 2005/04/14 v1.61803 publication quality tables
rotating.sty 2016/05/22 v2.16c rotated objects in LaTeX
caption.sty 2016/02/21 v3.3-144 Customizing captions (AR)
caption3.sty 2016/05/22 v1.7-166 caption3 kernel (AR)
natbib.sty 2010/09/13 8.31b (PWD, AO)
acronym.sty 2015/03/21 v1.41 Support for acronyms (Tobias Oetiker)
suffix.sty 2006/07/15 1.5a Variant command support
xstring.sty 2013/10/13 v1.7c String manipulations (C Tellechea)
appendix.sty 2009/09/02 v1.2b extra appendix facilities
chappg.sty 2006/05/09 v2.1b page numbering by chapter number pages by chap
ter (or other unit)
00.extra_functions.sty
minitoc.sty 2015/07/13 v61 Package minitoc
mtcmess.sty 2006/03/14
tese.mtc0
english.mld 2006/01/13
english.mld 2006/01/13
bbm.sty 1999/03/15 V 1.2 provides fonts for set symbols - TH
verbatim.sty 2014/10/28 v1.5q LaTeX2e package for verbatim enhancements
hyperref.sty 2016/06/24 v6.83q Hypertext links for LaTeX
hobsub-hyperref.sty 2016/05/16 v1.14 Bundle oberdiek, subset hyperref (HO)
hobsub-generic.sty 2016/05/16 v1.14 Bundle oberdiek, subset generic (HO)
hobsub.sty 2016/05/16 v1.14 Construct package bundles (HO)
ifluatex.sty 2016/05/16 v1.4 Provides the ifluatex switch (HO)
ifvtex.sty 2016/05/16 v1.6 Detect VTeX and its facilities (HO)
intcalc.sty 2016/05/16 v1.2 Expandable calculations with integers (HO)
etexcmds.sty 2016/05/16 v1.6 Avoid name clashes with e-TeX commands (HO)
kvsetkeys.sty 2016/05/16 v1.17 Key value parser (HO)
kvdefinekeys.sty 2016/05/16 v1.4 Define keys (HO)
pdftexcmds.sty 2016/05/21 v0.22 Utility functions of pdfTeX for LuaTeX (HO)
pdfescape.sty 2016/05/16 v1.14 Implements pdfTeX's escape features (HO)
bigintcalc.sty 2016/05/16 v1.4 Expandable calculations on big integers (HO)
bitset.sty 2016/05/16 v1.2 Handle bit-vector datatype (HO)
uniquecounter.sty 2016/05/16 v1.3 Provide unlimited unique counter (HO)
letltxmacro.sty 2016/05/16 v1.5 Let assignment for LaTeX macros (HO)
hopatch.sty 2016/05/16 v1.3 Wrapper for package hooks (HO)
xcolor-patch.sty 2016/05/16 xcolor patch
atveryend.sty 2016/05/16 v1.9 Hooks at the very end of document (HO)
atbegshi.sty 2016/06/09 v1.18 At begin shipout hook (HO)
refcount.sty 2016/05/16 v3.5 Data extraction from label references (HO)
hycolor.sty 2016/05/16 v1.8 Color options for hyperref/bookmark (HO)
auxhook.sty 2016/05/16 v1.4 Hooks for auxiliary files (HO)
kvoptions.sty 2016/05/16 v3.12 Key value format for package options (HO)
pd1enc.def 2016/06/24 v6.83q Hyperref: PDFDocEncoding definition (HO)
hyperref.cfg 2002/06/06 v1.2 hyperref configuration of TeXLive
url.sty 2013/09/16 ver 3.4 Verb mode for urls, etc.
hpdftex.def 2016/06/24 v6.83q Hyperref driver for pdfTeX
rerunfilecheck.sty 2016/05/16 v1.8 Rerun checks for auxiliary files (HO)
float.sty 2001/11/08 v1.3d Float enhancements (AL)
00.symlist.sty 2008/03/11 v1.1 Symbol List package
00.Definitions/pagesetup.tex
geometry.sty 2010/09/12 v5.6 Page Geometry
geometry.cfg
fancyhdr.sty 2016/09/06 3.8 Extensive control of page headers and footers
t1phv.fd 2001/06/04 scalable font definitions for T1/phv.
supp-pdf.mkii
epstopdf-base.sty 2016/05/15 v2.6 Base part for package epstopdf
grfext.sty 2016/05/16 v1.2 Manage graphics extensions (HO)
nameref.sty 2016/05/21 v2.44 Cross-referencing by name of section
gettitlestring.sty 2016/05/16 v1.5 Cleanup title references (HO)
tese.out
tese.out
0.Inicio/1.cover.tex
Figures/Cover/istnewlogo.pdf
Figures/Cover/coverimage.jpg
0.Inicio/2.citation.tex
0.Inicio/3.Acknowledgments.tex
0.Inicio/4.Abstract.tex
0.Inicio/5.Keywords.tex
0.Inicio/4.Resumo.tex
0.Inicio/5.PalavrasChave.tex
0.Inicio/6.Tables.tex
umsa.fd 2013/01/14 v3.01 AMS symbols A
umsb.fd 2013/01/14 v3.01 AMS symbols B
ulasy.fd 1998/08/17 v2.2e LaTeX symbol font definitions
0.Inicio/7.Acronim.tex
0.Inicio/8.symbols.tex
1.Introduction/main.tex
t1pbk.fd 2001/06/04 font definitions for T1/pbk.
1.Introduction/1.motivation.tex
1.Introduction/2.state.tex
1.Introduction/3.contributions.tex
1.Introduction/4.outline.tex
2.Chapter/main.tex
2.Chapter/1.sectiona.tex
Figures/2.Chapter/dummy.pdf
2.Chapter/2.sectionb.tex
omsphv.fd
99.Conclusions/conclusions.tex
tese.bbl
Appendices/appendixA.tex
***********
ap:aworked from what I downloaded, and also after adding yourtableexample toappendixA.tex. So I'm unable to replicate your problem. – Werner Sep 21 '16 at 17:08\ref{ap:a}in one of the files your compilation didn't gave warnings? I've tried in two machines, one didn't had LaTeX so I installed everything up to date and as soon as I add the table the reference changes from "A" to "??". – NBajanca Sep 21 '16 at 17:18\ref{ap:a}remained in tact with a correct hyperlink to Appendix A. Your next step might be to add\listfilesto your preamble and include in this post what you have under*File List*in your.log. See Which package version am I using? – Werner Sep 21 '16 at 17:28booktabs.styin the folder you're working with, or perhaps a local distribution? You version shows up as2005/04/14 v1.61803. I have2016/04/27 v1.618033. – Werner Sep 21 '16 at 17:57bblopts.cfg 2005/09/08 v0.1, which I don't have. Finally, there's ageometry.cfgloaded as well asfancyhdr.sty, both of which don't have any versions associated with them. I'm not showing any loading ofgeometry.cfg, and myfancyhdr.styis2016/09/06 3.8. – Werner Sep 21 '16 at 18:00booktabsdidn't. There is no such file and I use miktex package manager to uninstall and install again the package but the version that is on the repository is from 2005. – NBajanca Sep 21 '16 at 19:17.insto produce a.sty) and keep that in the folder you're working with. Local files supersede repository/installed ones. – Werner Sep 21 '16 at 19:19