Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sanskrit hyphenation is not very good in xelatex as it can possibly not recognize long compound words. I want to override the default hyphenation and hyphenate only where indicated by the \\- command. I have a minimal working example below where I use \usepackage[none]{hyphenat} to disable hyphenation and the sloppyvar environment (without which there is an overflow). I want to disable all default hyphenation except for my \\- command but cannot figure out how to do this. For example I type स्वादमनुभूत\\-वन्तोऽस्याः but the hyphenation is not respected - the entire word is printed on fourth line of page 2, with the third line has extra space. Similarly I do not want सुचरितविग्रहाः to split but it is split. How can I achieve the dual objective of hyphenating where indicated and nowhere else?

\documentclass{article}
\usepackage{graphicx}
\usepackage{polyglossia}
\usepackage{fontspec}
\usepackage{metalogo}
\usepackage{array}
\usepackage[margin=2.5cm]{geometry}
\usepackage{longtable}
\usepackage{setspace}
\usepackage{fancyhdr}
\usepackage{xstring}
\usepackage{draftwatermark}
\usepackage{pdflscape}
\usepackage{ragged2e}
\usepackage[none]{hyphenat}
\setmainlanguage{sanskrit}
\setdefaultlanguage{sanskrit}
\setmainfont[Script=Devanagari]{Arial Unicode MS} 
\newfontfamily\devanagarifont[Script=Devanagari]{Arial Unicode MS}
\newcommand{\devanagarinumeral}[1]{   \devanagaridigits{\number\csname c@#1\endcsname}}
\parindent 0pt
\addtolength{\parskip}{2mm}
\tolerance=500
\raggedbottom
\overfullrule=10pt
\hyphenpenalty=100
\setcounter{secnumdepth}{-1}
\renewcommand{\contentsname}{\centering \Huge अनुक्रमणिका}
\SetWatermarkText{\shortstack[c]{DRAFT2}}
\SetWatermarkLightness{0.95}
\SetWatermarkScale{0.25} 
\renewcommand{\tabcolsep}{0.5pt}
\title{MyDoc}       
\author{Me}     
\date{}
\renewcommand{\thesection}{\devanagarinumeral{section}}
\renewcommand{\thepage}{\Large \devanagarinumeral{page}}
\renewcommand{\theenumi}{\devanagarinumeral{enumi}}
\usepackage{hyperref,bookmark}
\hypersetup{
    pdftitle={MyDoc},
    pdfauthor={Me},
    pdfkeywords={Blah},
    pdfsubject={Blah Blah},
    bookmarksnumbered,
    pdfstartview={FitH},
    colorlinks,
    urlcolor=cyan,
    linkcolor=blue
}
\begin{document}
\renewcommand{\contentsname}{\centering \Huge अनुक्रमणिका}
\tableofcontents
\pagebreak
\fontsize{16}{18}\selectfont
\section[\texorpdfstring{\Large नान्दीवाक्}{Foreword}]{\huge नान्दीवाक्}
\justifying
\begin{longtable}{>{\setlength\parfillskip{0pt}}p{85mm}l}
यावत्स्थास्यन्ति गिरयः सरितश्च महीतले & । \\ \nopagebreak
तावद्रामायणकथा लोकेषु प्रचरिष्यति & ॥ \\ 
\end{longtable}
\vspace{-6mm}
\begin{sloppypar}   इति। सहस्र\-धारा भगवती भागीरथीव संदृश्यते रामकथा\-परम्परा। त एव स्वादमनुभूत\-वन्तोऽस्याः कथाया येऽस्यां निमग्नाः। 
यथाऽपरिमेय\-सलिलाकरस्सागरश्शत\-शताऽवर्तैः प्रनृत्यन्नीर\-चक्रवालैः कशाभिघात\-प्रतीकाशैस्तरङ्गोच्चयैर्डिण्डीर\-बुद्बुदशक्ति\-शङ्खादिभिश्च 
विलक्षणमेव किमपि हरिचन्दन\-नयनासेचनकं जनयन् महतीमभिख्यामुपयाति तथैव भगवतो रामभद्रस्य सुचरितप्रवाहोऽपि कविप्रतिभा\-प्रसूत\-नूतनप्रस्थानैः 
प्रकरण\-वक्रिमभिश्च काप्यपूर्वामेव सारस्वतीं विच्छित्तिं जनयति। कियद्भिरेव प्राचेतसोत्तर\-वर्तिभिः कविपुङ्गवैः 
भास\-कालिदास\-भवभूति\-कुमारदासाभिनन्द\-भट्टि\-मुरारि\-मायुराज\-राजशेखर\-भोजदेव\-जयदेव\-महादेव\-शक्तिभद्र\-विरूपाक्ष\-रामभद्र\-दीक्षित\-मल्लिनाथ\-प्रभृतिभिः दृश्य\-श्रव्य\-राघव\-कथाकारैः  
साभिनवकल्पनं स्वकाव्यानि प्रणीतानि। हन्त। न तथापि निरवकाशा जाता दशरथ\-नन्दन\-यशश्चन्द्रिका। रामकथा अद्यापि कविभिः प्रणीयन्ते प्रणेष्यन्ते 
च भविष्यत्कालेऽपि। यतो हि सार्व\-कालिको रामः। सार्व\-देशिको रामः। सर्वधर्म\-व्याख्येयो  रामः। सर्वसम्प्रदाय\-समाधेयो रामः। 
सर्वभाषा\-साहित्य\-सङ्कीर्तनीयो रामः। एतादृशं लोकवन्दनीयं लोकमर्यादा\-प्रतिमानभूतं निष्कलङ्कं चरितं क्वान्यत्र संदृश्यते। 
पदे पदे सन्ति समराङ्गण\-सूत्रधाराः इतिहास\-वर्णिताः। वदान्यानां लोकोपकार\-प्रवणानां दानदाक्षिण्य\-कलावतंसानां महीपानां लोकधुर्याणाञ्चापि नैयून्यं न संल्लक्ष्यते। 
तथाप्यप्रतिमो रामः। अतुलनीयो रामः। सर्वथाऽनिर्वचनीयो रामः प्रतिभाति। इदमेवाऽस्ति रामचरितस्य सनातनत्वम्। इदमेवास्ति रामचरितस्य सनातनत्वम्। 
इदमेवास्ति राम\-चरितस्याक्षुण्णत्वम्। सर्वेऽपि नायकत्वेनोप\-कल्प्यमानाः सुचरितविग्रहाः कालातीताः प्रतीयन्ते। 
परन्तु नित्य\-कीर्तनीयस्तिष्ठति केवलं वैदेहीजानिर्भगवान् दशरथनन्दन एव। 
येन राम\-कथानुशंसया न पवित्रीकृताऽत्मकाव्य\-प्रतिभा वृथैव जातं तत्कवित्वम्। ततएवाऽद्यापि कवीनुत्कयति रामकथा। \\
\end{sloppypar} 
\end{document}
share|improve this question
    
A MWE would not contain all the packages you have in your example. You need to reduce it so that it only contains the necessary packages to compile the code and reproduce your problem. Also, it is a good idea to use back ticks to format short lines of code like I did in your explanation. –  Vivi Dec 19 '12 at 4:28
    
Sorry for the long delay, but it seems that few people here understand Sanskrit. You can try adding \hyphenrules{no hyphenation} after \begin{sloppypar}, which should inhibit hyphenation except where explicitly allowed with \- –  egreg Apr 6 '13 at 22:09
add comment

1 Answer

up vote 2 down vote accepted

You should try adding

\hyphenrules{nohyphenation}

after \begin{sloppy}, which should inhibit hyphenation except where explicitly allowed with \-.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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