3

Currently I am working with prettyref which is pretty useful and works fine. The only disadvantage so far is: if I use several references in a summary the references itself become pretty long and are disturbing the reading flow (e.g. "see section 4.1.2 "Test-Chapter" on page XYZ").

Is there a possible solution to shorten the cross-reference in my way (e.g. only see section 4.1.2)? I did not find any similar questions.

\documentclass{article}
\usepackage{prettyref}

\begin{document}
\section{Example 1}
\label{sec:Example_1}
Random Text.Random Text.Random Text.Random Text.Random Text.
\section{Example 2}
This is my second chapter. See also \prettyref{sec:Example_1}
\end{document}
6
  • 5
    Can you show a sample of your input?
    – egreg
    May 31, 2014 at 21:21
  • 1
    Saying \ref{section::foo} should provide a rather short reference.
    – user31729
    May 31, 2014 at 21:25
  • 6
    The default \ref would only produce "4.1.2" the other words must be produced by some markup you have not shown. May 31, 2014 at 21:25
  • Works fine. Prettyref seems to give more information, so now I can choose between the default \ref and \prettyref.
    – Jens
    Jun 1, 2014 at 8:41
  • 1
    @Jens: So you used prettyref package? Please always provide a MWE (meta.tex.stackexchange.com/q/228) so that other TeX.SX users can help you instead of making thousands of educated guesses...
    – user31729
    Jun 1, 2014 at 9:21

1 Answer 1

2

There are a number of different options for handling cross-references. If shortness is significant, nothing is likely to been the standard \ref as others mentioned. However, you can also use packages which handle things differently. fancyref and cleveref are the obvious candidates but note that fancyref seems to have a bug which messes up spacing with the default vario format. You can work around this pretty easily but since you want references to be shorter and less obtrusive, the plain format is a better choice anyway.

\documentclass{article}
\usepackage{prettyref}
\usepackage{fancyref}
\usepackage{cleveref}
\usepackage{kantlipsum}

\begin{document}

\section{Example 1}
\label{sec:Example_1}
\kant[1-5]

\section{Example 2}
This is my second chapter. See also \prettyref{sec:Example_1} (\verb|prettyref|).

Or see also \fref[plain]{sec:Example_1} (\verb|fancyref: plain|).

Or see also \ref{sec:Example_1} (\verb|default|).

Or see also \cref{sec:Example_1} (\verb|cleveref|).

\end{document}

Various referencing methods

Do see the documentation for the packages (linked above) to see the various options available. fancyref is highly customisable and I think the same is probably true of cleveref.

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.