標籤:

ApTeX更新:添加kpathsea的mruby支持

使用例( texttt{test-kpse.mrb} ):

Kpathsea.set_program_name("ptex-ng", "")nnprint "$TEXMFDIST = ", Kpathsea.var_value("TEXMFDIST"), "n"nprint "$TEXMFROOT = ", Kpathsea.var_expand("$TEXMFROOT"), "n"nntest0 = ["article.cls", "ujarticle.cls", "hyperref.sty", "tikz.sty"]ntest0.each do |i|n print "#{i} -> #{Kpathsea.find_file(i, Kpathsea::TEX_FORMAT, false)}n"nendnntest1 = ["cmr10", "cmr10.tfm", "upjisr-h.tfm", "upjisr-v.tfm"]ntest1.each do |i|n print "#{i} -> #{Kpathsea.find_file(i, Kpathsea::TFM_FORMAT, false)}n"nendn

執行:

ptex-ng -mrb-load-file test-kpse.mrbn

得到輸出結果:

Asiatic pTeX (compiled time: 2018 Jan 04 15:25:04 with Win64/MSVC)nExecutable PATH: C:texlive2017binwin32ptex-ng.exe.n$TEXMFDIST = C:/texlive/2017/texmf-distn$TEXMFROOT = C:/texlive/2017narticle.cls -> c:/texlive/2017/texmf-dist/tex/latex/base/article.clsnujarticle.cls -> c:/texlive/2017/texmf-dist/tex/uplatex/base/ujarticle.clsnhyperref.sty -> c:/texlive/2017/texmf-dist/tex/latex/hyperref/hyperref.styntikz.sty -> c:/texlive/2017/texmf-dist/tex/latex/pgf/frontendlayer/tikz.styncmr10 -> c:/texlive/2017/texmf-dist/fonts/tfm/public/cm/cmr10.tfmncmr10.tfm -> c:/texlive/2017/texmf-dist/fonts/tfm/public/cm/cmr10.tfmnupjisr-h.tfm -> c:/texlive/2017/texmf-dist/fonts/tfm/uptex-fonts/jis/upjisr-h.tfmnupjisr-v.tfm -> c:/texlive/2017/texmf-dist/fonts/tfm/uptex-fonts/jis/upjisr-v.tfmn

之後還會加一些API進來。這裡面的 texttt{Kpathsea.find_file} 背後的C API實際上就是ApTeX再讀取文件的時候會調用的最重要的一個kpathsea的函數。

之後要加的API,將會是處理TFM/JVF的。

推薦閱讀:

LaTeX 如何在設置行距後讓字體垂直居中?
xelatex編譯加粗楷體為什麼會失敗?
從軟體工程上來說,LaTeX 爛不爛?
LaTeX 如何進行 debug?
解決類似問題,應該學VBA還是Latex?

TAG:LaTeX |