LaTeX forum ⇒ Fonts & Character SetsMalayalam numbers

Information and discussion about fonts and character sets (e.g. how to use language specific characters)
suren
Posts: 12
Joined: Mon Mar 04, 2013 11:47 pm

Malayalam numbers

Postby suren » Sun Mar 10, 2013 1:41 am

Typesetting in Malayalam (a language of South India) is not a problem, as I am using the malayalam package. However, I cannot find a possibility to typeset the numbers in Malayalam. Does anybody have a solution.

Best regards
Suren

Tags:

suren
Posts: 12
Joined: Mon Mar 04, 2013 11:47 pm

Postby suren » Fri Apr 05, 2013 2:10 pm

Could someone help? Anybody has an idea?
Thank you.
Suren

User avatar
cgnieder
Site Moderator
Posts: 1974
Joined: Sat Apr 16, 2011 7:27 pm
Location: Germany
Contact:

Postby cgnieder » Sat Apr 06, 2013 5:22 pm

Hi Suren,

Maybe you could post a Infominimal working example that shows the issue. Without compilable code at hand many people (including me, I admit) often are too lazy to prepare a sample document themselves that shows what the problem is and in consequence they don't bother answering.

Regards
Clemens
------------------------------
chemmacros · chemformula · leadsheets · xsim

suren
Posts: 12
Joined: Mon Mar 04, 2013 11:47 pm

Postby suren » Wed Nov 13, 2013 10:02 pm

Sorry for the late reply. Finally here with concrete details. However, I am not sure if XeLaTeX is discussed here. I shall move on to that group on TUG as well.

I have, finally, managed to get Malayalam working on my Mac(Mountain Lion 10.5.8) using XeLaTeX. The issue in question is character rendering. Here are the details before I proceed.

System: Mac Mountain Lion 10.5.8
Editor: TeXShop 2.47
Engine : xelatex
Fonts used:
  1. Rachana (my favourite) uses old script
  2. Meera
  3. AnjaliOldLipi

Problems:

  • Rachana: the numerals (arabic) are NOT rendered. Only boxes appear. This includes page numbers. The punctuation marks, too, are not rendered. Only boxes appear.

  • Meera and AnjaliOldLipi: numbers are rendered but ligatures are terrible.

Example:
  1. \listfiles
  2. \documentclass[a4paper,12pt]{article}
  3. \usepackage[margin=1in]{geometry}
  4. \usepackage{fontspec}
  5. \defaultfontfeatures{Ligatures=TeX} %[Mapping=tex-text]
  6. \usepackage{polyglossia}
  7. \setdefaultlanguage{malayalam}
  8. \setotherlanguage{english}
  9. \newfontfamily\malayalamfont[Script=Malayalam]{Rachana}
  10. \newfontfamily\englishfont{Times}
  11. \begin{document}
  12. \lefthyphenmin=2
  13. \righthyphenmin=2
  14. %\thispagestyle{empty}
  15. \setmainfont[Script=Malayalam]{Rachana}
  16. %
  17. \setlength{\baselineskip}{1.25\baselineskip}\addtolength{\parskip}{10pt}
  18. %\textenglish{1,2,3.}
  19. മലയാളം ൽ ൾ ർ 3 .
  20. \end{document}
  21.  
  22. \textbf{പ്രാരംഭഃ}
  23. \begin{verse}
  24. \noindent
  25. \hfill{\textenglish{0}}
  26. \end{verse}
  27. \end{document}

The workaround is cumbersome.
  1. \textenglish{3}

The same applies to punctuation marks. if the punctuation marks are inserted using the above command, the rendering is fine.

The final problem. dashes are inserted when a word is broken at the end of the line and these dashes appear as boxes!!!


