2

I am typesetting a book in XeLaTeX with both Samskrita in Devanagari script and English.

I am trying to include line numbers for proofreading purposes. I want to use the lineno package which works on my system for the following MWE -

\documentclass{book}
\usepackage{lineno}
\usepackage{lipsum}
\begin{document}
\linenumbers
\chapter[One]{One}
\section[One]{One}
\lipsum[1-5]
\end{document}

I tried using the package in a document with both Devanagari and English as follows

\documentclass{book}
\renewcommand{\chaptername}{अध्यायः}
\usepackage{lineno}
\usepackage{polyglossia}
\usepackage{lipsum}
\setmainlanguage{sanskrit}
\setotherlanguage{english}
\setmainfont[Script=Devanagari]{Arial Unicode MS}
\newfontfamily\devanagarifont[Script=Devanagari]{Arial Unicode MS}
\newfontfamily{\englishfont}{Times New Roman}
\newcommand{\devanagarinumeral}[1]{%
   \devanagaridigits{\number\csname c@#1\endcsname}}
\begin{document}
%The following line causes xetex to fail
\linenumbers
\renewcommand{\thechapter}{\devanagarinumeral{chapter}}
\renewcommand{\thesection}{\devanagarinumeral{section}}
\renewcommand{\thepage}{\devanagarinumeral{page}}
\chapter[प्रथमोऽध्यायः]{प्रथमोऽध्यायः}
\section[प्रथमः पादः]{प्रथमः पादः}
\begin{english}
\lipsum[1-5]
\end{english}
\begin{sloppypar}\hyphenrules{nohyphenation}
वेदो वै विगलित\-विभेदो विखात\-खेदो विच्छिन्न\-दोषच्छेदो 
निरस्ताशेष\-भ्रम\-प्रमाद\-विप्रलिप्सा\-करणापाटवादि\-पुंदोष\-शङ्का\-पङ्क\-कलङ्कावकाशो 
...\end{sloppypar}
\end{document}

When I run XeLaTex for the above, I get the following error

! Package polyglossia Error: 
The current roman font does not contain the Devanagari script!
Please define \devanagarifont with \newfontfamily.

Any pointers? How can I use lineno with Devanagari books?

EDIT: The comment by cfr below helped. I added the following line in the preamble and now it works -

\renewcommand\linenumberfont{\normalfont\bfseries\small}

Please consider this solved.

  • 4
    By default, the lineno package sets the font for numbers with \normalfont\tiny\sffamily. You can redefine the font using (e.g. from the documentation) \renewcommand\linenumberfont{\normalfont\bfseries\small}. So you probably just need to use this with a suitable font command which will work with all of the scripts you are using, I'd guess. (I don't have that font, I'm sure, so I can't test with your MWE.) – cfr Jan 9 '14 at 2:14

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.