在masters-doctoral-thesis
模板中,在主文件中调用文档类时选择语言,并应用于整个论文。但是,我想在某个特定页面中提到一些阿拉伯语谚语。这可以吗?
这是我的 MWE:
\documentclass[
10=2pt, % The default document font size, options: 10pt, 11pt, 12pt
%oneside, % Two side (alternating margins) for binding by default, uncomment to switch to one side
english, % ngerman for German
singlespacing, % Single line spacing, alternatives: onehalfspacing or doublespacing
%draft, % Uncomment to enable draft mode (no pictures, no links, overfull hboxes indicated)
%nolistspacing, % If the document is onehalfspacing or doublespacing, uncomment this to set spacing in lists to single
liststotoc, % Uncomment to add the list of figures/tables/etc to the table of contents
toctotoc, % Uncomment to add the main table of contents to the table of contents
parskip, % Uncomment to add space between paragraphs
nohyperref, % Uncomment to not load the hyperref package
headsepline, % Uncomment to get a line under the header
%chapterinoneline, % Uncomment to place the chapter title next to the number on one line
%consistentlayout, % Uncomment to change the layout of the declaration, abstract and acknowledgements pages to match the default layout
]{MastersDoctoralThesis} % The class file specifying the document structure
\usepackage[utf8]{inputenc} % Required for inputting international characters
\usepackage[T1]{fontenc} % Output font encoding for international characters
\usepackage{ragged2e}
\usepackage{booktabs,multirow}
\usepackage{tikz}
\usetikzlibrary{arrows,arrows.meta,fit,matrix,shapes,positioning,decorations.pathreplacing,calc,calligraphy,shadows}
\usepackage{svg}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{setspace}
\usepackage{xcolor}
\usepackage{csquotes}
\usepackage{color}
\usepackage{colortbl}
\definecolor{darkgreen}{RGB}{0,100,0}
\definecolor{khrawi2}{RGB}{220,200,90}
\definecolor{khrawi}{RGB}{85,34,0}
\definecolor{yellow}{RGB}{255,255,0}
\definecolor{noir}{RGB}{0,0,0}
\definecolor{gray}{RGB}{200,51,51}
\definecolor{mapink}{RGB}{255,169,169}
\definecolor{mablue}{RGB}{33,190,208}
\definecolor{hotpink}{RGB}{255,105,180}
\colorlet{linkequation}{darkgreen}
\usepackage{enumitem}
\usepackage{nicematrix}
\usepackage{subcaption}
\captionsetup[subfigure]{labelfont=rm}
\usepackage{circuitikz}
\usepackage{lettrine}
\usepackage{geometry}
\usepackage{amssymb}
\usepackage{asymptote}
\usepackage{mathtools}
\usepackage{etoc}
\usepackage{xfrac}
\usepackage{nicefrac}
\usepackage{subcaption}
\usepackage{bigdelim}
\usepackage{datetime}
\usepackage{slashbox}
\usepackage{scalefnt}
\usepackage{float}
\usepackage{tocloft}
\usepackage{mathpazo}
\usepackage[style=ieee,backend=bibtex]{biblatex}
\usepackage[bottom]{footmisc}
\usepackage{array}
%-------------------------------------------------------------------------------------
% MARGIN SETTINGS
%-------------------------------------------------------------------------------------
\geometry{
% papersize={176mm,256mm}
paper=b5paper,left=15mm,right=15mm,top=6mm,bottom=6mm,layouthoffset=3mm,layoutvoffset=3mm
}
\begin{document}
I need a new page here where I say stuff in arabic and then switch back to english
%example of what I want to say in arabic وَيَجهَدُ الناسُ في الدُنيا مُنافَسَةً
% وَلَيسَ لِلناسِ شَيءٌ غَيرَ ما رُزِقوا
\end{document}
答案1
我假设您正在使用此存储库中的文档类:https://github.com/jaredjstewart/Masters-Project,并且...它有很多事情要做,再加上您正在使用的所有软件包,但是有一个快速解决方案(我认为)可能会对您有所帮助。
快速解决方案
arabtex
按照以下说明使用包装背页!代码中唯一需要做的修补是添加上述包、调用utf8
包并设置 Unicode 输入。然后,您可以在名为“ ”的自定义环境中使用阿拉伯语文本RLtext
。代码的该部分应如下所示:
% A lot of packages above
\usepackage{array}
\usepackage{arabtex}
\usepackage{utf8}
%-------------------------------------------------------------------------------------
% MARGIN SETTINGS
%-------------------------------------------------------------------------------------
\geometry{
% papersize={176mm,256mm}
paper=b5paper,left=15mm,right=15mm,top=6mm,bottom=6mm,layouthoffset=3mm,layoutvoffset=3mm
}
\setcode{utf8}
\begin{document}
I need a new page here where I say stuff in arabic and then switch back to english
Example of what I want to say in arabic:
\begin{RLtext}
وَيَجهَدُ الناسُ في الدُنيا مُنافَسَةً
وَلَيسَ لِلناسِ شَيءٌ غَيرَ ما رُزِقوا
\end{RLtext}
But I can do english right away now!
\end{document}
环境RLtext
应该只包含阿拉伯字符,如果在该环境中使用拉丁字符,它们将被丢弃。输出应该如下所示!
如果确实需要将英语和阿拉伯语结合在同一行,可以使用\RL
以下命令:
This text is in \RL{اَلْعَرَبيَّةُ}!
得出的结果是:
更好的解决方案
先前的解决方案依赖于包中定义的字体样式arabtex
,我不确定它的可定制性如何,或者您是否能够使用斜体、粗体等来解决这个问题。处理多语言文本的更好方法是使用另一种字体,这主要在XeTeX
或中完成。大多数 Windows 字体都有几种字体的阿拉伯字符的完整字符映射,因此您可以尝试使用中所示的方法LuaTeX
更改它们fontspec
这个例子使用您喜欢的任何字体,只需按原样粘贴阿拉伯语文本即可,无需进行太多修改!
现在,为了扩展功能,您可能也想修补类中调用的 babel 包MasterDoctoralThesis
,它位于第 129 行,该部分应如下所示:
% A lot above...
%----------------------------------------------------------------------------------------
% REQUIRED PACKAGES
%----------------------------------------------------------------------------------------
\usepackage{babel} % Required for automatically changing names of document elements to languages besides english
\RequirePackage{scrbase} % Required for handling language-dependent names of sections/document elements
\RequirePackage{scrhack} % Loads fixes for various packages
% A lot below...
如果您选择这条路线,您可能需要应用以下补丁。
% A lot above...
%----------------------------------------------------------------------------------------
% REQUIRED PACKAGES
%----------------------------------------------------------------------------------------
\usepackage[utf8]{inputenc}
\usepackage[LAE,LFE]{fontenc}
\usepackage[english,farsi,arabic]{babel} % Required for automatically changing names of document elements to languages besides english
\RequirePackage{scrbase} % Required for handling language-dependent names of sections/document elements
\RequirePackage{scrhack} % Loads fixes for various packages
% A lot below...
这样,您就可以随时随地使用阿拉伯语或任何其他语言,只要\selectlanguage
您在每次需要从英语切换到其他语言时使用即可。此方法的全部范围可以在本手册。
希望有帮助!