LaTeX 문서의 일부 부분에 특정 패키지를 사용할 수 있습니까? 아니면 영어와 페르시아어 스타일 사이에 발생할 수 있는 간섭을 어떻게 처리할 수 있습니까?

LaTeX 문서의 일부 부분에 특정 패키지를 사용할 수 있습니까? 아니면 영어와 페르시아어 스타일 사이에 발생할 수 있는 간섭을 어떻게 처리할 수 있습니까?

저는 기본적으로 페르시아어용으로 설정된 템플릿으로 박사 학위 논문을 작성하려고 합니다. 모든 것이 페르시아어일 때 템플릿은 훌륭합니다. 하지만 문제가 있습니다. 내 것을 추가해야 해요Python 부록에 코드를 . 여기에서 링크를 찾았어요tex.stackexchange.com환경과 똑같고 Jupyter아름답습니다.

하지만 이 스타일을 파일에 추가하면 출력 LaTeX 파일의 일부 부분이 중단됩니다.

주요 LaTeX 코드는 다음과 같습니다.

\documentclass[oneside,phd,12pt]{AUTthesis}

\usepackage{graphicx,adjustbox}
\graphicspath{{figures/}} %Setting the graphicspath
\usepackage{amsthm,amssymb,amsmath}
\usepackage[center]{caption}
\usepackage{afterpage}
\usepackage{lscape}
\usepackage{xcolor}
\usepackage{color,soul}
\usepackage{multirow}
\usepackage{float}
\usepackage{pgfplots}
\usepackage{tikz}
\usetikzlibrary{plotmarks}
\usetikzlibrary{arrows.meta,patterns}
\pgfplotsset{compat=1.10}
\usepgfplotslibrary{fillbetween}
\usepgfplotslibrary{units}
\definecolor{findOptimalPartition}{HTML}{D7191C}
\definecolor{storeClusterComponent}{HTML}{FDAE61}
\definecolor{dbscan}{HTML}{ABDDA4}
\definecolor{constructCluster}{HTML}{2B83BA}


