# Cleveref's lcnamecref

Consider the following example:

\documentclass{article}

\usepackage{ntheorem}
\usepackage{cleveref}

\newcommand{\theName}{conjecture}
\newcommand{\theNamePlural}{conjectures}

\newtheorem{conjecture}{\expandafter\MakeUppercase\theName}

\crefname{conjecture}{\expandafter\MakeUppercase\theName}{\expandafter\MakeUppercase\theNamePlural}
\Crefname{conjecture}{\expandafter\MakeUppercase\theName}{\expandafter\MakeUppercase\theNamePlural}

\begin{document}

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

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

Look at this fine \lcnamecref{c1}.

\end{document}


Contrary to what I expected, the output is

Look at this fine CONJECTURE.

I am sure this has something to do with expansion of macros, but I am absolutely oblivious as to what is happening, precisely.

Now, in my actual setup it is non-negotiable that the cref names and lables are derived from macros like \theName and \theNamePlural which are entirely lowercase. In order to implement the answer to my previous question, I need to \crefname and \Crefname with uppercase versions of these macros.

Question. Is there some way to modify \lcnamecref or define an entirely new macro that will output the following?

Look at this fine conjecture.

Thanks a bunch!

• What's the reason behind that very complicated setup? – egreg Sep 23 '16 at 15:01
• @egreg: Internationalization. I redefine the macros depending on the language. – Jesko Hüttenhain Sep 23 '16 at 15:01
• Also, I should add that while I could make the macros uppercase, it would be slightly cumbersome to do so because they have been used elsewhere with the assumption that they are always lowercase. It is not impossible for me to fix, but I would much rather have a macro that implements my desired behaviour of \lcnamecref, because it fixes my problems right away without running terrible regular expressions over a bunch of latex files. – Jesko Hüttenhain Sep 23 '16 at 15:10
• \lcnameref cannot lowercase things that are explicitly uppercased with \MakeUppercase. – egreg Sep 23 '16 at 15:13
• @egreg: Wow, ok, I was unaware of that. That only leaves the complicated way. I will accept your answer so this is closed. – Jesko Hüttenhain Sep 23 '16 at 15:14

I'm not sure why you want to complicate your life, but if you want the normal appearance of “Conjecture” in a \cref with a capital letter, define \theName with a capital letter (which is essentially the same solution as for your previous question).

\documentclass{article}

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

\newcommand{\theName}{Conjecture}
\newcommand{\theNamePlural}{Conjectures}

\newtheorem{conjecture}{\theName}
\Crefname{conjecture}{\theName}{\theNamePlural}

\begin{document}

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

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

Look at this fine \lcnamecref{c1}.

But also at \cref{c1,c2}.

\end{document}


However, there is a way for inputting the fixed tags as lowercase and making \lcnameref work, but it requires expl3.

\documentclass{article}

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

\ExplSyntaxOn
\cs_set_eq:NN \MakeMixedcase \tl_mixed_case:n
\ExplSyntaxOff

\newcommand{\theName}{conjecture}
\newcommand{\theNamePlural}{conjectures}

\newtheorem{conjecture}{\MakeMixedcase{\theName}}
\Crefname{conjecture}{\MakeMixedcase{\theName}}{\MakeMixedcase{\theNamePlural}}

\begin{document}

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

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

Look at this fine \lcnamecref{c1}.

But also at \cref{c1,c2}.

\end{document}

• Wow awesome, thanks for going through the trouble and providing a fix to my contorted problem. =) – Jesko Hüttenhain Sep 26 '16 at 8:39