4

I would like to refer to a figure in a published source, e.g., Figure 2.10 in Published Book . Since I use cleveref to automatically add the prefix for all my other references, I would also prefer to stick with cleveref in this case for consistency: When I want to change the reference format, I don't have to come to these cases and fix them manually. How can I do this?

I would like it to look like

\someref{2.10} in~\cite{somesource}
  • could you provide a snippet of how you'd like the .tex source to look for this sentence? – cmhughes May 28 '17 at 6:26
  • @cmhughes See my edit. – xuhdev May 28 '17 at 17:06
  • something like \newcommand{\someref}[1]{Figure~#1}? – cmhughes May 28 '17 at 19:57
  • @cmhughes Yes, but it should comply with the customization of cleveref. – xuhdev May 29 '17 at 4:42
  • Do you have access to the original LaTeX files (including the main aux file) of Published Book? If not, how is LaTeX supposed to infer or otherwise determine the type (figure, table, equation, etc) and number ("2.1", etc) of the object being cross-referenced? Are you, i.e., the author, going to supply this information manually? A separate issue: do you load hyperref as well? – Mico May 30 '17 at 6:58
1

Here is a solution

\documentclass{article}
\usepackage{cleveref}

\makeatletter
\newcommand{\mycref}[1]{\@nameuse{cref@#1@name}}
\newcommand{\myCref}[1]{\@nameuse{Cref@#1@name}}
\makeatother

\begin{document}
I would like to refer to a figure in a published source, e.g.,
\mycref{figure} 2.10 in Published Book. 

\myCref{figure} 2.10 in Published Book is a very nice picture.

\end{document}

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.