TransWikia.com

how to get cross references for multiple items Persian language

TeX - LaTeX Asked on May 27, 2021

I would like to get a cross reference for multiple items using cleveref, but the problem is with that "and"; it shoould be "و".

documentclass{article}
usepackage[colorlinks,allcolors=blue]{hyperref} % optional
usepackage{cleveref}
newcommandpcref[1]{(cref{#1})}
crefformat{table}{#2جدول~#1#3}
crefformat{figure}{#2شكل~#1#3}
crefname{figure}{الشكل}{الأشكال}
Crefname{figure}{الشكل}{الأشكال}

usepackage{xepersian}
settextfont[Scale=2]{Arial}
setlatintextfont[Scale=1.3]{Arial}
defpersianfontSayeh[Scale=1.5]{Arial} 
begin{document}
begin{table}[h!] caption{foo}label{tab:foo}end{table}
begin{figure}[h!] caption{foo}label{fig:foo}end{figure}
begin{figure}[h!] caption{foo}label{fig:foo1}end{figure}
pcref{tab:foo}, pcref{fig:foo,fig:foo1}, pcref{fig:foo,tab:foo}
end{document}

enter image description here

One Answer

You need to provide the instruction

newcommandcrefpairconjunction{ و }

in order to achieve your formatting objective. See p. 14 of the user guide of the cleveref package for more information about the crefpairconjunction macro. There, you'll find the following explanation:

crefpairconjunction is used when there are only two cross-references in the list ...

enter image description here

documentclass{article}
usepackage[colorlinks,allcolors=blue]{hyperref} % optional

usepackage{cleveref}
newcommandpcref[1]{(cref{#1})}
newcommandcrefpairconjunction{ و } % <-- new
crefformat{table}{#2جدول~#1#3}
crefformat{figure}{#2شكل~#1#3}
crefname{figure}{الشكل}{الأشكال}
Crefname{figure}{الشكل}{الأشكال}

usepackage{xepersian}
settextfont[Scale=2]{Arial}
setlatintextfont[Scale=1.3]{Arial}
defpersianfontSayeh[Scale=1.5]{Arial} 

begin{document}
begin{table}[h!]  caption{tabbar} label{tab:bar}end{table}
begin{figure}[h!] caption{figfoo1}label{fig:foo}end{figure}
begin{figure}[h!] caption{figfoo2}label{fig:foo1}end{figure}

pcref{tab:bar}, pcref{fig:foo,fig:foo1}, pcref{fig:foo,tab:bar}
end{document}

Correct answer by Mico on May 27, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP