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.

I am a digital publisher of Sanskrit works. I earlier used pdfLaTeX, but recently I moved to XeLaTeX. I am on Windows using MikTeX 2.9 with TeXWorks 0.4.3. As I am typesetting epic poems with long chapters (cantos) where the fullstops and verse numbers need to align to the right, and the text fully justified, I use the longtable environment. The {p} alignment I use gives the fully justified results as expected in pdfLaTeX, but not in XeLaTeX. I tried searching for a solution but did not find one. Here is a minimum working example:

\documentclass[14pt]{article}
\usepackage{fontspec}
\usepackage{array}
% \setmainfont[Script=Devanagari]{Sanskrit 2003}
% \setmainfont[Script=Devanagari]{Mangal}
\setmainfont[Script=Devanagari]{Arial Unicode MS}
\usepackage[margin=2.5cm]{geometry}
\usepackage{longtable}
\usepackage{setspace}
\begin{document}
\setcounter{secnumdepth}{-1}
\begin{singlespace}
\begin{center}
\section{{\huge ॥ प्रथमः\ सर्गः\ -\ श्रीभार्गवावतारोपक्रमः ॥}}
\parbox{90mm}{Let's see if this is aligned properly.} \\
\parbox{90mm}{And this line as well.} \\
\parbox{90mm}{सीतारामयशोमञ्जुमुक्तामोदमुदं मुदे} \\
\parbox{90mm}{वन्दे वाग्देवतानाम्नीं मरालीं मानसाश्रयाम्} \\
\fontsize{14}{16}\selectfont
\begin{longtable}{p{90mm}l}
सीतारामयशोमञ्जुमुक्तामोदमुदं मुदे & । \\[0mm]
वन्दे वाग्देवतानाम्नीं मरालीं मानसाश्रयाम् & ॥ १ ॥ \\[0mm]
प्रत्यूहव्यूहशैवोहाहारहारस्रगच्युत- & । \\[0mm]
ध्वजं वार्षध्वजं वन्दे हेरम्बं बुद्धिवल्लभम् & ॥ २ ॥ \\[0mm]
वन्दे वन्दारुवृन्दानां पारिजातपदाम्बुजौ & । \\[0mm]
प्रभाभानू इवाभिन्नौ भवानीभूतभावनौ & ॥ ३ ॥ \\[0mm]
\end{longtable}
\end{center}
\end{singlespace}
\end{document}

In the output PDF, I expect all the lines in the first column of the table (except the third one which has only one word) to align both left and right. But the lines are only aligned to the left with varying space to the right.

share|improve this question
2  
sorry I get The font "Sanskrit 2003" cannot be found. which isn't necessarily surprising but could you confirm if you get justified right margin without a table and just do \parbox{90mm}{your sanskrit text...} If the text is justified in a parbox but not in longtable then it must be something longtable is doing wrong (but I can not guess what) if the text does not align even in a simple parbox then it might be a problem with the font metrics. –  David Carlisle Nov 9 '12 at 15:26
    
Welcome to TeX.sx! You don't have to sign with your name since it automatically appears in the lower right corner of your post. –  Stephen Nov 9 '12 at 15:28
    
Thanks David Carlisle and Stephen. I updated the code snippet above and the parbox does not fully justify for roman or devnagari fonts. Also replaced default font with Arial Unicode MS which is present on most systems. If not, Mangal should work as well. Sanskrit 2003 is available for free from sanskritweb.net/itrans/sans2003.zip –  Nityanand Misra Nov 9 '12 at 15:52

1 Answer 1

up vote 4 down vote accepted

Thank you for changing the font and adding the parbox. All the paragraph entries are single line LaTeX does not by default stretch the last line of a paragraph it allows it to be short as is the norm in European languages.

If I set \parfillskip to 0 then even the last line is stretched.

enter image description here

I am sorry, but as I can not read the script I can't say if the result is good or bad, but that is what I get...

This just requires the following change to your code

\begin{longtable}{>{\setlength\parfillskip{0pt}}p{90mm}l}
share|improve this answer
    
Perfect, that worked like a charm. Thanks a lot David. –  Nityanand Misra Nov 9 '12 at 16:07

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.