So I'm using hyperref for all my referencing needs because it works very, very nicely. However, what I would like is to be able to choose whether the reference text is capitalised or not, so e.g.
see \autoref{fig:graph} for an example. \Autoref{fig:othergraph} shows the particular case
would produce
see figure 3.4 for an example. Figure 3.5 shows the particular case
Now, the best way I can see for doing this is to let hyperref define \autoref as normal, and then define \Autoref by taking the text generated by \autoref and uppercasing the first letter thereof. But I cannot make this work!
Playing around with some code (and for now just trying to get any uppercasing at the level I want), I tried
\newcommand\foo[1]{foo #1}
\newcommand{\bar}[1]{\expandafter \MakeTextUppercase\expandafter{\foo{#1}} }
for which \foo{aaa} \bar{aaa} produces
foo aaa FOO AAA
as expected; I read this code as "first expand \foo{#1}, then apply uppercasing to the result". But with \autoref:
\newcommand{\Autoref}[1]{\expandafter\MakeTextUppercase\expandafter{\autoref{#1}} }
I get the error
LaTeX Warning: Reference `LEM1' on page 1 undefined on input line 27.
Perhaps there are multiple levels of macro expansion going on here? But adding more \expandafters doesn't seem to help, and moreover feels like a fairly blunt thing to do :P.
I also tried the \Capitalise macro from this question, but it doesn't do anything at all to \autoref!
I think once I can get this working, making it only uppercase the first letter should be relatively trivial! But, does anyone have any advice here?
cleverefit's much easier. – egreg Jul 16 '15 at 23:14