Final point: is there a possibility to generate the Malayalam numerals?
(http://en.wikipedia.org/wiki/Indian_numerals scroll down and you will see the table with the numbers)

Best regards
Suren
Last edited by localghost on Wed Nov 13, 2013 10:06 pm, edited 1 time in total.
Reason: Source code has to be tagged as such to keep a post clear and legible (see Board Rules).

suren
Posts: 12
Joined: Mon Mar 04, 2013 11:47 pm

Postby suren » Sun Apr 23, 2017 1:25 pm

I shall be grateful for any help in generating Malayalam numbers in my LaTeX Documents.
The documentation is not a problem, as I can generate documents in Malayalam. However, the numbers are still not in that language

Thank you in advance
Suren

rais
Posts: 149
Joined: Sun Nov 16, 2014 8:51 pm

Postby rais » Sun Apr 23, 2017 6:18 pm

you could try something like
  1. \listfiles
  2. \documentclass[a4paper,12pt]{article}
  3. \usepackage[margin=1in]{geometry}
  4. \usepackage{fontspec}
  5. \defaultfontfeatures{Ligatures=TeX} %[Mapping=tex-text]
  6. \usepackage{polyglossia}
  7. \setdefaultlanguage{malayalam}
  8. \setotherlanguage{english}
  9. \newfontfamily\malayalamfont[Script=Malayalam]{Akshar Unicode}
  10. \setmainfont[Script=Malayalam]{Akshar Unicode}
  11. %\newfontfamily\englishfont{Times}
  12. \newcounter{malayalamtemp}
  13. \newcounter{malayalamtempb}
  14. \newcounter{foo}
  15. \setcounter{foo}{358}
  16. \newcommand*\malayalamdigit[1]{%
  17. \ifcase#1
  18. \or
  19. \or
  20. \or
  21. \or
  22. \or
  23. \or
  24. \or
  25. \or
  26. \or
  27. \else
  28. ?\fi
  29. }
  30. \makeatletter
  31. \newcommand*\malayalamnum[1]{%
  32. % This is rather limited so far for numbers 0--999. For higher numbers, it would
  33. % need to be expanded accordingly.
  34. % Also, I'm unsure how ൰ (10),൱ (100), and ൲ (1000) would fit in
  35. % and if they're even the right symbols...
  36. % Frankly, they're not rendered by my version of Akshar Unicode anyway,
  37. % so I ignored them here.
  38. \ifnum\value{#1}<0 -%retain sign, though if this is the right symbol in Malayalam, I don't know
  39. \setcounter{malayalamtemp}{-\value{#1}}%
  40. \else
  41. \setcounter{malayalamtemp}{\value{#1}}%
  42. \fi
  43. \c@malayalamtempb\c@malayalamtemp% tempb = temp = |(#1)|
  44. \ifnum\c@malayalamtemp>99
  45. \divide\c@malayalamtemp by 100
  46. %CAVEAT: if the counter's (#1) value exceeds 999, malayalamtemp's value
  47. % exceeds 9 here and would be rendered as `?' by the following command:
  48. \malayalamdigit{\c@malayalamtemp}%
  49. \multiply\c@malayalamtemp by 100
  50. \advance\c@malayalamtempb by -\c@malayalamtemp
  51. \c@malayalamtemp\c@malayalamtempb
  52. \fi
  53. \ifnum\c@malayalamtemp>9
  54. \divide\c@malayalamtemp by 10 % temp = temp / 10 (integer division)
  55. \malayalamdigit{\c@malayalamtemp}%
  56. \multiply\c@malayalamtemp by 10
  57. \advance\c@malayalamtempb by -\c@malayalamtemp
  58. \malayalamdigit{\c@malayalamtempb}%
  59. \else
  60. \malayalamdigit{\c@malayalamtemp}%
  61. \fi
  62. }%\malayalamnum{counter}
  63. \makeatother
  64.  
  65. \renewcommand*\thepage{\malayalamnum{page}}
  66.  
  67. \begin{document}
  68. \lefthyphenmin=2
  69. \righthyphenmin=2
  70. %\thispagestyle{empty}
  71. %
  72. \setlength{\baselineskip}{1.25\baselineskip}\addtolength{\parskip}{10pt}
  73. %\textenglish{1,2,3.}
  74. മലയാളം ൽ ൾ ർ ൩ .
  75.  
  76. ൦ ൧ ൨ ൩ ൪ ൫ ൬ ൭ ൮ ൯
  77.  
  78. \malayalamnum{foo}
  79. \end{document}

Now, you can use \malayalamnum similar to \roman or \arabic to redefine whatever \the<counter> you want, as demonstrated here with \thepage.
Since I can't read Malayalam, you best check if I assembled those numbers correctly :wink:

KR
Rainer

suren
Posts: 12
Joined: Mon Mar 04, 2013 11:47 pm

Postby suren » Tue Apr 25, 2017 10:46 pm

Dear Rainer,

a million thanks. I shall try that. I only need a limited set. The remaining I can try later.

Regards
Suren


Return to “Fonts & Character Sets”

Who is online

Users browsing this forum: No registered users and 2 guests