Monday, November 22, 2010

Hyphenating Sanskrit in roman transliteration

%!TeX program = xelatex
%
% Thanks to Yves Codet for the first version of this test file, and to Yves
% and Jonathan Kew for the hyphenation tables
% for Sanskrit (hyph-sa.tex):
%
% This file exemplifies the case where some Sanskrit is embedded in a
% mainly-English document, but the Sanskrit words are appropriately
% hyphenated. The Sanskrit words are in the argument of the
% \textsanskrit{} command.

\documentclass[12pt]{article}

\usepackage{fontspec}
\usepackage{polyglossia}

\setdefaultlanguage{english}
\setmainfont{Charis SIL}

\setotherlanguage{sanskrit}
\newfontfamily\sanskritfont{Charis SIL}

\textwidth=0.5cm
\parindent 0pt

\begin{document}

Sanskrit hyphenation:
\par\smallskip

\textsanskrit{manum ekāgram āsīnam abhigamya maharṣayaḥ |\par}

\bigskip

English hyphenation:
\par\smallskip

manum ekāgram āsīnam abhigamya maharṣayaḥ |

\end{document}