我从 overleaf 在线编译器复制的 xelatex 文件有问题。它在 overleaf 上正常工作,没有错误,但是当我在 TexStudio 编辑器上编译它时,它甚至不起作用(我尝试了 XeTex 和 LuaTex)。如何解决这个问题?请点击下面的链接,告诉我为什么这在某些已安装的编辑器上不起作用?代码如下:
\documentclass[12pt]{scrartcl}
\usepackage{silence}
\WarningFilter{latex}{Command \InputIfFileExists}
%%% For accessing system, OTF and TTF fonts
%%% (would have been loaded by polylossia anyway)
\usepackage{fontspec}
\usepackage{xunicode} %% loading this first to avoid clash with bidi/arabic
%%% For language switching -- like babel, but for xelatex
\usepackage{polyglossia}
%%% For those cool-looking menus and keystrokes
\usepackage{menukeys}
%%% For the xelatex (and other LaTeX friends) logos
\usepackage{hologo}
%%% For the awesome fontawesome icons!
\usepackage{fontawesome}
\usepackage[hyphens]{url}
\setmainlanguage{english}
\setotherlanguages{arabic,hindi,sanskrit,greek,thai} %% or other languages
% Main serif font for English (Latin alphabet) text
\setmainfont[Ligatures=TeX]{Noto Serif}
\setsansfont[Ligatures=TeX]{Noto Sans}
\setmonofont{Noto Mono}
% define fonts for other languages
\newfontfamily\arabicfont[Script=Arabic]{Noto Naskh Arabic}
\newfontfamily\devanagarifont[Script=Devanagari]{Noto Serif Devanagari}
% \newfontfamily\greekfont[Script=Greek]{GFS Artemisia}
\newfontfamily\thaifont[Script=Thai]{Noto Serif Thai}
%%% CJK needs a different treatment
\usepackage[space]{xeCJK}
%%% Assuming Chinese is the main CJK language...
\setCJKmainfont[
BoldFont=WenQuanYi Zen Hei,
ItalicFont=AR PL KaitiM GB]
{AR PL SungtiL GB}
\setCJKsansfont{Noto Sans CJK SC}
\setCJKmonofont{cwTeXFangSong}
%%% Define fonts for Japanese and Korean
\newCJKfontfamily\japanesefont{IPAMincho}
%%% You can also upload your own font files
% \newCJKfontfamily\koreanfont{[UnGraphic.ttf]}
%%% ...or go along with a font available on the server
\newCJKfontfamily\koreanfont{Baekmuk Batang}
\title{How to Write Multilingual Text with Different Scripts in \LaTeX}
\author{Lim Lian Tze}
\date{}
\begin{document}
\maketitle
This is a mainly English document which contains other languages. Here we use \texttt{polyglossia} and \texttt{fontspec}.
You'll need to use \hologo{XeLaTeX} or \hologo{LuaLaTeX} to compile this document. You can configure your Overleaf project to be compiled with \hologo{XeLaTeX} by clicking on the Overleaf menu button above the file list panel, and set \texttt{Compiler} to \texttt{XeLaTeX} or \texttt{LuaLaTeX}.
\section{Arabic}
Here's some Arabic text:
%% Arabic lorem ipsum text from http://generator.lorem-ipsum.info/_arabic
%% Note capital "A"rabic
\begin{Arabic}
بعد هامش وإقامة المتحدة و, أم السادس وبالرغم فقد. بعد أن صفحة شمال بداية, أسر حصدت تزامناً ما. ٣٠ نقطة المحيط بمحاولة مكن, مع شمال يتبقّ تحت. خلاف أكثر دون من, الأرض أعلنت فرنسية ٣٠ على.
\end{Arabic}
\section{Hindi}
Here's some Hindi:
%% Hindi lorem ipsum text from http://generator.lorem-ipsum.info/_hindi
\begin{hindi}
जैसी जिम्मे ऎसाजीस दिनांक विवरण जनित बाटते भारतीय विचरविमर्श बढाता विषय वर्णित पुष्टिकर्ता किया बनाने ज्यादा लचकनहि पुर्णता वातावरण व्याख्या संस्क्रुति होभर चिदंश होसके अधिकार उसीएक् बीसबतेबोध अपनि हमेहो। संस्थान उपलब्धता बनाकर करने अपने प्राण समस्याओ बीसबतेबोध उपयोगकर्ता आशाआपस असक्षम बनाति देते बनाने सिद्धांत बीसबतेबोध ढांचामात्रुभाषा कर्य
\end{hindi}
\section{Sanskrit}
And here's some Sanskrit:
\begin{sanskrit}
सर्वे मानवाः स्वतन्त्राः समुत्पन्नाः वर्तन्ते अपि च, गौरवदृशा अधिकारदृशा च समानाः एव वर्तन्ते।
\end{sanskrit}
\section{CJK}
Here's some Chinese:
人有悲欢离合,月有阴晴圆缺。此事古难全,但愿人长久,千里共婵娟。
Japanese:
{\japanesefont 露の世は、露の世ながら、さりながら。}
Korean:
{\koreanfont 피어나는 그들에게 바로 있음으로써 우리는 든 설레는 스며들어 칼이다}
\section{Greek}
Here's some Greek:
%% Lorem ipsum from http://generator.lorem-ipsum.info/_greek
\begin{greek}
Οδιο διστα ιμπεδιτ φιμ ει, αδ φελ αβχορρεανθ ελωκυενθιαμ, εξ εσε εξερσι γυβεργρεν ηας. Ατ μει σολετ σριπτορεμ. Ιυς αλια λαβωρε θε. Σιθ κυωτ νυσκυαμ ιρασυνδια αν, ωμνιυμ ελιγενδι ιν πρι. Παρτεμ φερθερεμ συσιπιαντυρ εξ ιυς, ναμ τωλλιτ ιυφαρεθ αδφερσαριυμ εα, πρω πρωπριαε σαεφολα ιδ. Ατ πρι δολορ νυσκυαμ.
\end{greek}
\section{Thai}
Here's some Thai:
%% Lorem ipsum from http://lorem.in.th/
\begin{thai}
\XeTeXlinebreaklocale "th"
\raggedright
คอรัปชันจุ๊ยโปรดิวเซอร์ สถาปัตย์จ๊าบ แจ็กพ็อต ม้าหินอ่อน ซากุระคันถธุระ ฟีดสตาร์ท งี้ บอยคอตอิ่มแปร้สังโฆคำสาปแฟนซี ศิลปวัฒนธรรมไฟลท์จิ๊กโก๋กับดัก เจลพล็อตมาม่าซากุระดีลเลอร์ ซีนดัมพ์ แฮปปี้ เอ๊าะอุรังคธาตุซิม ฟินิกซ์เทรลเล่อร์อวอร์ด แคนยอนสมาพันธ์ ครัวซองฮัมอาข่าเอ็กซ์เพรส
\end{thai}
\section{How Do I Know What Fonts are Available on Overleaf?}
You can check the list here: \url{https://www.overleaf.com/help/193-what-otf-slash-ttf-fonts-are-supported-via-fontspec}
Tip: We have the Noto fonts!!
We're still in the process of updating the list of font names, so if you're in doubt, just send us an email!
\end{document}