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.

Why doesn't the following long line wrap and how to force it to?

\documentclass[a4paper]{article}
\usepackage{polyglossia}
\setmainlanguage{english}
\setotherlanguage{arabic}

\newfontfamily\arabicfont[Script=Arabic, Scale=1]{Tahoma}

\begin{document}
This is a very long line that normally needs to be wrapped:
\\
\textarabic{\char64474\char64475\char64474\char64475\char64474\char64475\char64474\char64475\char64474\char64475\char64474\char64475\char64474\char64475\char64474\char64475\char64474\char64475\char64474\char64475\char64474\char64475\char64474\char64475\char64380\char64381\char64380\char64381\char64380\char64381\char64380\char64381\char64380\char64381\char64380\char64381\char64380\char64381\char64380\char64381\char64380\char64381\char64380\char64381\char64380\char64381\char64380\char64381\char64380\char64381\char64380\char64381\char64380\char64381\char64380\char64381\char64380\char64381\char64380\char64381\char64380\char64381\char64380\char64381\char64380\char64381\char64380\char64381\char64380\char64381\char64380\char64381\char64380\char64381\char64380\char64381\char64380\char64381\char64380\char64381\char64380\char64381}

Same thing with a space filled character line like this one:
\\
\textarabic{\char64474 \char64475 \char64474 \char64475 \char64474 \char64475 \char64474 \char64475 \char64474 \char64475 \char64474 \char64475 \char64474 \char64475 \char64474 \char64475 \char64474 \char64475 \char64474 \char64475 \char64474 \char64475 \char64474 \char64475 \char64380 \char64381 \char64380 \char64381 \char64380 \char64381 \char64380 \char64381 \char64380 \char64381 \char64380 \char64381 \char64380 \char64381 \char64380 \char64381 \char64380 \char64381 \char64380 \char64381 \char64380 \char64381 \char64380 \char64381 \char64380 \char64381 \char64380 \char64381 \char64380 \char64381 \char64380 \char64381 \char64380 \char64381 \char64380 \char64381 \char64380 \char64381 \char64380 \char64381 \char64380 \char64381 \char64380 \char64381 \char64380 \char64381 \char64380 \char64381 \char64380 \char64381 \char64380 \char64381 \char64380 \char64381 \char64380 \char64381 \char64380 \char64381}
\end{document}
share|improve this question
    
I have edited my MWE accordingly. Please try it now. Same long line. –  Nina Jun 14 '12 at 23:42
2  
\char gobbles the space after it (like almost all TeX primitives), you need to either insert an explicite space \charXXXX\ or end it with an empty group \charXXXX{} (notice the trailing space in both cases). But anyway, why going through the pain of using \char and not inserting the text directly? A side note, don’t ever set Arabic in Tahoma, it is the most hideous popular Arabic typeface (it was designed for low res screens of the 90s). –  Khaled Hosny Jun 15 '12 at 2:13
    
Thank you so much. The space \ character did solve my issue. The reason I am using Tahoma is for inline Arabic text that doesn't defer the spacing between the lines. I know there are much more beautiful fonts such as "Arabic Typesetting" and "KFGQPC Uthman Taha Naskh", but they alter spacing, or otherwise have to be extremely small. –  Nina Jun 15 '12 at 3:30
1  
You may try Amiri font (included in latest TeX Live), or any other good font, after all the main utility of text is to be read comfortably. –  Khaled Hosny Jun 15 '12 at 9:00
    
@Nina: Since Khaled's answer seems to answer your question, please consider marking it as ‘Accepted’ by clicking on the tickmark below its vote count. –  Caramdir Jun 15 '12 at 15:29

1 Answer 1

\char gobbles the space after it (like almost all TeX primitives), you need to either insert an explicit space \charXXXX\  or end it with an empty group \charXXXX{}  (notice the trailing space in both cases).

share|improve this answer
2  
Another way may be \newcommand{\lit}[1]{\char#1 } so that the input can be something like \lit{64474}\lit{64475} \lit{64474}\lit{64475} where spaces mark word breaks. The space after #1 is important. –  egreg Jun 15 '12 at 15:53

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.