LoginSignup
5
3

More than 5 years have passed since last update.

SATySFIはじめてみる

Last updated at Posted at 2018-05-08

これは何?

未踏で新しい組版ソフトが開発されたらしい。その名はSATySFI
ここではdocフォルダをコンパイル?できるようにするまでをやってみて、いろいろエラーがでてきたから、その解決方法を備忘録的に残してみる。
demoフォルダをコンパイルできればいいんだけど、satysfi-log.jpgっていうのがどこにあるのかわからんから、とりあえずdocをコンパイルしてみた感じです。

環境

Xubuntu 18.04 x86_64 をVirtualBoxで構築。

準備

基本的にはgfngfn/satysfiのREADME-jaのUbuntu及びBuildの項目に準拠します。

OCamlのパッケージマネージャーであるopamをインストールする。

sudo apt-get update
sudo apt-get install build-essential git m4 unzip wget

wget https://raw.github.com/ocaml/opam/master/shell/opam_installer.sh -O - | sh -s /usr/local/bin

opam switch 4.06.0
eval `opam config env`

SATySFIのビルド

opam repository add satysfi-external https://github.com/gfngfn/satysfi-external-repo.git
opam update

# clone
git clone https://github.com/gfngfn/SATySFi.git
cd SATySFi

# build
opam pin add satysfi .
opam install satysfi

docのコンパイル

satysfi/docに移動し、makeを実行してみる。
おそらく、以下のようなエラーが出ます。

$ make
satysfi doc-primitives.saty -o primitives.pdf
 ---- ---- ---- ----
  target file: 'primitives.pdf'
! [Error] package file not found: dist/hash/default-font.satysfi-hash
Makefile:4: recipe for target 'all' failed
make: *** [all] Error 1

これは、ホームディレクトリにライブラリ?が存在しないことから出るエラーのようです。
ホームディレクトリに.satysfiから始まるディレクトリが必要なようです。
そのライブラリの内容は、ここにメモがあります。
とりあえずはcloneしてきたsatysfiのディレクトリにある、lib-satysfi/dist以下を~/.satysfiにコピーすると、動作するようです。
その前にいくつかフォントが必要なようなので、それを先にダウンロードしておきます。

# SATySFIのルートディレクトリに移動します。
make lib

これで、lib-satysfi/dist/fontsにフォントがダウンロードされます。次にこれを、

mkdir ~/.satysfi
cp -r lib-satysfi/dist ~/.satysfi

とします。
再度、SATySFI/docに移動し、makeを実行してみます。

$ make
satysfi doc-primitives.saty -o primitives.pdf
 ---- ---- ---- ----
  target file: 'primitives.pdf'
  dump file: 'primitives.satysfi-aux' (will be created)
  parsing 'doc-primitives.saty' ...
  parsing 'stdja.satyh' ...
  parsing 'pervasives.satyh' ...
  parsing 'gr.satyh' ...
  parsing 'list.satyh' ...
  parsing 'math.satyh' ...
  parsing 'color.satyh' ...
  parsing 'local.satyh' ...
  parsing 'vdecoset.satyh' ...
  parsing 'decoset.satyh' ...
  parsing 'local-math.satyh' ...
 ---- ---- ---- ----
  reading 'list.satyh' ...
  type check passed.
 ---- ---- ---- ----
  reading 'pervasives.satyh' ...
  type check passed.
 ---- ---- ---- ----
  reading 'color.satyh' ...
  type check passed.
 ---- ---- ---- ----
  reading 'gr.satyh' ...
  type check passed.
 ---- ---- ---- ----
  reading 'math.satyh' ...
  type check passed.
 ---- ---- ---- ----
  reading 'decoset.satyh' ...
  type check passed.
 ---- ---- ---- ----
  reading 'vdecoset.satyh' ...
  type check passed.
 ---- ---- ---- ----
  reading 'stdja.satyh' ...
  type check passed.
 ---- ---- ---- ----
  reading 'local-math.satyh' ...
  type check passed.
 ---- ---- ---- ----
  reading 'local.satyh' ...
  type check passed.
 ---- ---- ---- ----
  reading 'doc-primitives.saty' ...
  type check passed. (document)
 ---- ---- ---- ----
  evaluating texts ...
