1

When using the cleveref capitalize option, all my references should be capitalized. But this is only working if I do not add new babel translations.

Running the following example results in figura instead of Figura:

enter image description here

And if I comment out my line \addto\captionsbrazil{\crefname{figure}{figura}{figuras}}, then the capitalize option starts working again:

enter image description here

How to fix the cleveref capitalize option when using it with the babel package?

How can I report this as bug to cleveref package maintainers?

\documentclass[english,12pt,a4paper,twoside]{abntex2}
\usepackage{listings}
\usepackage[nameinlink,capitalise]{cleveref}

\addto\captionsbrazil{\crefname{figure}{figura}{figuras}}
\addto\captionsbrazil{\Crefname{figure}{Figura}{Figuras}}

\begin{document}
\chapter{Hi}

See the \Cref{acode,afigure}.

\Cref{afigure}.

\Cref{acode}.

\begin{lstlisting}[caption=Code,label=acode]
Code
\end{lstlisting}

\begin{figure}[!htb]
\caption{Figure}
\label{afigure}
Figure
\end{figure}

Something...

\end{document}

Related questions:

  1. cleveref doesn't use correct capitalized name if used with amsthm?

Update

Following @Mico suggestion to not use \addto\captionsbrazil does not work because by default instead of showing Figura its shows Fig., then I need to use \addto\captionsbrazil to override this Fig. abbreviation:

enter image description here

\documentclass[english,12pt,a4paper,twoside]{abntex2}
\usepackage{listings}
\renewcommand\lstlistingname{Listagem}
\usepackage[nameinlink,capitalise,brazilian]{cleveref}

\begin{document}
\chapter{Hi}

See the \Cref{acode,afigure}.

\Cref{afigure}.

\Cref{acode}.

\begin{lstlisting}[caption=Code,label=acode]
Code
\end{lstlisting}

\begin{figure}[!htb]
\caption{Figure}
\label{afigure}
Figure
\end{figure}

Something...

\end{document}
0

1 Answer 1

2

I suggest you add the option brazilian to the list of options employed when loading the cleveref package. I.e., something like this:

\documentclass[english,12pt,a4paper,twoside]{abntex2}
\usepackage{listings}
\renewcommand\lstlistingname{Listagem}
\usepackage[nameinlink,capitalise,brazilian]{cleveref}

If you prefer to get "Figura" rather than "Fig.", simply add the option noabbrev to the list of options with which you load the cleveref package.

With this setup, the two \addto\captionsbrazil instructions shown in your code don't seem to be needed.

3
  • I updated the question with this example.
    – user
    Dec 7, 2019 at 13:48
  • Sorry, I downvoted this answer accidentally, and unfortunately I cannot undo it. Dec 8, 2019 at 8:20
  • 1
    @JavierBezos - Thanks for the heads-up. I've applied a minor edit to the answer; you should be able to undo the vote now. :-)
    – Mico
    Dec 8, 2019 at 8:24

You must log in to answer this question.

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