0

I have the following example document where I'm using polyglossia and cleveref. The default name for table in spanish is cuadro. How can I change it into tabla and propagate this change to cleveref?

Here is what I tried:

\documentclass[10pt,a4paper]{article}
\usepackage{polyglossia}
\setdefaultlanguage{spanish}
\gappto\captionsspanish{\renewcommand{\tablename}{Tabla}}
\usepackage{cleveref}
%\crefname{table}{tabla}{tablas}
%\Crefname{table}{Tabla}{Tablas}
\begin{document}
Teste \Cref{tbl01}.
\begin{table}[h]
\caption{Teste.}
\label{tbl01}
\begin{tabular}{lll}
a & b & c \\
d & e & f \\
g & h & i 
\end{tabular}
\end{table}
\end{document}

I've also tried with the commented lines. In both cases, the result was:

enter image description here

3
  • As pointed out in the comments here, you have to load cleveref before polyglossia. But then you miss all the translations…
    – NBur
    Commented Feb 5, 2021 at 15:14
  • Maybe you should use babel instead of polyglossia.
    – NBur
    Commented Feb 5, 2021 at 15:16
  • @NBur changing the order makes it even worse... instead of Cuadro you'll get Table. The cleveref documentation also exemplifies loading babel before cleveref.
    – LEo
    Commented Feb 5, 2021 at 16:24

1 Answer 1

1

It seems there are some incompatibilities between polyglossia and cleveref (see this question and the comments).

You can solve your problem with babel:

\documentclass[10pt,a4paper, spanish]{article}
\usepackage{babel}
\addto\captionsspanish{\renewcommand{\tablename}{Tabla}}
\usepackage{cleveref}
\crefname{table}{tabla}{tablas}
\Crefname{table}{Tabla}{Tablas}
\begin{document}
    Teste \Cref{tbl01}.
    \begin{table}[h]
        \caption{Teste.}
        \label{tbl01}
        \begin{tabular}{lll}
            a & b & c \\
            d & e & f \\
            g & h & i 
        \end{tabular}
    \end{table}
\end{document}

Note that the language is specified as an option of the document class.

enter image description here

2
  • Instead of redefining the tablename for spanish, I just found a very simple solution here! But you do need to use crefname.
    – NBur
    Commented Feb 5, 2021 at 17:02
  • I switched from babel to polyglossia... so I was looking for a solution still using polyglossia.
    – LEo
    Commented Feb 5, 2021 at 19:35

You must log in to answer this question.

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