1

I followed this link (Kannada page numbers in xelatex) to get chapter, section and page numbers in Kannada. However one specific issue is that the page numbers in the \front matter are getting displayed as boxes. Generally, they appear as roman numerals. This needs to be converted to Kannada numerals. What should I do to get that?

Please advise. Regards.

ShreevatsaR
  • 45,428
  • 10
  • 117
  • 149
vrgovinda
  • 330
  • Can you add a minimal example (of a complete document)? It will help others explore your question and see whether answering it is simple. – ShreevatsaR Mar 13 '22 at 15:20
  • Actually, I did some modification to an existing code from you and @Cicada and got the desired result. Please find the complete MWE in my answer below. Even though I have managed to pull it off, I would like to understand these things more systematically rather than doing without the right understanding. What should I do for that? Would you recommend any books/web resources? – vrgovinda Mar 13 '22 at 22:16
  • Glad you were able to figure out a solution… I completely understand and share the attitude of wanting to understand these things more systematically… I'll try to add an answer later explaining what I can, but I'm probably not the best person to recommend books/other resources related to this, as I don't know much about them myself :-) – ShreevatsaR Mar 13 '22 at 22:37
  • Actually, looking at the answer you linked to, it seems I did try to explain a bit there… could you say what part you'd like to understand better? – ShreevatsaR Mar 14 '22 at 14:50
  • Yes. I have acknowledged your explanation in my answer. In my previous comment, I was mentioning that rather than learning in bits and pieces, it would be nice if there could be more structured and systematic presentation of all these subtleties. – vrgovinda Mar 15 '22 at 06:03
  • On one hand, we have many books/resources to get started with LaTeX. But I would like to see some resources where one can learn about the details of (Xe)LaTeX, say, for e.g., counters, layout (margins, headers, footers), indic (or multilingual) customizations etc. in more depth. In that regard, I was requesting you to recommend any books/resources if they already exist. If they do exist, a one-stop resource listing them all would be of great help. – vrgovinda Mar 15 '22 at 06:05

1 Answers1

1

I used the following code from Numbering enumerate environments and pages with Devanagari alphabet to generate , , , , etc. as page numbers in the \frontmatter.

\makeatletter
% Always use Devanagari consonants for alph/Alph/roman/Roman styles.
\def\devanagari@alph#1{%
 \ifcase#1\or अ\or आ\or इ\or ई\or उ\or ऊ\or ए\or ऐ\or ओ\or औ\or
\else\@ctrerr\fi}

\let@alph\devanagari@alph \let@Alph\devanagari@alph \let@roman\devanagari@alph \let@Roman\devanagari@alph \makeatother

I customized it by replacing the word 'devanagari' with 'kannada' ...

\makeatletter
% Always use Kannada vowels for alph/Alph/roman/Roman styles.
\def\kannada@alph#1{%
 \ifcase#1\or ಅ\or ಆ\or ಇ\or ಈ\or ಉ\or ಊ\or ಋ\or ಋ\or ಎ\or ಏ\or ಐ\or ಒ\or ಓ\or ಔ\or ಅಂ\or ಅಃ\or 
\else\@ctrerr\fi}

\let@alph\kannada@alph \let@Alph\kannada@alph \let@roman\kannada@alph \let@Roman\kannada@alph \makeatother

... and got the desired result!!

Very grateful to @ShreevatsaR for your wonderful code snippet along with a nice explanation.

This is my MWE:

\documentclass{book}
\usepackage{polyglossia}
\newfontfamily\kannadafont{Noto Sans Kannada}[Script=Kannada]
\setmainlanguage[numerals=Kannada]{kannada}

\makeatletter %--- \def\kannadadigits#1{\expandafter@kannada@digits #1@} \def@kannada@digits#1{% \ifx @#1% terminate \else % ೦೧೨೩೪೫೬೭೮೯ \ifcase#1೦\or೧\or೨\or೩\or೪\or೫\or೬\or೭\or೮\or೯\fi \expandafter@kannada@digits \fi } %--- \def\kannadanumber#1{% \kannadadigits{\number#1}% } %--- \let@arabic\kannadanumber% %--- \makeatother

\makeatletter % Always use Kannada vowels for alph/Alph/roman/Roman styles. \def\kannada@alph#1{% \ifcase#1\or ಅ\or ಆ\or ಇ\or ಈ\or ಉ\or ಊ\or ಋ\or ಋ\or ಎ\or ಏ\or ಐ\or ಒ\or ಓ\or ಔ\or ಅಂ\or ಅಃ\or \else@ctrerr\fi}

\let@alph\kannada@alph \let@Alph\kannada@alph \let@roman\kannada@alph \let@Roman\kannada@alph \makeatother

\begin{document} \chapter{ಕನ್ನಡ} \section{ಕನ್ನಡ} ಕಖಗಘ \subsection{ಕನ್ನಡ} ಕಖಗಘ \kannadanumber{132 456 987}

೦೧೨೩೪೫೬೭೮೯ \section{ಕಖಗಘ} \today \subsection{ಕಖಗಘ}

\section{ಕಖಗಘ} ಕಖಗಘ\footnote{ಕಖಗಘ} ಕಖಗಘ\footnote{ಕಖಗಘ} ಕಖಗಘ\footnote{ಕಖಗಘ}

\end{document}

Thanks @Cicada for the code snippet which brings in Kannada Numerals instead of the arabic ones. Please excuse me if something is wrong with the Kannada words. I cannot read the language.

vrgovinda
  • 330