I have released a package named marathi
which aims for typing Marathi language with great efficiency. This package requires XeLaTeX or LuaLaTeX. XeLaTeX with package fontspec
provides a way to map arabic numerals with Devanagari ones. Try the following code -
% !TEX TS-Program = xelatex
\documentclass{article}
\usepackage{fontspec}
\setmainfont[Script=Devanagari,Mapping=devanagarinumerals]{Shobhika}
\begin{document}
\section{एक}
\section{दोन}
\end{document}
This gives correct mapping of Devanagari numerals. Unfortunately this function is not available with LuaLaTeX
. Try the following code.
% !TEX TS-Program = lualatex
\documentclass{article}
\usepackage{fontspec}
\setmainfont[Renderer=Harfbuzz,Script=Devanagari,Mapping=devanagarinumerals]{Shobhika}
\begin{document}
\section{एक}
\section{दोन}
\end{document}
This gives the following warning -
Input mapping not supported in LuaTeX.
Why is it not possible in LuaLaTeX is my first question.
I have tried to generate Devanagari numerals with LuaLaTeX using a solution given in this answer. It works almost fine unless a package using definition \@arabic
is used. Try this code (you need to install package marathi
and as per the package requirement Shobhika font which is mostly included in the TeX-distribution) -
\documentclass{article}
\usepackage{marathi}
\begin{document}
\section{एक}
\section{दोन}
\end{document}
This shall produce good results with both XeLaTeX and LuaLaTeX, but I got an error with package when I used a package which treats \@arabic
differently. There might be many such packages. The answer which I have referred also warns us about its effects, though I would like to use a softer way which will not produce un-predicted errors but will give me Devanagari numerals where necessary. Is there any way to make the package ignore the redefinition of \@arabic
when it is already used by a package, but mapping the numerals when there is no such package loaded. Concerned definitions can be found on line no. 66 and 67 of the package.
Package babel
does not give local enumeration. Try this code.
\tracinglostchars = 2 % Print a warning message if a character is missing.
\documentclass{article}
\usepackage[paperwidth=10cm]{geometry} % To format the MWE for TeX.SX
\usepackage[english, bidi=basic, layout=sectioning.counters]{babel}
\usepackage{fontspec}
\babelprovide[import, main, mapdigits]{marathi}
\defaultfontfeatures{Scale = MatchLowercase, Ligatures=TeX}
\babelfont{rm}[Scale=1.0,Ligatures={Common,Discretionary},Numbers=OldStyle]{Shobhika}
\babelfont{sf}[Ligatures={Common, Discretionary}]{Shobhika}
\babelfont[marathi]{rm}{Shobhika}
\babelfont[marathi]{sf}{Shobhika}
\begin{document}
\begin{enumerate}
\item अबक
\begin{enumerate}
\item अबक
\begin{enumerate}
\item अबक
\end{enumerate}
\end{enumerate}
\end{enumerate}
\end{document}
polyglossia
renews the enumeration counters ingloss-marathi.ldf
.babel-mr.ini
is lacking these definitions. I have asked this question here on the GitHub repo.babel
(which you can use with\babelprovide[import, maparabic, alph=alphabetic]{hindi}
), but it is not defined for Marathi. You can, however, create it yourself withenumitem
.