
我在嘗試從 texmaker 編譯 xelatex 文件時遇到錯誤。 這是有關我的系統的信息
Ubuntu 侏儒 15.10
Texmaker 4.4.1(從突觸安裝)
texlive-2015 從 dvd iso 完整安裝(不是 debian 軟體包)(以 root 身分安裝)
$ type xelatex
xelatex is /usr/local/texlive/2015/bin/x86_64-linux/xelatex
$ ls -l /usr/local/texlive/2015/bin/x86_64-linux/
lrwxrwxrwx 1 root root 5 Aug 14 2014 xelatex -> xetex
lrwxrwxrwx 1 root root 5 Aug 14 2014 xelollipop -> xetex
-rwxr-xr-x 1 root root 22473712 May 7 2015 xetex
這是我試圖編譯的文檔。 (產生錯誤的最小文檔)
\documentclass[]{article}
\usepackage{polyglossia}
\setmainlanguage{english}
\begin{document}
some text.
\end{document}
這是我嘗試過的
打開文件後,我首先嘗試快速構建,但它按預期失敗,因為 texmaker 設定為使用 pdflatex 快速構建。 fontspec 套件拋出錯誤,要求我使用 xelatex 或 lualatex。現在,我手動選擇“工具”->“Xelatex”。這也是失敗了相同的來自 fonstpec 的錯誤。錯誤訊息是
LOG FILE :
This is pdfTeX, Version 3.14159265-2.6-1.40.16 (TeX Live 2015) (preloaded format=pdflatex 2016.1.15) 23 FEB 2016 19:51
entering extended mode
restricted \write18 enabled.
<< 省略許多行>>
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! Fatal fontspec error: "cannot-use-pdftex"
!
! The fontspec package requires either XeTeX or LuaTeX to function.
!
! You must change your typesetting engine to, e.g., "xelatex" or "lualatex"
! instead of plain "latex" or "pdflatex".
!
! See the fontspec documentation for further information.
!
! For immediate help type H <return>.
!...............................................
l.43 }
|'''''''''''''''''''''''''''''''''''''''''''''''
| This is a fatal error: LaTeX will abort.
|...............................................
我認為 texmaker 可能沒有調用 xelatex 即使我從Tools->XeLatex
選單中選擇了它。現在,我打開一個終端機並輸入
$ xelatex myfile.tex
它編譯沒有錯誤,並給了我一個 pdf 檔。
因此,我搜尋了 net/SE 並找到了舊版本 texmaker 的解決方法。 (在 Texmaker 中使用 XeLaTeX 代替 pdfLaTeX)。按照說明(即使我使用的是 texmaker 4.4.1 版本),我轉到 User->UserCommands 並建立了一個新命令,如下所示
xelatex -synctex=1 -interaction=nonstopmode %.tex
這也呼叫了 pdflatex 並且編譯失敗。所以,我將使用者命令修改為
notify-send sometext | xelatex -synctex=1 -interaction=nonstopmode %.tex
這導致texmaker呼叫notify-send(只是一個在螢幕上顯示彈出視窗的程式),然後呼叫xelatex,編譯成功。
我不知道問題是由 texmaker 引起的(因為終端 xelatex 可以工作),還是由於路徑問題(因為我安裝了非 debian texlive 軟體包並在 xelatex 之前添加了一個虛擬命令,導致 texlive 正確調用 xelatex)
我查看了這些帖子,他們似乎沒有同樣的問題
XeLaTex 和 TexMaker“無法使用 pdftex”