1

I'm trying to compile a "*.tex" file(which contains some Persian words)with "TeXLive" using "XeLaTeX".

For example, "Sample.tex" file contains below script which has Persian words. It is running correctly and shows the result:

\documentclass{article} 
\usepackage{xepersian} 
\settextfont{XB Roya} 
\begin{document}
   سلام! 
\end{document}

However, some errors come up when I use the "xpersian" package in my "template.tex" file. The thing is, my template file is a journal template and based on the English language( Springer LaTeX macro package). If I add the "xpersian” package in my template file, I have to change other predefined packages. Is there any other way to address this problem?

1
  • You can subscribe to official Persian TeX mailing list on TUG (TeX Users Group) at: tug.org/mailman/listinfo/persiantex Commented Oct 1, 2018 at 12:10

1 Answer 1

1

When you use the xepersian package,it automatically loads the bidi package for RTL{right to left} environment. So you have to change some of the codes. For english texts or other english codes you can use from the latin environment as the same as below:

\begin{latin}
content...
\end{latin}

For persian text (between english text) you can use from the persian environment as the same as below:

\begin{persian}
           محتوا  
\end{persian}

This will be your output:


enter image description here


For changing the direction of the caption you should use the below structure from the caption package:

\usepackage{caption}
\captionsetup{justification=raggedright,singlelinecheck=false}

This will be your output:


enter image description here

This will be your compound thebibliography output:



But for change the heading, You need to change lines 240 through 249 of svjour3.cls file as follows:

\def\ps@headings{%
\let\@oddfoot\@empty\let\@evenfoot\@empty
\def\@evenhead{\small\rlap{
\csname runheadhook\endcsname}\lr{\leftmark}
\hfil\lr{\thepage}\unskip}%
\def\@oddhead{\small\csname runheadhook\endcsname
\ignorespaces\llap{\lr{\thepage}}\hfil\lr{\rightmark}}
\let\@mkboth\@gobbletwo
\let\sectionmark\@gobble
\let\subsectionmark\@gobble
}

Or put the below codes in preamble after the xepersian package:

\makeatletter
\def\ps@headings{%
    \let\@oddfoot\@empty\let\@evenfoot\@empty
    \def\@evenhead{\small\rlap{
            \csname runheadhook\endcsname}\lr{\leftmark}
        \hfil\lr{\thepage}\unskip}%
    \def\@oddhead{\small\csname runheadhook\endcsname
        \ignorespaces\llap{\lr{\thepage}}\hfil\lr{\rightmark}}
    \let\@mkboth\@gobbletwo
    \let\sectionmark\@gobble
    \let\subsectionmark\@gobble
}
\makeatother
\pagestyle{headings}

This will be your output: enter image description here This is your entire codes:

   \begin{filecontents*}{example.eps}
gsave
newpath
  20 20 moveto
  20 220 lineto
  220 220 lineto
  220 20 lineto
closepath
2 setlinewidth
gsave
  .4 setgray fill
grestore
stroke
grestore
\end{filecontents*}
\RequirePackage{fix-cm}
\documentclass[smallextended]{svjour3}       % 
\smartqed 
\usepackage{graphicx}
\usepackage{caption}
\captionsetup{justification=raggedright,singlelinecheck=false}
\usepackage[%
inlinemathdigits=persian,%
displaymathdigits=persian%
]{xepersian}
\settextfont[Scale=1.1]{XB Niloofar}
\settextdigitfont[Scale=1.1]{Yas}
\setmathdigitfont[Scale=.9]{PGaramond}
%\setlatintextfont[Scale=1.2]{Times New Roman}
\makeatletter
\def\ps@headings{%
    \let\@oddfoot\@empty\let\@evenfoot\@empty
    \def\@evenhead{\small\rlap{
            \csname runheadhook\endcsname}\lr{\leftmark}
        \hfil\lr{\thepage}\unskip}%
    \def\@oddhead{\small\csname runheadhook\endcsname
        \ignorespaces\llap{\lr{\thepage}}\hfil\lr{\rightmark}}
    \let\@mkboth\@gobbletwo
    \let\sectionmark\@gobble
    \let\subsectionmark\@gobble
}
\makeatother
\pagestyle{headings}
\begin{document}
\latin
\title{\lr{Insert your title here}
}
\subtitle{Do you have a subtitle?\\ If so, write it here}