\usepackage{array}
\usepackage[skip=0pt]{caption}
\newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}}
\newcommand{\hlgreen}[1]{{\sethlcolor{green}\hl{#1}}}

%%%%%For colorful Jupyter style of Python code
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage[T1]{fontenc}

\usepackage{xcolor}
\definecolor{maroon}{cmyk}{0, 0.87, 0.68, 0.32}
\definecolor{halfgray}{gray}{0.55}
\definecolor{ipython_frame}{RGB}{207, 207, 207}
\definecolor{ipython_bg}{RGB}{247, 247, 247}
\definecolor{ipython_red}{RGB}{186, 33, 33}
\definecolor{ipython_green}{RGB}{0, 128, 0}
\definecolor{ipython_cyan}{RGB}{64, 128, 128}
\definecolor{ipython_purple}{RGB}{170, 34, 255}

\usepackage{listings}
\lstset{
    breaklines=true,
    %
    extendedchars=true,
    literate=
    {á}{{\'a}}1 {é}{{\'e}}1 {í}{{\'i}}1 {ó}{{\'o}}1 {ú}{{\'u}}1
    {Á}{{\'A}}1 {É}{{\'E}}1 {Í}{{\'I}}1 {Ó}{{\'O}}1 {Ú}{{\'U}}1
    {à}{{\`a}}1 {è}{{\`e}}1 {ì}{{\`i}}1 {ò}{{\`o}}1 {ù}{{\`u}}1
    {À}{{\`A}}1 {È}{{\'E}}1 {Ì}{{\`I}}1 {Ò}{{\`O}}1 {Ù}{{\`U}}1
    {ä}{{\"a}}1 {ë}{{\"e}}1 {ï}{{\"i}}1 {ö}{{\"o}}1 {ü}{{\"u}}1
    {Ä}{{\"A}}1 {Ë}{{\"E}}1 {Ï}{{\"I}}1 {Ö}{{\"O}}1 {Ü}{{\"U}}1
    {â}{{\^a}}1 {ê}{{\^e}}1 {î}{{\^i}}1 {ô}{{\^o}}1 {û}{{\^u}}1
    {Â}{{\^A}}1 {Ê}{{\^E}}1 {Î}{{\^I}}1 {Ô}{{\^O}}1 {Û}{{\^U}}1
    {œ}{{\oe}}1 {Œ}{{\OE}}1 {æ}{{\ae}}1 {Æ}{{\AE}}1 {ß}{{\ss}}1
    {ç}{{\c c}}1 {Ç}{{\c C}}1 {ø}{{\o}}1 {å}{{\r a}}1 {Å}{{\r A}}1
    {€}{{\EUR}}1 {£}{{\pounds}}1
}

%%
%% Python definition (c) 1998 Michael Weber
%% Additional definitions (2013) Alexis Dimitriadis
%% modified by me (should not have empty lines)
%%
\lstdefinelanguage{iPython}{
    morekeywords={access,and,break,class,continue,def,del,elif,else,except,exec,finally,for,from,global,if,import,in,is,lambda,not,or,pass,print,raise,return,try,while},%
    %
    % Built-ins
    morekeywords=[2]{abs,all,any,basestring,bin,bool,bytearray,callable,chr,classmethod,cmp,compile,complex,delattr,dict,dir,divmod,enumerate,eval,execfile,file,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,list,locals,long,map,max,memoryview,min,next,object,oct,open,ord,pow,property,range,raw_input,reduce,reload,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,unichr,unicode,vars,xrange,zip,apply,buffer,coerce,intern},%
    %
    sensitive=true,%
    morecomment=[l]\#,%
    morestring=[b]',%
    morestring=[b]",%
    %
    morestring=[s]{'''}{'''},% used for documentation text (mulitiline strings)
    morestring=[s]{"""}{"""},% added by Philipp Matthias Hahn
    %
    morestring=[s]{r'}{'},% `raw' strings
    morestring=[s]{r"}{"},%
    morestring=[s]{r'''}{'''},%
    morestring=[s]{r"""}{"""},%
    morestring=[s]{u'}{'},% unicode strings
    morestring=[s]{u"}{"},%
    morestring=[s]{u'''}{'''},%
    morestring=[s]{u"""}{"""},%
    %
    % {replace}{replacement}{lenght of replace}
    % *{-}{-}{1} will not replace in comments and so on
    literate=
    {á}{{\'a}}1 {é}{{\'e}}1 {í}{{\'i}}1 {ó}{{\'o}}1 {ú}{{\'u}}1
    {Á}{{\'A}}1 {É}{{\'E}}1 {Í}{{\'I}}1 {Ó}{{\'O}}1 {Ú}{{\'U}}1
    {à}{{\`a}}1 {è}{{\`e}}1 {ì}{{\`i}}1 {ò}{{\`o}}1 {ù}{{\`u}}1
    {À}{{\`A}}1 {È}{{\'E}}1 {Ì}{{\`I}}1 {Ò}{{\`O}}1 {Ù}{{\`U}}1
    {ä}{{\"a}}1 {ë}{{\"e}}1 {ï}{{\"i}}1 {ö}{{\"o}}1 {ü}{{\"u}}1
    {Ä}{{\"A}}1 {Ë}{{\"E}}1 {Ï}{{\"I}}1 {Ö}{{\"O}}1 {Ü}{{\"U}}1
    {â}{{\^a}}1 {ê}{{\^e}}1 {î}{{\^i}}1 {ô}{{\^o}}1 {û}{{\^u}}1
    {Â}{{\^A}}1 {Ê}{{\^E}}1 {Î}{{\^I}}1 {Ô}{{\^O}}1 {Û}{{\^U}}1
    {œ}{{\oe}}1 {Œ}{{\OE}}1 {æ}{{\ae}}1 {Æ}{{\AE}}1 {ß}{{\ss}}1
    {ç}{{\c c}}1 {Ç}{{\c C}}1 {ø}{{\o}}1 {å}{{\r a}}1 {Å}{{\r A}}1
    {€}{{\EUR}}1 {£}{{\pounds}}1
    %
    {^}{{{\color{ipython_purple}\^{}}}}1
    {=}{{{\color{ipython_purple}=}}}1
    %
    {+}{{{\color{ipython_purple}+}}}1
    {*}{{{\color{ipython_purple}$^\ast$}}}1
    {/}{{{\color{ipython_purple}/}}}1
    %
    {+=}{{{+=}}}1
    {-=}{{{-=}}}1
    {*=}{{{$^\ast$=}}}1
    {/=}{{{/=}}}1,
    literate=
    *{-}{{{\color{ipython_purple}-}}}1
     {?}{{{\color{ipython_purple}?}}}1,
    %
    identifierstyle=\color{black}\ttfamily,
    commentstyle=\color{ipython_cyan}\ttfamily,
    stringstyle=\color{ipython_red}\ttfamily,
    keepspaces=true,
    showspaces=false,
    showstringspaces=false,
    %
    rulecolor=\color{ipython_frame},
    frame=single,
    frameround={t}{t}{t}{t},
    framexleftmargin=6mm,
    numbers=left,
    numberstyle=\tiny\color{halfgray},
    %
    %
    backgroundcolor=\color{ipython_bg},
    %   extendedchars=true,
    basicstyle=\scriptsize,
    keywordstyle=\color{ipython_green}\ttfamily,
}

\input{commands}

\begin{document}
\baselineskip=.75cm
\linespread{1.75}
\input{fa_title}
\pagenumbering{alph}
%-----------------------------------------------------------------------------

\input{TOC-TOF-LOT}

\pagenumbering{arabic}
\pagestyle{style1}


%--------------------------------------------------------------------------appendix

\chapterfont{\vspace*{-2em}\centering\LARGE}%

\appendix
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\include{appendix1}

\end{document}

그리고 부록은 다음과 같습니다.

\chapter{کد شبیه‌سازی به زبان $Python$ در بستر $Jupyter$\ref{sec5}}\label{PythonCode}
\begin{lstlisting}[language=iPython]
"""
Initial definitions
"""

KSstrategies=['S','N']
CAstrategies=['R','O','D']
ALLstrategies=['SR','SO','SD','NR','NO','ND']
ALLstrategiesCodes={'SR':0,'SO':1,'SD':2,'NR':3,'NO':4,'ND':5}
Theta = 0.2
s = 0.3333
Lambda = 0.4
Etha = 1.15
l = {'Ent':0.08,'Inc':0.08} #[Ent,Inc]
k = {'Ent':Etha*l['Ent'],'Inc':Etha*l['Inc']} #[Ent,Inc]
n={'Ent':0.27,'Inc':0.12} #[Ent,Inc]
r={'Ent':0.2,'Inc':0.15} #[Ent,Inc]
v={'Ent':0.36,'Inc':0.225} #[Ent,Inc]
rho = {'Ent':1.2,'Inc':0.8} #[Ent,Inc]
omega = {'Ent':0.9,'Inc':1.1} #[Ent,Inc]
delta = {'Ent':1.4,'Inc':0.6} #[Ent,Inc]
phi = {'Ent':0.07,'Inc':0.085} #[Ent,Inc]
tau = {'Ent':0.06,'Inc':0.066} #[Ent,Inc]
c={}
c['Inc']={'R':0.09,'O':0.10,'D':0.20} #c[R,O,D]
c['Ent']={'R':0.11,'O':0.12,'D':0.14} #c[R,O,D]
costToQualityRatio = 2
ksnoise = 0.15

"""
Define functions
"""

import numpy as np
def optimumprofitIncLead(qEnt,qInc,Leader):
    if Leader == 'Incumbent':
        #The Incumbent is the leader in pricing
        if qEnt>qInc:
            priceInc = ((qEnt - qInc)*qInc)/(2*(2*qEnt - qInc))
            profitInc = ((qEnt - qInc)*qInc)/(16*qEnt - 8*qInc)
            priceEnt = ((qEnt - qInc)*(4*qEnt - qInc))/(4*(2*qEnt - qInc))
            profitEnt = ((qEnt - qInc)*(-4*qEnt + qInc)**2)/(16*(-2*qEnt + qInc)**2)
        elif qEnt==qInc:
            priceInc = 'Whatever'
            profitInc = 0
            priceEnt = qEnt/2
            profitEnt = qEnt/4
        elif qEnt<qInc:
            priceInc = ((qInc-qEnt)*qInc)/(2*qInc-qEnt)
            profitInc = ((qEnt - qInc)*qInc)/(2*(qEnt - 2*qInc))
            priceEnt = ((qInc-qEnt)*qEnt)/(2*(2*qInc-qEnt))
            profitEnt = (qEnt*qInc*(-qEnt + qInc))/(4*(qEnt - 2*qInc)**2)
    elif Leader == 'Entrant':
        #The New Entrant is the leader in pricing
        if qEnt>qInc:
            priceInc = ((qInc-qEnt)*qInc)/(2*(qInc-2*qEnt))
            profitInc = (qEnt*qInc*(qEnt-qInc))/(4*((2*qEnt-qInc)**2))
            priceEnt = ((qInc-qEnt)*qEnt)/(qInc-2*qEnt)
            profitEnt = ((qEnt - qInc)*qEnt)/(4*qEnt - 2*qInc)
        elif qEnt==qInc:
            priceInc = qInc/2
            profitInc = qInc/4
            priceEnt = 'Whatever'
            profitEnt = 0
        elif qEnt<qInc:
            priceInc = ((qInc - qEnt)*(4*qInc - qEnt))/(4*(2*qInc - qEnt))
            profitInc = ((qInc - qEnt)*(-4*qInc + qEnt)**2)/(16*(-2*qInc + qEnt)**2)
            priceEnt = ((qInc - qEnt)*qEnt)/(2*(2*qInc - qEnt))
            profitEnt = ((qInc - qEnt)*qEnt)/(16*qInc - 8*qEnt)      
    return priceEnt,profitEnt,priceInc,profitInc

def KSpayoff(strategyEnt,strategyInc):
    global payoffEnt, payoffInc
    if strategyEnt=='S' and strategyInc=='S':
        payoffEnt=(1+Theta)*(r['Ent']+r['Inc']+Lambda*s+l['Ent'])-n['Ent']
        payoffInc=(1+Theta)*(r['Ent']+r['Inc']+(1-Lambda)*s+l['Inc'])-n['Inc']
    elif strategyEnt=='S' and strategyInc=='N':
        payoffEnt=(1+Theta)*(r['Ent']-n['Ent'])
        payoffInc=(1-Theta)*(r['Ent']+r['Inc']+v['Inc']+l['Inc'])
    elif strategyEnt=='N' and strategyInc=='S':
        payoffEnt=(1-Theta)*(r['Ent']+r['Inc']+v['Ent']+l['Ent'])
        payoffInc=(1+Theta)*(r['Inc']-n['Inc'])
    elif strategyEnt=='N' and strategyInc=='N':
        payoffEnt=(1-Theta)*(r['Ent']+v['Ent'])
        payoffInc=(1-Theta)*(r['Inc']+v['Inc'])
    return payoffEnt,payoffInc
def CApayoff(CAstrategyEnt,CAstrategyInc,KSstrategyEnt,KSstrategyInc,qEnt,qInc,Leader):
    global payoffEnt, payoffInc
    receivedknowledge = {}
    if KSstrategyEnt == 'N':
        receivedknowledge['Inc'] = 0
    else:
        receivedknowledge['Inc'] = 1 
    if KSstrategyInc == 'N':
        receivedknowledge['Ent'] = 0
    else:
        receivedknowledge['Ent'] = 1 
        
    if CAstrategyEnt=='R' and CAstrategyInc=='R':
        priceEnt,profitEnt,priceInc,profitInc = optimumprofitIncLead(qEnt,qInc,Leader)
        payoffEnt = rho['Ent']*profitEnt-c['Ent']['R']
        payoffInc = rho['Inc']*profitInc-c['Inc']['R']
    elif CAstrategyEnt=='R' and CAstrategyInc=='O':
        qInc += receivedknowledge['Inc']*k['Inc']+c['Inc']['O']/costToQualityRatio-phi['Inc']
        priceEnt,profitEnt,priceInc,profitInc = optimumprofitIncLead(qEnt,qInc,Leader)
        payoffEnt = rho['Ent']*profitEnt-c['Ent']['R']
        payoffInc = omega['Inc']*profitInc-c['Inc']['O']
    elif CAstrategyEnt=='R' and CAstrategyInc=='D':
        qInc += np.tanh(receivedknowledge['Inc']*k['Inc']+c['Inc']['D']/costToQualityRatio-tau['Inc'])
        priceEnt,profitEnt,priceInc,profitInc = optimumprofitIncLead(qEnt,qInc,Leader)
        payoffEnt = rho['Ent']*profitEnt-c['Ent']['R']
        payoffInc = delta['Inc']*profitInc-c['Inc']['D']
    elif CAstrategyEnt=='O' and CAstrategyInc=='R':
        qEnt += receivedknowledge['Ent']*k['Ent']+c['Ent']['O']/costToQualityRatio-phi['Ent']
        priceEnt,profitEnt,priceInc,profitInc = optimumprofitIncLead(qEnt,qInc,Leader)
        payoffEnt = omega['Ent']*profitEnt-c['Ent']['O']
        payoffInc = rho['Inc']*profitInc-c['Inc']['R']
    elif CAstrategyEnt=='O' and CAstrategyInc=='O':
        qEnt += receivedknowledge['Ent']*k['Ent']+c['Ent']['O']/costToQualityRatio-phi['Ent']
        qInc += receivedknowledge['Inc']*k['Inc']+c['Inc']['O']/costToQualityRatio-phi['Inc']
        priceEnt,profitEnt,priceInc,profitInc = optimumprofitIncLead(qEnt,qInc,Leader)
        payoffEnt = omega['Ent']*profitEnt-c['Ent']['O']
        payoffInc = omega['Inc']*profitInc-c['Inc']['O']
    elif CAstrategyEnt=='O' and CAstrategyInc=='D':
        qEnt += receivedknowledge['Ent']*k['Ent']+c['Ent']['O']/costToQualityRatio-phi['Ent']
        qInc += np.tanh(receivedknowledge['Inc']*k['Inc']+c['Inc']['D']/costToQualityRatio-tau['Inc'])
        priceEnt,profitEnt,priceInc,profitInc = optimumprofitIncLead(qEnt,qInc,Leader)
        payoffEnt = omega['Ent']*profitEnt-c['Ent']['O']
        payoffInc = delta['Inc']*profitInc-c['Inc']['D']
    elif CAstrategyEnt=='D' and CAstrategyInc=='R':
        qEnt += np.tanh(receivedknowledge['Ent']*k['Ent']+c['Ent']['D']/costToQualityRatio-tau['Ent'])
        priceEnt,profitEnt,priceInc,profitInc = optimumprofitIncLead(qEnt,qInc,Leader)
        payoffEnt = delta['Ent']*profitEnt-c['Ent']['D']
        payoffInc = rho['Inc']*profitInc-c['Inc']['R']
    elif CAstrategyEnt=='D' and CAstrategyInc=='O':
        qEnt += np.tanh(receivedknowledge['Ent']*k['Ent']+c['Ent']['D']/costToQualityRatio-tau['Ent'])
        qInc += receivedknowledge['Inc']*k['Inc']+c['Inc']['O']/costToQualityRatio-phi['Inc']
        priceEnt,profitEnt,priceInc,profitInc = optimumprofitIncLead(qEnt,qInc,Leader)
        payoffEnt = delta['Ent']*profitEnt-c['Ent']['D']
        payoffInc = omega['Inc']*profitInc-c['Inc']['O']
    elif CAstrategyEnt=='D' and CAstrategyInc=='D':
        qEnt += np.tanh(receivedknowledge['Ent']*k['Ent']+c['Ent']['D']/costToQualityRatio-tau['Ent'])
        qInc += np.tanh(receivedknowledge['Inc']*k['Inc']+c['Inc']['D']/costToQualityRatio-tau['Inc'])
        priceEnt,profitEnt,priceInc,profitInc = optimumprofitIncLead(qEnt,qInc,Leader)
        payoffEnt = delta['Ent']*profitEnt-c['Ent']['D']
        payoffInc = delta['Inc']*profitInc-c['Inc']['D']
    return payoffEnt,payoffInc,qEnt,qInc



\end{lstlisting}

출력에는 세 가지 문제가 있습니다(이미지도 참조하세요).

  1. Python 스타일을 추가하기 전에는 괜찮았던 파일의 일부 페르시아어 부분이 이제 사각형으로 표시됩니다!!!

여기에 이미지 설명을 입력하세요

  1. 컬러링 파이썬 코드 자체는 괜찮지만, 이미지에서 볼 수 있듯이 모든 단어가 거꾸로 표시됩니다. 예를 들어 단어가 이상하게 def표시됩니다 .fed

여기에 이미지 설명을 입력하세요

  1. 숫자는 페르시아어로 표시됩니다. 문서의 나머지 부분에서는 괜찮지만 여기에서는 영어로 작성되었으면 좋겠습니다.

어떤 조언이라도 감사하겠습니다. 감사해요.

관련 정보