我是 ConTeXt 世界的新手,但我需要实现的只是能够在 ConTeXt 中排版阿拉伯语/希伯来语文本以及英语文本(Bidi)。我遇到了这上下文花园的一部分与我所追求的内容相关,但在编译时无济于事,没有生成 PDF 并且没有抛出任何错误。
以下步骤按照上面的链接所述进行:
- 创建
ara-sty.tex
文件(代码在上面的同一链接中提供),大概在.tex
文件的同一目录中 - 创建
MWE.tex
以下文件:
MWE:(使用 luatex 编译)
\environment ara-sty
\starttext
\setarabic
هذا نص بالعربية يحتوي على ارقام ١، ٢، ٣ بالعربية أيضاً.
\stoptext
%%% Local Variables:
%%% mode: context
%%% TeX-master: t
%%% TeX-engine: luatex
%%% End:
输出文件
Running `ConTeXt' on `MWE' with ``texexec --once --texutil --engine=luatex --interface=en --passon="--synctex=1" --nonstop MWE.tex''
没有生成 PDF 文件,我这里遗漏了什么?
笔记
- 我们成功地使用 ConTeXt 编译了仅限英文的文件,但问题仅在处理阿拉伯语/希伯来语文本时出现。
context --version
在终端中,mu Ubuntu 机器上的 ConTeXt 版本:current version: 2015.05.18 12:26
luatex --version
终端中的Luatex 版本问题:This is LuaTeX, Version beta-0.80.0 (TeX Live 2015/Debian) (rev 5238)
更新-1
现在我成功地更新了我的计算机上的 ConteXt,如下所述这使用独立安装的 Ubuntu 版 ConTeXtgarden wiki 链接,然后在 中初始化树./baschrc
,现在我安装了以下版本:
语境
mtx-context | ConTeXt Process Management 1.01 mtx-context | mtx-context | main context file: /usr/local/context/tex/texmf-context/tex/context/base/mkiv/context.mkiv mtx-context | current version: 2017.06.27 18:05
路特克斯
This is LuaTeX, Version 1.05.0 (TeX Live 2017)
即使使用最新的稳定版本 ConTeXt,我仍然遇到同样的问题:
current version: 2017.05.15 21:48
所以同样的问题,没有生成 PDF 文件,如有任何帮助我将不胜感激。
更新-2
在谷歌搜索之后,我发现一个问题是我的 Emacs 设置(2017-05-06 的 GNU Emacs 25.2.2(x86_64-pc-linux-gnu,GTK+ 版本 3.18.9))使用 AucTeX 需要进行一些调整,即将变量设置ConTeXt-Mark-version
为"IV"
而不是其默认值"II"
。
在我的点文件(设置 Emacs 文件)中进行全局设置后,如下所示:
(setq ConTeXt-Mark-version "IV")
现在,当我编译 MWE 时,我收到了以下抱怨:(1) 页之后出现问题。
Running `ConTeXt' on `MWE' with ``context --once --texutil --synctex=1 --nonstop MWE.tex''
mtx-context | warning: synctex is enabled
mtx-context | run 1: luatex --fmt="/var/lib/texmf/luatex-cache/context/b47c3d3cee7cb6c86268d0595268c442/formats/luatex/cont-en" --interaction="nonstopmode" --jobname="MWE" --lua="/var/lib/texmf/luatex-cache/context/b47c3d3cee7cb6c86268d0595268c442/formats/luatex/cont-en.lui" --no-parse-first-line --synctex=1 --c:currentrun=1 --c:directives="system.synctex=1" --c:fulljobname="./MWE.tex" --c:input="./MWE.tex" --c:kindofrun=3 --c:maxnofruns=1 --c:nonstopmode --c:once --c:synctex="1" --c:texutil "cont-yes.mkiv"
This is LuaTeX, Version beta-0.80.0 (TeX Live 2015/Debian) (rev 5238)
\write18 enabled.
system > synctex functionality is enabled (1)!
open source > 1 > 1 > /usr/share/texmf/tex/context/base/cont-yes.mkiv
ConTeXt ver: 2015.05.18 12:26 MKIV current fmt: 2016.5.14 int: english/english
system > 'cont-new.mkiv' loaded
open source > 2 > 2 > /usr/share/texmf/tex/context/base/cont-new.mkiv
close source > 2 > 2 > /usr/share/texmf/tex/context/base/cont-new.mkiv
system > files > jobname 'MWE', input './MWE', result 'MWE'
fonts > latin modern fonts are not preloaded
languages > language 'en' is active
open source > 2 > 3 > /home/ffs/.emacs.d/docs/context/MWE.tex
open source > 3 > 4 > ara-sty.tex
tex error > error on line 64 in file ara-sty.tex: ! Undefined control sequence
l.64 \setcharactermirroring
[1]
54 \usetypescript[lm]%
55 \setupbodyfont[lm,20pt]}
56
57 \definestartstop
58 [latinpar]
59 [commands=\Arabic\LatinParDir]
60
61 \define[1]\LT
62 {{\LatinTextDir#1}}
63
64 >> \setcharactermirroring[1]
65
66 \stopenvironment
67
68
69
70 %%% Local Variables:
71 %%% mode: context
72 %%% TeX-master: t
73 %%% End:
74
close source > 3 > 4 > ara-sty.tex
fonts > preloading latin modern fonts (second stage)
fonts > 'fallback modern-designsize rm 12pt' is loaded
fonts > bodyfont '20pt' is defined (can better be done global)
fonts > bodyfont '24pt' is defined (can better be done global)
fonts > bodyfont '16pt' is defined (can better be done global)
backend > xmp > using file '/usr/share/texmf/tex/context/base/lpdf-pdx.xml'
pages > flushing realpage 1, userpage 1
close source > 2 > 4 > /home/ffs/.emacs.d/docs/context/MWE.tex
close source > 1 > 4 > /usr/share/texmf/tex/context/base/cont-yes.mkiv
mkiv lua stats > used config file: /usr/share/texmf/web2c/texmfcnf.lua;/usr/share/texlive/texmf-dist/web2c/texmfcnf.lua
mkiv lua stats > used cache path: readable: '/var/lib/texmf/luatex-cache/context/b47c3d3cee7cb6c86268d0595268c442' | readable+writable: '/home/ffs/.texmf-var/luatex-cache/context/b47c3d3cee7cb6c86268d0595268c442'
mkiv lua stats > synctex tracing: synctex has been enabled (extra log file generated)
mkiv lua stats > resource resolver: loadtime 0.129 seconds, 0 scans with scantime 0.000 seconds, 0 shared scans, 10 found files, scanned paths: <none>
mkiv lua stats > stored bytecode data: 371 modules (0.335 sec), 78 tables (0.009 sec), 449 chunks (0.344 sec)
mkiv lua stats > traced context: maxstack: 1134, freed: 2, unreachable: 1132
mkiv lua stats > running in nuts mode: yes
mkiv lua stats > cleaned up reserved nodes: 44 nodes, 439 lists of 438
mkiv lua stats > node memory usage: 2 glue, 2 penalty, 9 attribute, 35 glue_spec, 3 attribute_list, 2 temp
mkiv lua stats > node list callback tasks: 6 unique task lists, 5 instances (re)created, 44 calls
mkiv lua stats > used backend: pdf (backend for directly generating pdf output)mkiv lua stats > loaded patterns: ar::26 en::2, load time: 0.000
mkiv lua stats > jobdata time: 0.000 seconds saving, 0.000 seconds loading
mkiv lua stats > callbacks: 176 direct, 312 indirect, 488 total
mkiv lua stats > result saved in file: MWE.pdf, compresslevel 3, objectcompresslevel 3
mkiv lua stats > loaded fonts: 2 files: latinmodern-math.otf, lmroman12-regular.otf
mkiv lua stats > fonts load time: 0.263 seconds for 7 fonts, 2 shared in backend, 0 common vectors, 2 common hashes
mkiv lua stats > used platform: linux-64, type: unix, binary subtree: usr
mkiv lua stats > luatex banner: this is luatex, version beta-0.80.0 (tex live 2015/debian) (rev 5238)
mkiv lua stats > control sequences: 44153 of 65536 + 100000
mkiv lua stats > lua properties: engine: lua, used memory: 90 MB (ctx: 90 MB), hash type: lua, hash chars: min(64,40), symbol mask: utf (τεχ)
mkiv lua stats > runtime: 0.680 seconds, 1 processed pages, 1 shipped pages, 1.471 pages/second
SyncTeX written on MWE.synctex.gz.
mtx-context | fatal error: return code: 1
TeX Output exited abnormally with code 1 at Thu Jun 29 03:50:01
我从上面的错误消息中注意到我的 luatex 是 2015,而不是如本文前面所示更新到 2017,所以我该如何解决这个问题?
答案1
[免责声明:我既不会说阿拉伯语,也不懂阿拉伯文字。]
我从中复制了相关内容来设置阿拉伯字体ara-sty.tex
。这是字体功能和设置从右到左模式。然后我为阿拉伯语 Amiri 字体编写了一个打字稿,并将拉丁字符回退到 Latin Modern。它与 TL2017 上的 ConTeXt MKIV 配合使用,但我不知道这是否是您想要的。
\definefontfeature
[arabic]
[mode=node,language=dflt,script=arab,
init=yes,medi=yes,fina=yes,isol=yes,
liga=yes,dlig=yes,rlig=yes,clig=yes,
mark=yes,mkmk=yes,kern=yes,curs=yes]
\definefontfallback
[latin-fallback]
[file:lmroman12-regular*default]
[basiclatin,
latin-1supplement,
latinextended-A,
latinextendedadditional]
[force=yes]
\starttypescriptcollection [amiri]
\starttypescript [serif] [amiri]
\definefontsynonym [Serif] [file:amiri-regular.ttf] [features=arabic]
\definefontsynonym [SerifItalic] [file:amiri-slanted.ttf] [features=arabic]
\definefontsynonym [SerifBold] [file:amiri-bold.ttf] [features=arabic]
\definefontsynonym [SerifBoldItalic] [file:amiri-boldslanted.ttf] [features=arabic]
\stoptypescript
\starttypescript [amiri]
\definetypeface [\typescriptone] [rm] [serif] [amiri] [default] [fallbacks=latin-fallback]
\definetypeface [\typescriptone] [ss] [sans] [modern] [default]
\definetypeface [\typescriptone] [tt] [mono] [modern] [default]
\definetypeface [\typescriptone] [mm] [math] [modern] [default]
\stoptypescript
\stoptypescriptcollection
\starttypescriptcollection [sblhbrw]
\starttypescript [serif] [sblhbrw]
\definefontsynonym [Serif] [file:SBL_Hbrw.ttf] [features=arabic]
\stoptypescript
\starttypescript [sblhbrw]
\definetypeface [\typescriptone] [rm] [serif] [sblhbrw] [default] [fallbacks=latin-fallback]
\definetypeface [\typescriptone] [ss] [sans] [modern] [default]
\definetypeface [\typescriptone] [tt] [mono] [modern] [default]
\definetypeface [\typescriptone] [mm] [math] [modern] [default]
\stoptypescript
\stoptypescriptcollection
\setupbodyfont[amiri]
\setupbodyfont[sblhbrw]
\setupbodyfont[modern]
\define\setarabic{%
\pagedir TRT \bodydir TRT \pardir TRT \textdir TRT
\switchtobodyfont[amiri]
}
\define\sethebrew{%
\pagedir TRT \bodydir TRT \pardir TRT \textdir TRT
\switchtobodyfont[sblhbrw]
}
\define\setlatin{%
\pagedir TLT \bodydir TLT \pardir TLT \textdir TLT
\switchtobodyfont[modern]
}
\starttext
\setarabic
هذا نص بالعربية يحتوي على ارقام ١، ٢، ٣ بالعربية أيضاً.
{\it هذا نص بالعربية يحتوي على ارقام ١، ٢، ٣ بالعربية أيضاً.}
{\bf هذا نص بالعربية يحتوي على ارقام ١، ٢، ٣ بالعربية أيضاً.}
{\bi هذا نص بالعربية يحتوي على ارقام ١، ٢، ٣ بالعربية أيضاً.}
\setlatin
\input lorem
\sethebrew
אברית
\stoptext