2

Hi

I wrote 2 English title in a Persian text but because of the length of those titles,some Farsi words get out of the line how can I fix this issue ?

my code :

\documentclass{report}

\usepackage{pdfpages}
\usepackage{amsmath}

\usepackage{xepersian}

\usepackage{amssymb}

\usepackage{optidef}
\settextfont{B Zar}

\begin{document}
\section*{نتایج}
در مقاله دقت الگوریتم را روی دو مساله 
\lr{Classification of online blogs} و 
\lr{Bridge condition identification}
اجرا کرده و گزارش دقت آنها را در جدول آورده و نتیجه گرفته است روش این 
مقاله نسبت به روش 
\lr{Laplacian}
بهبود حاصل کرده است .\\
در ادامه این صفحه از مقاله آورده می شود .
\end{document}

and my out put is like this : enter image description here

As you can see in the first line 2 Persian words are not in the right place.

I'm sorry for my dummy questions that's because I'm new in Latex :)

I would appreciate for your solutions.

Captain
  • 51
  • 5
  • Could you include a complete (compilable) and minimal document, instead of just the code snippet? Starting with \documentclass and ending with \end{document}. – ShreevatsaR Jan 22 '18 at 19:57
  • thank you for mentioning that . I edited the code as you said – Captain Jan 22 '18 at 20:55

1 Answers1

3

TeX can't find a good place to break the lines in your paragraph. You could either use a sloppypar environment or adjust \emergencystretch. Notice that this makes the spaces between words a little wide in the first line.

\documentclass{report}
\usepackage{xepersian}
\settextfont{B Zar}
\begin{document}
\section*{نتایج}
\begin{sloppypar}
  در مقاله دقت الگوریتم را روی دو مساله 
  \lr{Classification of online blogs} و 
  \lr{Bridge condition identification}
  اجرا کرده و گزارش دقت آنها را در جدول آورده و نتیجه گرفته است روش این 
  مقاله نسبت به روش 
  \lr{Laplacian}
  بهبود حاصل کرده است .\\
  در ادامه این صفحه از مقاله آورده می شود .
\end{sloppypar}
\setlength{\emergencystretch}{2pt}
\section*{نتایج}
در مقاله دقت الگوریتم را روی دو مساله 
\lr{Classification of online blogs} و 
\lr{Bridge condition identification}
اجرا کرده و گزارش دقت آنها را در جدول آورده و نتیجه گرفته است روش این 
مقاله نسبت به روش 
\lr{Laplacian}
بهبود حاصل کرده است .\\
در ادامه این صفحه از مقاله آورده می شود .
\end{document}

enter image description here

David Purton
  • 25,884
  • 1
    Also, in this particular case, simply increasing \tolerance to anything beyond 225 works (e.g. \tolerance=300). – ShreevatsaR Jan 23 '18 at 06:50