[Tex/LaTex] How to cross reference to multiple appendices in an article

appendicescross-referencing

Kindly help me. I have three appendixes in my research article. I want to cross-ref in my document. However, I am not able to do so. I am sorry that i could not post the question with clarity. Thus, i am posting once again the minimum working file which i hope is sufficient. It would be better if you can help me in cross-referring to three appendices: Appendix I, Appendix II, and Appendix III. (Kindly note that i want appendix to be named liked this)

So, the minimum working file is:

\documentclass[11pt]{article}
\usepackage[paper=a4paper,dvips,top=2cm,left=2cm,right=2cm,foot=1cm,bottom=2cm]{geometry}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage{appendix}

\begin{document} 
\tableofcontents %run twice to get the table of contents.
\listoffigures
\listoftables
\maketitle

\section{Introduction}
XYZ.........ABC
\section{Lit Review}
XYZ.........ABC
\section{Data}

See Appendix \ref{app:1} for results of unit root test. For detailed discussion of construction of variable, see Appendix \ref{app:2}. See Figure 1 in the Appendix \ref{app:3}.

\section{Results and Interpretation}

\newpage
\appendix
\addappheadtotoc
\begin{subappendices}
\begin{center}
\section*{Appendix I} \label{app:1}
\end{center}
ABCDEF........XYZ

\begin{center}
\section*{Appendix II} \label{app:2}
\end{center}

This Appendix is intended to describe the sources of data and construction of indices and variables used in the econometric analysis.

\begin{center}
\section*{Appendix III} \label{app:3}
\end{center}

\begin{figure}[h]
    \centering
    \caption{Net Procurement and Foodgrains Inflation}
        \includegraphics[width=12cm, height=8cm]{np_graph.eps}
    \label{fig:1}
\end{figure}
\end{subappendices}
\end{document}

=====================
When i run this code, i am able to cross-ref to respective appendices. The problem is that in the text the appendix numbers are coming wrong. For example, if i want to show See Appendix I for results of unit root test, the final output is showing "See Appendix '8' for results of unit root test." Why 8, i don't know.
Kindly help.

Best Answer

Some suggestions:

  • Instead of putting the (mostly redundant) word "Appendix" in the section-level headers in the appendix, use descriptive labels for these headers. After all, you don't put "Section" in the section-level headers in the main body of the document, do you?

  • Use \section rather than \section* to generate numbered (or lettered) section-level headers in the appendix.

  • If you need to center-set section-level headers, load the sectsty package and issue the directive \sectionfont{\centering} at the start of the appendix material.

  • Last but not least, consider loading the cleveref package and using \cref to generate cross-references. A nice feature of \cref is that it can contain multiple objects in its argument. (For more information on various LaTeX cross-referencing packages, see the posting Cross-reference packages: which to use, which conflict?

enter image description here

\documentclass[a4paper,11pt,demo]{article} % omit 'demo' option in real document
\usepackage[margin=2cm]{geometry}
\usepackage{graphicx,caption,sectsty,appendix}
\usepackage[colorlinks,linktocpage]{hyperref}
\usepackage[nameinlink,noabbrev,capitalize]{cleveref}
\title{Title}
\author{Author(s)}
\date{Date}

\begin{document} 
\tableofcontents 
\listoffigures

%%%\listoftables

\maketitle

\section{Introduction}
XYZ\dots ABC

\section{Lit Review}
XYZ\dots ABC
\section{Data}

See \cref{app:1} for results of unit root tests. For a detailed 
discussion of construction of variable, see \cref{app:2,app:3}. 
And, see \cref{fig:1} in \cref{app:3}.

\section{Results and Interpretation}

\newpage
%% center-set the section-level headers
\sectionfont{\centering}
\appendix
\addappheadtotoc
%%%\begin{subappendices}

\section{Appendix about stuff} \label{app:1}

ABCDEF\dots XYZ

\section{Appendix about more stuff} \label{app:2}

This Appendix is intended to describe the sources of data and 
construction of indices and variables used in the econometric analysis.

\section{Appendix about still more stuff} \label{app:3}

\begin{figure}[h]
    \centering
    \caption{Net Procurement and Foodgrains Inflation}
    \label{fig:1}
    \includegraphics[width=12cm, height=8cm]{np_graph.eps}
\end{figure}

%%%\end{subappendices}
\end{document}
Related Question