1

In other word, if I want to reference "Section II.A" in the article. What should I do, thank you.

  • You should add \label{my_section_II.A} just after the \section{} command and use \ref{my_section_II.A} when you want to refer to it. – Ludovic C. Jun 16 '13 at 13:09
  • 1
    @LudovicC. This is the method; but it's preferred to use a descriptive name for the label, rather than hardcoding a number which may change during document preparation. – egreg Jun 16 '13 at 13:18
  • Sure the name I used here was just to avoid a X which might be interpreted badly as variable. I tried to be more specific in my answer. – Ludovic C. Jun 16 '13 at 13:20
  • 1
    The objective of your posting isn't entirely clear: Is it about citing (and referencing) a separate chapter in a book as well as the book itself? Or is it about creating a cross-reference to a section that's in a different chapter of one and the same book? – Mico Jun 16 '13 at 14:28
4

You should use the hyperref package and use the following commands:

\label{sec:X}

just after the call to the section you want to refer to, and

\autoref{sec:X}

when you want to refer to this section, the output will be: section II.A (if this the number of the labelled section. Other commands which might be useful:

\ref{sec:X}

will give you only the number of the section without the "section" in front,

\pageref{sec:X}

will give the page number of the labelled section.

Note that X can be whatever you want and you should use something which describes your section title to make it easier to use when you'll have a lot of label and references.

This commands work also for figures, tables, chapters etc, when using the right prefix (This is not mandatory for having the right "section", "chapter" or "figure" in front of the number when calling \autoref{}, since the hyperref package knows which is which thanks to a special numbering [Thanks @Ulrich Schwarz for the remark]. However this might help a lot to sort your labels and to know quickly to what they are refering).

For example for a chapter use chap:X, for a figure fig:X, for a table tab:X, for an equation eq:X etc.

  • If I recall, hyperref's code actually looks at the counter that is used, and not at fig: prefixes and the like. It's still a good idea to use those, though, since some editors offer "insert reference" commands that will guess from context whether you want to reference a figure and only offer you fig: labels. – Ulrich Schwarz Jun 16 '13 at 13:40

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.