plk / biber

Backend processor for BibLaTeX
Artistic License 2.0
339 stars 38 forks source link

Interpreting non-ASCII characters as integers #356

Closed niruvt closed 3 years ago

niruvt commented 3 years ago

Try this code -

\documentclass{article}
\usepackage{marathi}
\usepackage[backend=biber, style=authoryear]{biblatex}
\begin{filecontents}[overwrite]{\jobname.bib}
@article{गौरी,
  author       = {मोघे, गौरी},
  title        = {तन्त्रशास्त्राचा परिचय},
  journaltitle = {आलोक मराठी नियतकालिक},
  date         = {२०२१},
  series       = {३},
  pages        = {१-५},
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
\cite{गौरी}

\printbibliography
\end{document}

One might notice that pp. and In: are missing in the output. This is because and १-५ are understood as characters and not as numerals, but well technically they are numerals. Changing to 3 and १-५ to 1-5 works. This forces users to use Latin numerals in their .bib files. For Marathi at least Devanagari numerals are shown even with the Latin numerals in the code because of the conversion programs by XeLaTeX and LuaLaTeX, but I am not sure if it is true for other languages, which means in the lack of a conversion program the output will show Latin numerals. Can something be done to make biber understand that , , , , , , , , are numerals? (At least when these come in the .bib file of Marathi/Hindi/Sanskrit/Nepali.)

sieversMartin commented 3 years ago

Have you tried to configure numbers with \DeclareNumChars?

niruvt commented 3 years ago

Nope. How to do that?

sieversMartin commented 3 years ago

Please consult p. 262 of the documentation. Basically you can give a list of characters to be considered as a number.

sieversMartin commented 3 years ago

\DeclareNumChars{१,२,३,४,५,६,७,८,९}

niruvt commented 3 years ago

Thanks. Closing.

moewew commented 3 years ago

Note that \DeclareNumChars does not take a comma-separated argument. It just takes an undelimited list of characters. So you'd probably want

\DeclareNumChars{१२३४५६७८९}
niruvt commented 3 years ago

@moewew Thanks, but then is it understood as one number or every character is understood as different a separate string?

moewew commented 3 years ago

Each character is processed and treated separately. The argument of \DeclareNumChars is treated as an undelimited list of single characters.

niruvt commented 3 years ago

Okay thanks.