\author{\lr{First Author         \and
        Second Author }%etc.
}

\institute{F. Author \at
              first address \\
              Tel.: +123-45-678910\\
              Fax: +123-45-678910\\
              \email{[email protected]}           %  \\
%             \emph{Present address:} of F. Author  %  if needed
           \and
           S. Author \at
              second address
}

\date{Received: date / Accepted: date}
% The correct dates will be entered by the editor


\maketitle

\begin{abstract}
Insert your abstract here. Include keywords, PACS and mathematical
subject classification numbers as needed.
\keywords{First keyword \and Second keyword \and More}
% \PACS{PACS code1 \and PACS code2 \and more}
% \subclass{MSC code1 \and MSC code2 \and more}
\end{abstract}

\section{Introduction}
\label{intro}
Your text comes here. Separate text sections with
\section{Section title}
\label{sec:1}
Text with citations \cite{RefB} and \cite{RefJ}.
\subsection{Subsection title}
\label{sec:2}
as required. Don't forget to give each section
and subsection a unique label (see Sect.~\ref{sec:1}).
\paragraph{Paragraph headings} Use paragraph headings as needed.
\begin{equation}
a^2+b^2=c^2
\end{equation}

% For one-column wide figures use

\begin{figure}
% Use the relevant command to insert your figure file.
% For example, with the graphicx package use
  \includegraphics{example.eps}
% figure caption is below the figure
\setLTR{\caption{Please write your figure caption here}}
\label{fig:1}       % Give a unique label
\end{figure}
%
% For two-column wide figures use
\begin{figure*}
% Use the relevant command to insert your figure file.
% For example, with the graphicx package use
  \includegraphics[width=0.75\textwidth]{example.eps}
% figure caption is below the figure
\caption{Please write your figure caption here}
\label{fig:2}       % Give a unique label
\end{figure*}
%
% For tables use
\begin{table}
% table caption is above the table
\caption{Please write your table caption here}
\label{tab:1}       % Give a unique label
% For LaTeX tables use
\begin{tabular}{lll}
\hline\noalign{\smallskip}
first & second & third  \\
\noalign{\smallskip}\hline\noalign{\smallskip}
number & number & number \\
number & number & number \\
\noalign{\smallskip}\hline
\end{tabular}
\end{table}

\begin{persian}\noindent
سلام بر شما
من الان می‌توانم لابلای  متن لاتین، متن فارسی ایجاد کنم. این خواسته‌ی من به کمک بسته‌ی زی‌پرشین و همت دکتر وفا خلیقی قابل انجام است.
\end{persian}

\begin{thebibliography}{99}
\linespread{1.5}
\bibitem{RefJ}
Author, Article title, Journal, Volume, page numbers (year)
\bibitem{RefB}
Author, Book title, page numbers. Publisher, place (year)
{\persian
    \bibitem{46} 
    آذرپناه, فریبرز.: نخستین درس در توپولوژی, انتشارات دانشگاه شهید چمران اهواز, 1382.
\bibitem{47}
    دی, کارالامبوس., پرانتز, علی., بورکین شاو, اون.: اصول آنالیز حقیقی, 1389.
\bibitem{45} 
    کوچک‌پور, عبدعلی., نامداری, مهرداد.: مقدمه‌ای بر نظریه‌ی اصولی مجموعه‌ها, انتشارات دانشگاه شهید چمران اهواز, 1394.

}

\end{thebibliography}
\end{document}


  [1]: https://i.sstatic.net/oc674.jpg
  [2]: https://i.sstatic.net/yhzJA.jpg

Good luck.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .