I am typesetting a document in devanagari and a minimal working example is below:
\documentclass{book}
\usepackage{fontspec}
\usepackage{setspace}
\usepackage{xcolor}
\usepackage{csquotes}
\renewcommand{\baselinestretch}{1.5}
\usepackage{titlesec}
\newcommand{\perror}[1] {{\color{red}#1}}
\newcommand{\psutra}[1] {{\color{blue}#1}}
\begin{document}
\setmainfont[Script=Devanagari]{Sanskrit 2003}
\chapter{प्रथमोऽध्यायः}
\section{पाणिनीयसूत्राणां वैविध्यम्}
एवं महति परिकरे सत्यपि पाणिनीये अपरिहार्यः कशर्चनक्लोशो वर्तते । यतो हि तत्र सूत्राणि षोढा रचितानि । यदाहुः
\par
\centering{\textbf{
संज्ञा च परिभाषा च विधिर्नियम एव च । \\
अतिदेशश्चाधिकारः षड्विधं सूत्रलक्षणम् ।। \\
}}
\section{पाणिनीयस्य महत्त्वम्}
\centering{\textbf{
पाणिनीयं महाशास्त्रं पदसाधुत्वलक्षणम् । \\
सर्वोपकारकं ग्राह्यं कृत्स्नं त्याज्यं न किञ्चन ।। \\
}}
अद्यत्वे शब्दसाधुत्वप्रबोधकं व्याकरणं पाणिनीयमेव । पाणिनिर्महेश्वरं तपसा सन्तोष्य तदनुग्रहेण ``अइउण्" इत्यादिचतुर्दश सूत्राणि उपलभ्य लौकिकवैदिकवाङ्मयोः संपूर्णं व्याकरणं रचयामास । तदेव व्याकरणमधुना अष्टाध्यायीनाम्ना विराजते ।\\ \hfill \break
पाणिनिना सूत्रपाठः धातुपाठः गणपाठः लिङ्गानुशासनं च व्यरच्यत । प्रत्यध्यायं चत्चारः पादाः वर्तन्ते । तत्र सूत्रसंख्या एव वर्तते ।
\end{document}
In the generated pdf, the name for section 1.2 i.e पाणिनीयस्य महत्त्वम्, stretches all the way to the end of the page. How can I enforce that there be only one space between each word in the section name?
~
before daṇḍas. It's a bit annoying, yes, because your Devanagari keyboard might well not have it, but otherwise you get line-breaks at daṇḍas, which is a big no. The line must obviously not start with a daṇḍa. This is especially a problem with the common ॥ १ ॥ style of numbering\textbf{}
is kinda meaningless. Your document looks really nice though, but I'm not sure about the wisdom of having Chapter 1 and then the title being just "first chapter" in Sanskrit. Might be a good idea to look at customising the chapter title if this is an all-Sanskrit text. Anyway, sorry, I couldn't help myself, this was three years of my life :P :Pसंज्ञा च परिभाषा च विधिर्नियम एव च~।
orअतिदेशश्चाधिकारः षड्विधं सूत्रलक्षणम्~॥~१~॥