Discussion:
Autoref and subfig
(too old to reply)
Olaf Conradi
2006-05-17 10:58:15 UTC
Permalink
Hello,

I am using autoref from hyperef package to allow me to write:

As depicted in \autoref{fig:demo}, the average...

This will insert "Figure 1" in place.

But if I do the same with a reference to a subfigure, it only gets
expanded to " 1a", not "Figure 1a".

How can I add that to autoref?

Minimal example below.

Cheers
-Olaf

\documentclass{article}
\usepackage{subfig}
%\usepackage{graphicx}
\usepackage{hyperref}

\begin{document}

Proof is given in \autoref{fig:demo}.
As depicted in \autoref{fig:demo_a}, the this and that and so on.

\begin{figure}
\centering
\subfloat[Before]{\label{fig:demo_a}
insert before picture here
%\includegraphics{demo_a}
}
\qquad
\subfloat[After]{\label{fig:demo_b}
insert after picture here
%\includegraphics{demo_b}
}
\caption{Test results for demonstrating this and that.}
\label{fig:demo}
\end{figure}

\end{document}
Ulrike Fischer
2006-05-17 12:20:41 UTC
Permalink
Post by Olaf Conradi
Hello,
As depicted in \autoref{fig:demo}, the average...
This will insert "Figure 1" in place.
But if I do the same with a reference to a subfigure, it only gets
expanded to " 1a", not "Figure 1a".
How can I add that to autoref?
\newcommand{\subfigureautorefname}{\figureautorefname}
--
Ulrike Fischer
e-mail: zusätzlich meinen Vornamen vor dem @ einfügen.
e-mail: add my first name between the news and the @.
Olaf Conradi
2006-05-17 12:53:15 UTC
Permalink
Post by Ulrike Fischer
Post by Olaf Conradi
Hello,
As depicted in \autoref{fig:demo}, the average...
This will insert "Figure 1" in place.
But if I do the same with a reference to a subfigure, it only gets
expanded to " 1a", not "Figure 1a".
How can I add that to autoref?
\newcommand{\subfigureautorefname}{\figureautorefname}
Wow, that simple. Thank you.
Was trying something like that with subfloatautorefname.

-Olaf
d***@gmail.com
2006-05-31 00:24:41 UTC
Permalink
I tried this and it says that \subfigureautorefname is undefined. It
lets me do it for \figureautorefname but not for sub figure. Is there
some package that I need to include or something I need to do to make
this work?
Dave
d***@gmail.com
2006-05-31 00:28:22 UTC
Permalink
Sorry, I was calling \renewcommand instead of \newcommand and that was
the problem.
Dave

Loading...