4

I have

Figure \ref{sp}

which gives

Figure 3

I want to get

Figure 3, p. 13

Is there any macro for a reference of figure and page number?

1 Answers1

8

You can also use the cleveref package to avoid writing each time "figure" or "p.".

So writing

\Cref{sp}, \cpageref{sp}

gives what you want if you define the following formats

\crefname{page}{p.}{pp.}
\crefname{figure}{figure}{figures}

MWE

\documentclass{article}

\usepackage{cleveref}

\crefname{page}{p.}{pp.}
\crefname{figure}{figure}{figures}

\begin{document}
Some text
\newpage

\begin{figure}
\caption{text}\label{sp}
\end{figure}

\Cref{sp}, \cpageref{sp}

\end{document} 

Output:

enter image description here


EDIT

You can even create your own commands to automate this:

\newcommand{\Crefplus}[1]{\Cref{#1}, \cpageref{#1}}
\newcommand{\crefplus}[1]{\cref{#1}, \cpageref{#1}}

and use them as in the following MWE:

\documentclass{article}

\usepackage{cleveref}

\crefname{page}{p.}{pp.}
\crefname{figure}{figure}{figures}

\newcommand{\Crefplus}[1]{\Cref{#1}, \cpageref{#1}}
\newcommand{\crefplus}[1]{\cref{#1}, \cpageref{#1}}

\begin{document}
Some text
\newpage

\begin{figure}
\caption{text}\label{sp}
\end{figure}

\Crefplus{sp} at the beginning of line.

Inside a line \crefplus{sp}.

\end{document} 

Output:

enter image description here

karlkoeller
  • 124,410