2

Is there a way of switching between Sanskrit typeset in Devanāgarī and IAST, and keeping the automatic hyphenation? See the following examples:

\documentclass{memoir}
\usepackage{polyglossia}
\usepackage{fontspec}
\setdefaultlanguage{english}
\setotherlanguage{sanskrit}
\newfontfamily\sanskritfont{Latin Modern Roman}


% The following does not activate Sanskrit hyphenation:
\newfontfamily
\sanskritdeva[Script=Devanagari,Mapping=RomDev,Scale=2.2]{Sanskrit 2003}
\newcommand{\sd}[1]{{\sanskritdeva{#1}}}

\begin{document}

\begin{sanskrit}
athety ayam adhikārārthaḥ. yogānuśāsanaṃ śāstram adhikṛtaṃ veditavyam. yogaḥ samādhiḥ. sa ca sārvabhaumaś cittasya dharmaḥ. kṣiptaṃ mūḍhaṃ vikṣiptam ekāgraṃ niruddham iti cittabhūmayaḥ. tatra vikṣipte cetasi vikṣepopasarjanībhūtaḥ samādhir na yogapakṣe vartate. yas tv ekāgre cetasi sadbhūtam arthaṃ pradyotayati kṣiṇoti ca kleśān karmabandhanāni ślathayati nirodham abhimukhaṃ karoti sa saṃprajñāto yoga ity ākhyāyate. sa ca vitarkānugato vicārānugata ānandānugato 'smitānugata ity upariṣṭān nivedayiṣyāmaḥ. sarvavṛttinirodhe tv asaṃprajñātaḥ samādhiḥ. 1.1
\end{sanskrit}


\sd{athety ayam adhikārārthaḥ. yogānuśāsanaṃ śāstram adhikṛtaṃ veditavyam. yogaḥ samādhiḥ. sa ca sārvabhaumaś cittasya dharmaḥ. kṣiptaṃ mūḍhaṃ vikṣiptam ekāgraṃ niruddham iti cittabhūmayaḥ. tatra vikṣipte cetasi vikṣepopasarjanībhūtaḥ samādhir na yogapakṣe vartate. yas tv ekāgre cetasi sadbhūtam arthaṃ pradyotayati kṣiṇoti ca kleśān karmabandhanāni ślathayati nirodham abhimukhaṃ karoti sa saṃprajñāto yoga ity ākhyāyate. sa ca vitarkānugato vicārānugata ānandānugato 'smitānugata ity upariṣṭān nivedayiṣyāmaḥ. sarvavṛttinirodhe tv asaṃprajñātaḥ samādhiḥ. 1.1}

\end{document}

enter image description here

Whereas in the following document,

\documentclass{memoir}
\usepackage{polyglossia}
\usepackage{fontspec}
\setdefaultlanguage{english}
\setotherlanguage{sanskrit}
\newfontfamily\sanskritfont[Script=Devanagari,Mapping=RomDev,Scale=2.2]{Sanskrit 2003}

\begin{document}

\begin{sanskrit}
athety ayam adhikārārthaḥ. yogānuśāsanaṃ śāstram adhikṛtaṃ veditavyam. yogaḥ samādhiḥ. sa ca sārvabhaumaś cittasya dharmaḥ. kṣiptaṃ mūḍhaṃ vikṣiptam ekāgraṃ niruddham iti cittabhūmayaḥ. tatra vikṣipte cetasi vikṣepopasarjanībhūtaḥ samādhir na yogapakṣe vartate. yas tv ekāgre cetasi sadbhūtam arthaṃ pradyotayati kṣiṇoti ca kleśān karmabandhanāni ślathayati nirodham abhimukhaṃ karoti sa saṃprajñāto yoga ity ākhyāyate. sa ca vitarkānugato vicārānugata ānandānugato 'smitānugata ity upariṣṭān nivedayiṣyāmaḥ. sarvavṛttinirodhe tv asaṃprajñātaḥ samādhiḥ. 1.1
\end{sanskrit}

\end{document}

we do get the proper hyphenation, as here polyglossia is used to switch to Sanskrit using Devanāgarī script:

enter image description here

(I am aware of the fact that the example could be made easier without the use of the RomDev map and maybe without the use of the Sanskrit 2003 font. Anyway, that is the setup I'm aiming at. I could, if it helps, produce further examples without mapping, with input in unicode Devanāgarī, and using a font that possibly is more easily available.)

Your Answer

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

Browse other questions tagged or ask your own question.