! [Error] package file not found: dist/fonts/Junicode.ttf
Makefile:4: recipe for target 'all' failed
make: *** [all] Error 1

このようなエラー出ます。
まだフォント不足しているようです。最終的に

の3つのフォントを~/.satysfi/dist/fontsに追加しました。
最後にmakeを実行すると。

$ make
satysfi doc-primitives.saty -o primitives.pdf
 ---- ---- ---- ----
  target file: 'primitives.pdf'
  dump file: 'primitives.satysfi-aux' (already exists)
  parsing 'doc-primitives.saty' ...
  parsing 'stdja.satyh' ...
  parsing 'pervasives.satyh' ...
  parsing 'gr.satyh' ...
  parsing 'list.satyh' ...
  parsing 'math.satyh' ...
  parsing 'color.satyh' ...
  parsing 'local.satyh' ...
  parsing 'vdecoset.satyh' ...
  parsing 'decoset.satyh' ...
  parsing 'local-math.satyh' ...
 ---- ---- ---- ----
  reading 'list.satyh' ...
  type check passed.
 ---- ---- ---- ----
  reading 'pervasives.satyh' ...
  type check passed.
 ---- ---- ---- ----
  reading 'color.satyh' ...
  type check passed.
 ---- ---- ---- ----
  reading 'gr.satyh' ...
  type check passed.
 ---- ---- ---- ----
  reading 'math.satyh' ...
  type check passed.
 ---- ---- ---- ----
  reading 'decoset.satyh' ...
  type check passed.
 ---- ---- ---- ----
  reading 'vdecoset.satyh' ...
  type check passed.
 ---- ---- ---- ----
  reading 'stdja.satyh' ...
  type check passed.
 ---- ---- ---- ----
  reading 'local-math.satyh' ...
  type check passed.
 ---- ---- ---- ----
  reading 'local.satyh' ...
  type check passed.
 ---- ---- ---- ----
  reading 'doc-primitives.saty' ...
  type check passed. (document)
 ---- ---- ---- ----
  evaluating texts ...
  evaluation done.
 ---- ---- ---- ----
  breaking contents into pages ...
  all cross references were solved.
 ---- ---- ---- ----
  embedding fonts ...
 ---- ---- ---- ----
  writing pages ...
 ---- ---- ---- ----
  output written on 'primitives.pdf'.

となり、primitives.pdfが生成されます。
XubuntuにはPDFビューワーソフトにAtrilというソフトがインストールされています。

atril primitives.pdf

と、することで生成されたpdfファイルを確認することができます。

demoのコンパイル

前節のprimitives.pdfの生成ができていればdemoのコンパイルもすぐにできる。
satysfi-log.jpgというのが不足しているので、これをダウンロードしてきます。
リポジトリのトップにあるロゴ画像がsatysfi-log.pngなので、これをダウンロードしてきて、

convert satysfi-log.png satysfi-log.jpg

とします。
最後にmakeすると、demo.pdfが生成されます。

まとめ

インストールからpdfの生成までとても簡単にできる。
組版の品質もとても綺麗でTexに匹敵するクオリティだと思う。
フォントのダウンロードと配置は少し手間取ったが、開発中のソフトであるからこの程度は仕方ないと思う。
ところで、Makefileには/usr/local/shareにライブラリが配置されるように書かれているみたいだけど、memoには~/.satysfiに配置するようになっているのはどうしてだろう?
Makefileの整備が間に合ってないのかな?
んー、でもちょっと前まではLIBDIRってやつが~/.satysfiってなってるなー。
まぁいいか。

今回は、demoとdocをビルドしてみたから、次回は自分でファイルを作ってやってみよう。

5
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
3