TeX 相关名词的不完全考察

LuaTeX 的第一次尝试

lyanry posted @ 2007年11月04日 16:07 in 文档标记语言 with tags luatex texlive , 11364 阅读

从 http://foundry.supelec.fr/frs/?group_id=10&release_id=252 可以下载到最新的 luatex beta 版。我用的操作系统是 Gentoo Linux,便下载了 uatex-beta-0.11.2-linux-i386.tar.bz2 包。

将所下载的软件包解开后,得到的就是一个可执行程序 luatex,将它复制到我的 TeX Live 2007 bin/i386-linux 目录下。

随便写一个 TeX 源文档,使用 luatex 进行处理,得到一个错误:luatex.fmt 文件找不到。其实以前我也有过一次尝试,也是因为这个问题阻挡,就消失了试用它的耐心。但是前段时间在 ctex bbs 上 yulewang 给了一些提示,我又找回了一点信心:)

生成 luatex.fmt 的命令如下:

$ luatex --ini tex.ini --jobname=luatex --progname=luatex

执行该命令后,会在终端当前所在目录下生成 luatex.fmt 文件。有了这个文件,只需要执行:

$ luatex -fmt=yourpath/luatex.fmt filename.tex

即可正常编译 TeX 文档了。

我又想起 yulewang 曾经说过一次,使用 fmtutil 可以生成 fmt 文件,但当时事务繁杂,也没有深究。这次 man 了一下 fmtutil,大致知道了它的用法。

TeX Live 有一个配置文件 fmtutil.cnf,位于 $TEXMFVAR 目录下。这个文件可以指导 fmtutil 程序如何生成各种 fmt 文件。要生成 luatex.fmt,在 fmtutil.cnf 文件中找到这样一段内容:

# Standard formats (plain, latex) with all engines:
#
# Change "tex.ini -> bplain.ini" and "- -> language.dat"
# if you want babel support in tex. Add -translate-file=cp227.tcx before
# tex.ini if you want to make all characters directly "printable" for
# any \write (instead of ^^xy).
tex		tex	-		tex.ini
...		...	...		...
xetex		xetex	-		-etex xetex.ini
xelatex		xetex	language.dat	-etex xelatex.ini

在这段代码之后,照葫芦画瓢地添上这样一行:

luatex luatex language.dat tex.ini

然后执行:

$ fmtutil --byfmt=luatex

这样也可以生成 luatex.fmt,并将其放置在 $HOME/$TEXMFVAR 目录下,这样再使用 luatex 编译 TeX 文档时,就不需要显式地设定 -fmt 选项了。

yulewang 给出了一个 luatex 处理中文 TeX 文档的示例,我根据我系统上的 ttf 字体略作改动,如下:

\pdfoutput1
\directlua0{
callback.register('define_font',
    function(name, size)
      filename=kpse.find_file(name,"truetype fonts")
      if (filename) then
        ttffont = fontforge.to_table(fontforge.open(filename))
        if ttffont then
          f = { }
          f.name = ttffont.fontname
          f.fullname = ttffont.names[1].names.fullname
          f.size = size
          f.characters = {}

         for char, glyph in pairs(ttffont.map.map) do
            glyph_table = ttffont.glyphs[glyph]

            f.characters[char] = {
              index = glyph,
              width = glyph_table.width * size/256,
              name = glyph_table.name,
            }
          end
          f.filename = filename
          f.type = 'real'
          f.format = 'truetype'
          f.cidinfo = {
            registry = "Adobe",
            ordering = "Identity",
            supplement = 0,
            version = 1
          }
        end  
      else
        f = font.read_tfm(name, size)
      end
    return f
    end
  )
}

\font\myfont /usr/share/fonts/winfonts/simsun.ttf at 11pt
\font\cmrfont cmr10 at 11pt

\myfont在\cmrfont Lua\TeX{}\myfont中使用中文。
\bye

对于生成的 pdf 文档,我用 evince 阅读时,出现了 “cairo context error: out of memory” 错误。不知何故。

另外也不知道如何使用 luatex 断行。

Avatar_small
yulewang 说:
2007年11月09日 20:22 根据目前的消息,ConTeXt的下一个beta版本(使用LuaTeX 0.15 beta)将解决中文问题。敬请关注。
Avatar_small
lyanry 说:
2007年11月10日 01:53 前几日尝试了一下 ConTeXt + lua,死活搞不定,又要培养自信心了。
Avatar_small
yulewang 说:
2007年11月10日 20:36 >又要培养自信心了。 我怎么老觉得你在不停地折腾一些东西啊。还是把原理搞搞清楚再去操作,这样的话心情舒畅也节省时间。
Avatar_small
lyanry 说:
2007年11月11日 02:03

恩。现在按照 wiki.contextgarden.net 上所说的安装方式搞定了。

Avatar_small
Nursing Papers Writ 说:
2020年2月27日 19:38

Obtaining Nursing Writing Services Online online is fulfilling for most students who have to struggle with deadlines on Custom Nursing Writing Services and Nursing Research Paper Writing Services.

Avatar_small
happy wheels 说:
2020年4月14日 12:55

My insights come from a lot of the knowledge you guys shared above, thank you for all of these things that helped me a lot.

Avatar_small
ch 说:
2023年9月12日 04:30

This is such an awesome asset, to the point that you are giving and you give it away for nothing. I adore seeing blog that comprehend the benefit of giving a quality asset to free. best Breakfast restaurant seminyak

Avatar_small
ch 说:
2023年9月21日 00:53

A debt of gratitude is in order for posting this information. I simply need to tell you that I simply look at your site and I discover it exceptionally fascinating and useful. I can hardly wait to peruse loads of your posts. myforexhelp.com

Avatar_small
ch 说:
2023年11月17日 05:25

Appreciating the time and exertion you put into your site and nitty gritty data you offer!.. custom peptide synthesis companies

Avatar_small
ch 说:
2023年12月09日 03:05

I truly like your thoughts on the issue. I now have an unmistakable thought on what this matter is about.. https://www.fxforextrader.com/forex/using-forex-signals-and-analysis-services

Avatar_small
ch 说:
2024年1月24日 03:18

I am upbeat to locate your recognized method for composing the post. Presently you make it simple for me to comprehend and execute the idea. Much obliged to you for the post. matahari88 login

Avatar_small
ch 说:
2024年2月09日 01:22

This is my first time visit here. From the huge amounts of remarks on your articles,I surmise I am not just one having all the delight right here! counseling Glastonbury CT

Avatar_small
VIRAL99 说:
2024年2月14日 17:13

<a href="https://viral99go.com" rel="dofollow">Viral99</a>
<a href="https://viral99go.com" rel="dofollow">Viral99</a>
<a href="https://viral99go.com" rel="dofollow">Viral99</a>
<a href="https://viral99go.com" rel="dofollow">Viral99</a>
<a href="https://viral99go.com" rel="dofollow">Viral99</a>
<a href="https://viral99go.com" rel="dofollow">Viral99</a>
<a href="https://viral99go.com" rel="dofollow">Viral99</a>
<a href="https://viral99go.com" rel="dofollow">Viral99</a>
<a href="https://viral99go.com" rel="dofollow">Viral99</a>


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter