2

The amsart document class automatically uses small caps for subfigure labels, i.e. (A), (B), (C) in small caps instead of (a), (b), (c). However, cleverref will still refer to these as fig. 1a, fig. 1b, fig. 1c when using \cref. How can I modify \cref to use small caps?

  • Untested: Have you tried \Cref, in conjunction with \Crefname{subfigure}{Fig.}{Figs.}? – user31729 Jun 6 '16 at 18:09
  • That capitalizes just the first letter, so you get Fig. 1a instead of what I want which is fig. 1A. Actually, I'd be happy if I could just get all \cref text in small caps. – John Jun 6 '16 at 18:18
  • You have to redefine the \crefformat for subfigure counter then, I suppose – user31729 Jun 6 '16 at 18:21
2

Something like this?

enter image description here

\documentclass{amsart}

\usepackage{subcaption}
\usepackage{cleveref}


\crefdefaultlabelformat{#2{\scshape #1}#3}
\crefname{subfigure}{fig.}{figs.}
\Crefname{subfigure}{Fig.}{Figs.}
\begin{document}

\section{Foo}
\begin{figure}
\begin{subfigure}{0.5\textwidth}
  \caption{Foo label}
  \label{Foo}
\end{subfigure}
\end{figure}


\Cref{Foo} and \cref{Foo}

\end{document}

Update

Using a loop that defines the \crefformat for a list of counters as given to the \addcountertoseq macro:

\documentclass{amsart}

\usepackage{xparse}
\usepackage{subcaption}
\usepackage{hyperref}
\usepackage{cleveref}




\ExplSyntaxOn
\makeatletter
\seq_new:N \l_jcb_counter_seq 

\newcommand{\addcountertoseq}[1]{%
  \seq_set_from_clist:Nn \l_jcb_counter_seq {#1}
}

\newcommand{\switchtosmallcapsformat}{%
  \seq_map_inline:Nn \l_jcb_counter_seq {%
    \crefformat{##1}{####2{\protect\scshape\use:c{cref@##1@name}\ ####1}####3}
    \Crefformat{##1}{####2{\protect\scshape\use:c{Cref@##1@name}\ ####1}####3}
  }%
}
\ExplSyntaxOff
\makeatother


\addcountertoseq{section,subsection,subsubsection,part,figure,table,page,equation}

\switchtosmallcapsformat
\begin{document}


Outlook: In \cref{foo} we will see that ... and \cref{foofigure} shows that 

Outlook: In \Cref{foo} we will see that ... and \Cref{foofigure} shows that 

\clearpage


\section{Foo}\label{foo}
\begin{figure}
\begin{subfigure}{0.5\textwidth}
  \caption{Foo label}
  \label{foofigure}
\end{subfigure}
\end{figure}





\end{document}
  • Is there a way to make all text in cleverref small-caps? – John Jun 6 '16 at 20:04
  • @jcb: I'll check – user31729 Jun 6 '16 at 20:49
  • @jcb: I've found no way yet – user31729 Jun 11 '16 at 9:08
  • Thanks for checking. Its too bad cleverref can't infer it somehow from the current style--I'm only doing it to match the style of the document in which Figure, Lemma, etc. are all in smallcaps. – John Jun 16 '16 at 15:15
  • @jcb: Please see the update, I think, I have found a convenient way – user31729 Jul 20 '16 at 21:00

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.