3

I am trying to use xepersian in a thesis that has to be written in English. As soon as I include \usepackage{xepersian} to the document, all numbers and dates are changed to Persian, the title page contents are mostly removed, the fncychap headers are completely gone, etc.

I have never written any documents in two languages before and I am not sure whether any other packages need to be imported (and if English needs to be set as the default language).

Is it possible to import xepersian with minimal changes to the rest of the document? Since I will be only writing a short piece of Persian text, I was thinking of modifying xepersian.sty and commenting unnecessary sub-packages (I understand this is the worst way of achieving my goal).

I have seen solutions based on polyglossia but I am not quite sure how to apply them to the problem in hand.

Here is an MWE that shows how the title page would change as soon as you include the xepersian package (you can take USC-Thesis from the above link; you just need to replace all month with gradmonth and all year with gradyear to avoid conflicts with xepersian. There may be other solutions to avoid such conflict that I am not aware of):

% !TeX program = xelatex
% Compile the thesis with xelatex to ensure unicode characters are printed correctly.
\documentclass{USC-Thesis}

%\usepackage{polyglossia}
%\setdefaultlanguage{english}
%\setotherlanguages{persian}
%\usepackage{bidipoem}
%\usepackage{xepersian}
%\settextfont{XB Niloofar}

\begin{document}


\title{Title}

\author{Author}
\major{Major} 
\gradmonth{April} 
\gradyear{2020}

\maketitle

\topmatter{Acknowledgments}
Thank you.

\tableofcontents    % Table Of Contents
\listoftables       % List of tables
\listoffigures      % List of figures

\mainmatter

\chapter{Introduction}
This is the introduction

\end{document}

I would really appreciate it if you could share your potential solutions with me.

EDIT: As soon as I add the \usepackage{polyglossia}, the title page, page numbers, and all formatting defined in the document class are somehow cleared.

EDIT 2: It looks like it is possible to store some definitions like maketitle before importing polyglossia and restore them afterwards.

5
  • 2
    Polyglossia allows you to write multilingual documents in XeLaTeX and LuaLaTeX: texdoc.net/texmf-dist/doc/latex/polyglossia/polyglossia.pdf. Does it serve?
    – user193767
    Commented Apr 22, 2020 at 6:15
  • I have seen solutions based on polyglossia but I am not quite sure how to apply them to the problem in hand. tex.stackexchange.com/questions/183571/…
    – Matt
    Commented Apr 22, 2020 at 6:16
  • 1
    Post a MWE using your document class. It would be easier to help you
    – user193767
    Commented Apr 22, 2020 at 6:17
  • Sorry for not posting an MWE earlier. I updated the question.
    – Matt
    Commented Apr 22, 2020 at 6:22
  • 1
    @JairoADelRio Similar to xepersian, as soon as I add polyglossia, the title page, page numbers, etc. seem to be overwritten and do not conform to the document class anymore.
    – Matt
    Commented Apr 22, 2020 at 6:33

1 Answer 1

2

This works. However, \gradmonth and \grandyear don't work with the template you've shared even with English only.

%!TEX program = xelatex
\documentclass{USC-Thesis}
\usepackage{polyglossia}
\setdefaultlanguage{english}
%Font for Persian. If you don't specify the script
%letters are displayed disconnected
\newfontfamily\persianfont{Scheherazade}[Script=Arabic]
%The second language
\setotherlanguage{persian}
\begin{document}
\title{Title}
\author{Author}
\major{Major}
%\gradmonth{} does not work. I don't know why
\month{April} 
%\gradyear{} also does not work
\year{2020}

\chapter{First}
\input ward

\input tufte
%Here you can write in Persian
\begin{persian}
%From Wikipedia:Simurgh
سیمُرغ نام یک پرندۀ اسطوره‌ای-افسانه‌ای ایرانی است. شاید بتوان سیمرغ را از مهم‌ترین موجودات در ادب پارسی برشمرد. دانشمندان زیادی از دیرباز به این پرنده در اساطیر ایرانی و شباهتهای آن با مرغان دیگری همچون çyena (شاهین)، گرودای هندی، وارغن، کرشیفت، امرو و کمروی اوستایی، چمروش و کَمَک در ادبیات پهلوی، عنقای عربی، هما و ققنوس در ادب پارسی، فونیکس یونانی، انزوی اکدی، و سیرنگ در ادبیات عامیانه پرداخته‌اند. او نقش مهمی در داستان‌های شاهنامه دارد. کُنام (آشیانه) او کوه اسطوره‌ای قاف است. دانا و خردمند است و به رازهای نهان آگاهی دارد. زال را می‌پرورد و همواره او را زیر بال خویش پشتیبانی می‌کند. به رستم در نبرد با اسفندیاررویین‌تن یاری می‌رساند. جز در شاهنامه دیگر شاعران پارسیگوی نیز سیمرغ را چهرهٔ داستان خود قرار داده‌اند. از جمله منطق الطیر، عطار نیشابوری نیز از آن دسته‌اند. 
\end{persian}
\end{document}

enter image description here

2
  • This works like a charm (please look at the question and its edits to be able to apply this answer to the document class in hand). The only thing is that as soon as I include xepersian, all numbers become Persian instead of Roman and they are written on the left side of the page instead of the right side.
    – Matt
    Commented Apr 22, 2020 at 6:59
  • 1
    The thing is, maybe you shouldn't use xepersian if your main language is English to avoid clashes with the thesis document class.
    – user193767
    Commented Apr 22, 2020 at 7:02

You must log in to answer this question.

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