The words chapter, part, appendix, table, figure, and the like are lowercased and spelled out in text (though sometimes abbreviated in parenthetical references).
(Chicago Manual of Style, 16th ed., section 8.178)
MWE:
\documentclass{scrartcl}
\usepackage[demo]{graphicx}
\usepackage{cleveref}
\begin{document}
\section{Geometric abstraction}
\Cref{myfig} shows a black square. For a black square, please refer to \cref{myfig}. Squares can be black (cf.\ \cref{myfig}).
\begin{figure}
\centering
\includegraphics[width=6cm,height=6cm]{fig1.pdf}
\caption[asd]{Kazimir Malevich. \textit{Black Square.} 1915. Oil on canvas. State Russian Museum, St Petersburg.}
\label{myfig}
\end{figure}
\end{document}
MWE produces:
What I am looking for:
Is there a clever (sorry) way to achieve this with cleveref
? I know that \Cref{}
will always produce the full form, capitalized reference, so that is a good start. But how would I handle the non-parenthetical reference in mid-sentence?
Best Answer
Here is another approach requiring less delving in to the innards of
cleveref
. The idea is to change the name locally using\crefname
.We load the
cleveref
package with thenoabbrev
option to get all the full name versions. We provide a list of abbreviated forms encapsulated in a command\abbrevcrefs
and then define a new command\cshref
for abbreviated references that calls\cref
proceeded by\abbrevcrefs
and enclosed in a group to make the effect local.The same general approach could be used to make modified versions of other commands from the
cleveref
package.I had hoped to be able just use the internal
\@cref@abbrevtrue
locally to turn on abbreviations, but it turns out thatcleveref
only uses this switch when initially defining the label names, not when typesetting them. The label defining process is hooked in to\AtBeginDocument
code, and can not be easily reevaluated to extract the abbreviated versions, hence the need to set up the abbreviations oneself.