3

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.

3
  • 1
    Welcome to TeX.sx! Please add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document} ... not \begin{document} twice. – Fran Aug 8 '16 at 15:11
  • Assuming subappendices I would assume also that \subsection is the relevant structure level there (since article or something similar) seems to be the class. As such, \subsection provides the correct counter stepping and a \label will work. Of course, \textbf{Appendix II} does not provide the correct information for \label – user31729 Aug 8 '16 at 15:43
  • Your 'MWE' is not compilable and of course the cross - reference is wrong since there's no \refstepcounter command in \section* providing the correct label! Also: Why subappendices when using \section? – user31729 Aug 8 '16 at 21:09
2

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}
2
  • Dear Mico, it would be great if you can tweak the command so that i can get Appendix I, Appendix II and so on instead of Appendix A, Appendix B as you have written? And Appendix I should be centered. Thank you a lot. – santosh Aug 9 '16 at 11:54
  • @santosh - Just add the instruction \renewcommand\thesection{\Roman{section}} immediately after \appendix. – Mico Aug 10 '16 at 17:37
1

This would be a simple redefinition of the sectional numbering format (using \Roman{section}) as well as swapping the sectional number and title:

enter image description here

\documentclass{article}

\usepackage{appendix}
\usepackage[explicit]{titlesec}
\usepackage{hyperref}

\let\oldappendices\appendices
\renewcommand{\appendices}{%
  \oldappendices
  % https://tex.stackexchange.com/q/58295/5764
  \titleformat{\section}{\normalfont\Large\bfseries}{}{0em}{##1\ \thesection}
  \renewcommand{\thesection}{\Roman{section}}%
}

\begin{document}

\section{A section}
See Appendix~\ref{app:first-appendix}.

\begin{appendices}
\section{Appendix}\label{app:first-appendix}
An appendix.

\section{Appendix}
Another appendix.

\section{Appendix}
A final appendix.

\end{appendices}

\end{document}
4
  • Thank you, Werner for your help. However, how to create appendix name "Appendix I" instead of "A Appendices" as you have created. I have provided minimum working file. Sorry, that i could not post the question with more clarity. Kindly see if you can help me. Thank you again. – santosh Aug 8 '16 at 18:58
  • @santosh: See the updated answer. – Werner Aug 8 '16 at 19:24
  • Thank you a lot. Fixed :) I was trying to fix it for many days. i read this forum but could not help much. Finally, i decided to post it. I could have have done it much before. Thank you a lot. – santosh Aug 8 '16 at 21:25
  • @santosh: If this answer solved your problem, consider accepting it as such. See How do you accept an answer? – Werner Aug 8 '16 at 21:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.