0

This question is similar to (but not a duplicate of) The cleveref capitalize option does not seem produced capitalized output

The original post makes a code example, which does not seem to always reproduce the problem. Here is a better attempt.

The following code is supposed to output \cref usages as capitalized label names, but it does not really work. Section is output as capitalized, but definition is output as lower case.

I'd be happy if someone could help me figure out why it doesn't seem to work. I'm also attaching an image to show that "definition" is given in lower case despite using the capitalize option.

enter image description here

\documentclass[a4paper]{article}
\usepackage{pgf}

\usepackage{color}
\definecolor{blueye}{rgb}{0, 0.2, 0.5}
\usepackage{mathtools}
\usepackage[colorlinks=true,allcolors=blueye]{hyperref}
\usepackage[capitalize]{cleveref}
\usepackage{amsthm}
\usepackage{framed}

\newtheorem{protodefinition}{Definition}[section]

\newenvironment{definition}
   {\colorlet{shadecolor}{green!5}\begin{shaded}\begin{protodefinition}}
   {\end{protodefinition}\end{shaded}}

\crefname{protodefinition}{definition}{definitions}
\Crefname{protodefinition}{Definition}{Definitions}

\begin{document}

\section{Introduction}
\label{sec.intro}

The problem we examine in this article is that of using Boolean
operations to decompose a set of partially overlapping regions into a
valid partition.  In particular, given $V=\{A_1, A_2, ..., A_M\}$,
suppose that for each pair $(A_i,A_j)$, we whether
$A_i \subseteq A_j$, $A_i \supseteq A_j$, or $A_i \cap A_j = \emptyset$.  We would
like to compute the maximal disjoint decomposition of $V$.  We define
precisely what we mean by maximal disjoint decomposition in
\cref{def.mdd} of \cref{sec.1253}.

\subsection{Maximal Disjoint Decomposition}
\label{sec.1253}

\begin{definition}
  \label{def.mdd}
  If $D$ is a disjoint decomposition such that for any other disjoint
decomposition $D'$ it holds that $|D| > |D'|$, then $D$ is said to be
a \emph{maximal disjoint decomposition}.
\end{definition}

\end{document}
4

As @samcarter says, this is the expected and documented behaviour: cleveref always honours your manual format definitions, whatever they are, irrespective of package options. (Same goes for the nameinlink option.) This is so that you can always manually override the default for individual reference types.

Just define your own reference formats as you want them to appear. If you want \cref references capitalised, defined the formats to be capitalised:

\crefname{protodefinition}{Definition}{Definitions}

(Note that just this line without the corresponding \Crefname suffices here, as the automatically-derived \Crefname will end up identical, which is what you want. Though supplying both is probably good practice, in case you later decide you want to e.g. change the \cref format to "Def." whilst keeping the \Cref format as "Definition".)

  • 1
    Would it be worth a feature request to retain the 'standard' behaviour of the capitalise option even with definitions set up via \crefname? It would certainly be more intuitive for me if \cref, \Cref and the capitalise option were to behave the same for the pre-defined labels and my own definitions. – moewe May 8 '18 at 15:35
  • Might make sense. Two issues: 1. It will lead to compilation errors if the \crefname starts with anything other than a normal character. 2. How will people override the capitalisation for individual types? This is relatively common, e.g. "eq." instead of "Eq." but keeping "Theorem" etc. – Toby Cubitt May 10 '18 at 9:57
  • Ah yes, 1. would be a problem if cleveref derives \Crefname from \crefname (which would also be an awesome feature, but I know all too well that automatic capitalisation is a nightmare), but not if the capitalise option simply tells \cref to take the \Crefname (which is what I - wrongly - thought happened). Ad 2. Yes that would be a problem, so this would need an opt-out. Now that I have seen how the capitalise option is implemented I'm more sceptical towards my request. Thanks for getting back to me and clearing things up. – moewe May 10 '18 at 10:13

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.