7

I recently thought my problem was solved, but it is more involved. Consider the following example:

\documentclass{article}

\usepackage{ntheorem}
\usepackage[capitalize]{cleveref}

\newtheorem{conjecture}{Conjecture}
\newtheorem{solution}{Solution}

\crefname{conjecture}{conjecture}{conjectures}
\crefname{solution}{solution}{solutions}

\begin{document}

\begin{conjecture} \label{c1} Something happened.
\end{conjecture}

\begin{conjecture} \label{c2} Something else also happened.
\end{conjecture}

\begin{solution} \label{s} A lot of things happened.
\end{solution}

\Cref{c1,c2,s} are both \namecref{s} and \namecref{c1}.

\end{document}

The output is the following:

Conjectures 1 and 2 and solution 1 are both solution and conjecture.

I would want the output to be:

Conjectures 1 and 2 and Solution 1 are both solution and conjecture.

How do I achieve this? In other words, I want everything to be capitalized in a \Cref statement with multiple references. In fact, I would even be happy if I could achieve this with a \cref statement, because I want everything to be capitalized when it has a number, but as illustrated in the example, I do not want \namecref output to be capitalized.


Thoughts

The solution to my previous question was the capitalise option, but this does not work here because it relies on cleveref auto-defining the names from the ntheorem definitions, and if we do this the plural for conjecture is not defined. The cleveref manual states:

Therefore, if the plural form is ever required, cleveref will produce a "\reference type undefined" warning, and type-set the cross-reference where the plural form is required as:

?? \ref{label} ...

In this case, you will have to provide an explicit \crefname or \Crefname definition yourself, to define the plural form as well as the singular form.

If I do that, the capitalise will not work any more because:

[...] if you explicitly define a \cref variant to not be capitalised, cleveref will still honour your definition. In other words, you're responsible for defining the capitalisation correctly in your own format definitions.

Maybe what I want is not possible, but it seems odd to me that the capitalise option is so useless.

2
  • It's not at all clear why “solution” should be uppercase, unless you want it to be everywhere uppercase.
    – egreg
    Sep 23, 2016 at 14:14
  • @egreg: As stated in the question, I indeed do want every reference capitalized, but I also want a command like \namecref that outputs a lowercase word. I.e. this is Theorem 9, a reference to a theorem. This is also the reason why I would be happy with the capitalise option, but it does not work well (actually, at all?) with plurals. Sep 23, 2016 at 14:17

1 Answer 1

3

You can use \lcnamecref:

\documentclass{article}

\usepackage{ntheorem}
\usepackage[capitalize]{cleveref}

\newtheorem{conjecture}{Conjecture}
\newtheorem{solution}{Solution}

\Crefname{conjecture}{Conjecture}{Conjectures}
\Crefname{solution}{Solution}{Solutions}

\begin{document}

\begin{conjecture} \label{c1} Something happened.
\end{conjecture}

\begin{conjecture} \label{c2} Something else also happened.
\end{conjecture}

\begin{solution} \label{s} A lot of things happened.
\end{solution}

\cref{c1,c2,s} are both \lcnamecref{s} and \lcnamecref{c1}.

\end{document}

enter image description here

1
  • I will accept because it fixes the example, but again it does not solve my problem because I can not get lcnamecref to work. Time for another question ;). Sep 23, 2016 at 14:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .