2

I have used this code.

\documentclass[12pt]{book}
\usepackage{fontspec}
\setmainfont{Noto Sans Tamil}

\begin{document}

கௌரிப் பாட்டி பொறுமையாய் வெகு நேரம் பஸ்ஸிற்குள் நின்றிருந்தாள். எல்லோரும் இறங்கிய பின், தனது காக்கி நிறப் பையின் கனத்தை இடுப்பில் ஏற்றிக் கொண்டு கடைசியாக வந்தாள்.

"பாட்டி...பாட்டி" பையைத் தூக்கியாரட்டா? ஓரணா குடு பாட்டி."

"வண்டி வேணுங்களா அம்மா?"

"புதுப்பாளையம் வக்கீல் குமாஸ்தா ஐயர் வீடுதானுங்களே....வாங்க, போவோம்" ---என்று பல்வேறு வரவேற்புக் குரல்களுடன் அவளை இறங்கவிடாமல் தடுத்து நின்ற வண்டிக்காரர்களையும், கூலிக்காரச் சிறுவர்களையும் பார்த்துக் கனிவோடு சிரித்துவிட்டுப் பாட்டி சொன்னாள்:

"எனக்கு ஒண்ணும் வேண்டாம்பா..சித்தே வழியை விட்டேள்னா நான் மெள்ள நடந்தே போயிடுவேன்.... ஏண்டாப்பா, வீட்டெக் கூடத் தெரிஞ்சு வெச்சிருக்காய்... நான்தான் மாசம் ஒருதடவை வர்றேனே, என்னிக்கு வண்டியிலே போனேன்?" என்று ஒவ்வொருவருக்கும் ஒவ்வொரு பதிலைச் சொல்லி, அவர்களை விலக்கி வழியமைத்துக் கொண்டு தணலாய்த் தகிக்கும் வெயிலில், முக்காட்டை இழுத்து விட்டுக் கொண்டு, இடுப்பில் ஏற்றிய சுமையுடன் வறுத்துக் கொட்டிய புழுதி மண்ணை அழுந்த அழுந்த மிதித்தவாறு ஒரு பக்கமாய்ச் சாய்ந்து சாய்ந்து நடந்தாள் பாட்டி.


\end{document}

I compiled the above using XeTex and the resulting pdf looks like this

enter image description here

I tried using ragged2e package but it didn't change anything. This text extending beyond margin seems to happen only when I am using Tamil.

1 Answers1

5

A few tips:

  • Load the Tamil language and its hyphenation patterns in babel or polyglossia. Your main problem was that none of the lines were wrapping.
  • In LuaLateX, microtype will enable font expansion and drastically reduce the amount of hyphenation you need.
  • There were one or two places where the algorithm didn’t recognize a word break, so I helped it out by inserting a zero-width space.
  • Opening quotes in TeX should be `` or “, and " or ” should be closing quotes.
  • LuaLaTeX needs the HarfBuzz renderer to support complex scripts.
  • I have no idea what this says. My apologies if there’s anything wrong with it.

A template:

\documentclass[12pt]{book}
\tracinglostchars=2
\usepackage[nil]{babel}
\babelprovide[import,main]{tamil}
\usepackage{fontspec}
\usepackage{microtype}

\defaultfontfeatures{ Ligatures=TeX, Renderer=HarfBuzz, Scale=MatchLowercase } \babelfont{rm} [Scale=1.0]{Noto Sans Tamil}

\newcommand\wordbk{\hskip 0pt}

\begin{document}

கௌரிப் பாட்டி பொறுமையாய் வெகு நேரம் பஸ்ஸிற்குள் நின்றிருந்தாள். எல்லோரும் இறங்கிய பின், தனது காக்கி நிறப் பையின் கனத்தை இடுப்பில் ஏற்றிக் கொண்டு கடைசியாக வந்தாள்.

``பாட்டி...பாட்டி" பையைத் தூக்கியாரட்டா? ஓரணா குடு பாட்டி."

``வண்டி வேணுங்களா அம்மா?"

``புதுப்பாளையம் வக்கீல் குமாஸ்தா ஐயர் வீடுதானுங்களே....{\wordbk}வாங்க, போவோம்"---என்று பல்வேறு வரவேற்புக் குரல்களுடன் அவளை இறங்கவிடாமல் தடுத்து நின்ற வண்டிக்காரர்களையும், கூலிக்காரச் சிறுவர்களையும் பார்த்துக் கனிவோடு சிரித்துவிட்டுப் பாட்டி சொன்னாள்:

``எனக்கு ஒண்ணும் வேண்டாம்பா..சித்தே வழியை விட்டேள்னா நான் மெள்ள நடந்தே போயிடுவேன்.... ஏண்டாப்பா, வீட்டெக் கூடத் தெரிஞ்சு வெச்சிருக்காய்... நான்தான் மாசம் ஒருதடவை வர்றேனே, என்னிக்கு வண்டியிலே போனேன்?" என்று ஒவ்வொருவருக்கும் ஒவ்வொரு பதிலைச் சொல்லி, அவர்களை விலக்கி வழியமைத்துக் கொண்டு தணலாய்த் தகிக்கும் வெயிலில், முக்காட்டை இழுத்து விட்டுக் கொண்டு, இடுப்பில் ஏற்றிய சுமையுடன் வறுத்துக் கொட்டிய புழுதி மண்ணை அழுந்த அழுந்த மிதித்தவாறு ஒரு பக்கமாய்ச் சாய்ந்து சாய்ந்து நடந்தாள் பாட்டி.

\end{document}

Noto Sans Tamil sample

Davislor
  • 44,045
  • Thank you for this answer. – Shudharson Ragavendirra Oct 14 '20 at 06:19
  • Seems like microtype and babel package does the trick. Also in \defaultfontfeatures, should we compulsorily use Scale=MatchLowercase as there is no Uppercase lowercase features in Tamil script? – Shudharson Ragavendirra Oct 14 '20 at 06:27
  • 1
    @ShudharsonRagavendirra With Scale=MatchUppercase, fontspec will scale the font so the height of uppercase X matches the main font. With Scale=MatchLowercase, fontspec will scale the font so the height of lowercase x matches the main font. If the font has an ASCII alphabet that’s properly-scaled to its Tamil script, it should work fine. In this document, it doesn’t actually have any effect. – Davislor Oct 14 '20 at 15:14
  • 1
    @ShudharsonRagavendirra I usually scale fonts to MatchLowercase because most English text and math variables are lowercase letters, then set the main font [Scale=1.0] so it will appear at its natural height. – Davislor Oct 14 '20 at 15:16
  • 1
    @ShudharsonRagavendirra Short answer: use whatever value of Scale= works best for you. I’ve found Scale=MatchLowercase is a sensible default. – Davislor Oct 14 '20 at 15:21