4

I would like to be able to select, via polyglossia, Sanskrit in Roman script, and thus get some reasonable default hyphenation rules, as there are, in order of priority:

  • ai, au, kh, gh, ch, jh, ṭh, ḍh, th, dh, ph, bh are to be considered as single letters and should never be hyphenated.
  • Hyphenation is permissible after each vowel (a, ā, i, ī, u, ū, , , , , e, ai, o, au), if not followed by Anusvāra () or Visarga (), in which case hyphenation is permissible after these two modifiers only.

  • One could think of an expandable list of strings after which hyphenation also after a consonant would be o.k., coming to mind are prefixes such as sam, nir, abhy, maybe twenty of them, but also words appearing in compounds (a typical feature of Sanskrit), at the inclusion of which the task of building up such a list becomes endless.

Already the first two of these would ease the work of countless Sanskritists working with transliterated Sanskrit, so far needing to take care of hyphenation manually via discretionary hyphens. I would not mind starting this work, but I would need some pointers, and I would also like to hear ideas of other Indologists regarding this.

Update: Trying to get the existing pattern to load:

\documentclass{article}
\usepackage{fontspec}
\usepackage{polyglossia}
\setdefaultlanguage{english}
\setotherlanguage{sanskrit}
\newfontfamily\devanagarifont{FreeSerif}
\begin{document}
something

\begin{sanskrit}
kiṃcit
\end{sanskrit}

\end{document}

I get the following relevant lines in my log:

(/usr/local/texlive/2015/texmf-dist/tex/latex/polyglossia/gloss-english.ldf)
(/usr/local/texlive/2015/texmf-dist/tex/latex/polyglossia/gloss-sanskrit.ldf
(/usr/local/texlive/2015/texmf-dist/tex/latex/polyglossia/devanagaridigits.sty)


Package polyglossia Warning: No hyphenation patterns were loaded for `Sanskrit'

(polyglossia)                I will use \language=\l@nohyphenation instead on input line 11.


Package polyglossia Warning: \setlocalhyphenmin useless for unhyphenated language sanskrit on input line 11.

EDIT:

My laptop doesn't have a full TeX Live install, but tlmgr install hyphen-sanskrit does the necessary changes in (I believe) language.dat and language.def, and then a fmtutil --all will regenerate the format file. After that it seems to work.

  • This would need a set of hyphenation patterns; hints about how to prepare it when the rules are defined are on topic, but a discussion about the rules themselves is off topic. – egreg Oct 7 '15 at 22:47
  • 1
    @egreg Do I understand correctly that I would have to prepare a file with a list of hyphenated words which would then be fed to patgen, creating a pattern file with which tex could work? Sounds a bit different than a set of rules, but could one then start with my first two points as the rules and later refine it? Where can I see example of such files? Regarding the rules, yes, they wouldn't need to be subject of discussion here, I can check them with a few profs, let's hope they can agree on something, otherwise one might want to create different dialects. – muk.li Oct 8 '15 at 1:47
  • You don’t need patgen to make a new set of hyphenation patterns, you can write them by hand. Many languages do that – patgen is mostly useful when you have a list of hyphenated words, which is not your case. Also, there already are patterns for transliterated Sanskrit, which seem to implement more or less the rules you describe. They’re part of the Sanskrit patterns (that support many scripts, including Latin). – Arthur Reutenauer Oct 14 '15 at 0:09
  • @ArthurReutenauer That would be in gloss-sanskrit.ldf ? I am seeing many Indian scripts defined there but not latin. If I do a \setotherlanguage{sanskrit} and then \begin{sanskrit} then I get ! Package polyglossia Error: The current roman font does not contain the Devanagari script!, if I try \begin{sanskrit}[Script=Latin], then ! Package polyglossia Error: ``Latin' is not a valid script for Sanskrit.. I've added a minimum example, see above. – muk.li Oct 14 '15 at 2:56
  • No, the patterns are defined in files called hyph-*.tex, for Sanskrit it’shyph-sa.tex. As you’ve found out Latin transliteration is not taken care of by Polyglossia, that’s something I need to add; for the moment you can work around it by using a font that has both Devanagari and Latin, such as FreeSerif, and defining \newfontfamily\devanagarifont{FreeSerif}. – Arthur Reutenauer Oct 14 '15 at 3:05
1

As has been pointed out in the comments to the question, the hyphenation pattern for Sanskrit can also deal with transliteration. The following is an example, avoiding the devanagari font warning:

\documentclass{article}
\usepackage{fontspec}
\usepackage{polyglossia}
\setdefaultlanguage{english}
\setotherlanguage{sanskrit}
\newfontfamily\sanskritfont{Latin Modern Roman}
\begin{document}
something

\begin{sanskrit}
kiṃcit 

\end{sanskrit}

\end{document}

It would be nice however if one would not need the

\newfontfamily\sanskritfont{Latin Modern Roman}

line, as for switching, e.g. between English and German one doesn't need to deal with fonts.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.