ghostscript - gs_init.ps がないと言われた

gs_init.ps がない

ps2pdf (https://webkaru.net/linux/pdf2ps-ps2pdf-command/) を使おうとしたら、

GPL Ghostscript 9.19: Can't find initialization file gs_init.ps.

と言われてしまったのでいろいろ解決策を探してみました。
Ghostscript: Ghostscript は私は Homebrew — macOS 用パッケージマネージャー で入れているのですが、どうやらうまくリンクが貼れていない様子でした。

qiita.com これを参考にさせていただいて解決しました。

以下、雑なメモです

ghostscript のバージョン

2017年10月18日時点だと(ちゃんとbrew upgradeしてあるので)バージョン9.22が最新のはずですが9.19のまま。ちゃんとリンクが貼れていない模様。

$ gs -v
GPL Ghostscript 9.19 (2016-03-23)
Copyright (C) 2016 Artifex Software, Inc.  All rights reserved.

現在の ghostscript はどこにいるのか

$ ls -al $(which gs)
(略) 2017 /usr/local/bin/gs -> /usr/local/bin/gs-X11

マシンにインストールしてあるバージョンを調べる

Homebrewでインストールしたのであれば Cellar の中にあるはずです。

$ ls /usr/local/Cellar/ghostscript/
9.20  9.21_3  9.21_4  9.22

9.22が今のところ一番新しいっぽいのでそれに乗り換えることにします。
ちなみに、最新版以外のディレクトリを削除したいと思ったら、

$ brew cleanup

をすると、最新版以外は削除されるのですっきりします。私は久々にやってみたら 4.2GB も掃除できました。

乗り換える

$ ln -s /usr/local/Cellar/ghostscript/9.22/bin/gs /usr/local/bin/gs
$ gs -v
GPL Ghostscript 9.22 (2017-10-04)
Copyright (C) 2017 Artifex Software, Inc.  All rights reserved.

うまくいったみたいです! このあとちゃんと ps2pdf も動きました。

mac で mts 形式を連結して mp4 に変換するまで

iMovie とかは使わずに、ターミナルを立ち上げてフリーソフトをインストールしてコマンドで変換します。

そもそも

mts 形式って、ビデオカメラで撮影した時の動画の拡張子です。いろいろあるんですね。

mts ファイルの連結

ビデオカメラで撮影したファイルがいくつかに分かれていたのでまずはつなげます。
cat コマンドで繋げたいファイルを列挙して、出力先ファイルを > の後に書きます。

$ cat file1.mts file2.mts file3.mts > connected.mts

catコマンドは mts ファイルに限らず、他の拡張子でも連結できます。テキストファイルとか。
で、ファイルを連結したのはいいんですがなぜか Quick Time Player だと「不明なエラー(1718449215)」とかいうのが出てきて再生できないんですよね。 Official Download of VLC media player for Mac OS X - VideoLAN (あの三角コーンのアイコンのアプリ) なら再生できるので、とりあえずよしとしておきましょう笑

mts を mp4 に変換

FFmpeg というツールを使います。macOS 用パッケージマネージャー — macOS 用パッケージマネージャー をつかっているなら

$ brew install ffmpeg

でインストールできて、

$ ffmpeg -i file1.mts -s 1280x720 converted.mp4

これで変換できます。「file1.mts というファイルを、1280x720 のサイズで converted.mp4 というファイルに変換して出力する」という感じです。-i が入力ファイルの設定で、-s が出力サイズの設定ですね。サイズ指定の時は、[幅][小文字のエックス][高さ]で指定できます。
オプションの詳しいところは FFmpeg - Wikipediaffmpeg Documentation (英語) をご覧ください。

動画サイズは自分で好きなように設定できるとはいえ、一般的な動画サイズの方がよさげですね。mts形式だったらビデオカメラで撮っているはずなので元サイズはおそらく 1440x1080 のはず (HDV 1080i というやつ) です。詳しくは以下をどうぞ。

bindcamp.digitalstage.jp

LaTeXで証明木を書くためのおすすめパッケージ

目次:

普通の証明木(?)を書く

普通のproof treeは bussproofs が良さげです。

TeX Live のパッケージ管理のコマンドtlmgrを使って調べると以下のようになります。

$ tlmgr info bussproofs
package:     bussproofs
category:    Package
shortdesc:   Proof trees in the style of the sequent calculus
longdesc:    The package allows the construction of proof trees in the style of the sequent calculus and many other proof systems. One novel feature of the macros is they support the horizontal alignment according to some centre point specified with the command \fCenter. This is the style often used in sequent calculus proofs. The package works in a Plain TeX document, as well as in LaTeX; an exposition of the commands available is given in the package file itself.
installed:   Yes
revision:    27488
sizes:       run: 41k
relocatable: No
cat-version: 1.1
cat-date:    2016-06-24 19:18:15 +0200
cat-license: lppl1.3
cat-topics:  maths proof
cat-related: ebproof
collection:  collection-latexextra

証明木をflag notationで書く

読んでいた教科書が

Type Theory and Formal Proof: An Introduction
(https://www.amazon.co.jp/Type-Theory-Formal-Proof-Introduction/dp/110703650X)

というものだったのですが、本文中の旗記法(flag notation)を LaTeX で書くためのパッケージはないだろうかと探していたらありました。
flagderivというパッケージを入れればできるようです。

$ tlmgr info flagderiv
package:     flagderiv
category:    Package
shortdesc:   Flag style derivation package
longdesc:    The flagderiv package is used to create mathematical derivations using the flag/flagpole notation. The package features an intuitive command syntax, opening and closing multiple flagpoles, different comment styles, customizable symbols and label namespaces.
installed:   No
sizes:       src: 57k, doc: 213k, run: 9k
relocatable: Yes
cat-version: 0.10
cat-date:    2016-06-24 19:18:15 +0200
cat-license: gpl
cat-topics:  maths
collection:  collection-latexextra
$ sudo tlmgr install flagderiv

TeX 行間の調整

一行おきに書きたい、とか行間を調整したいという時に。

一部だけ行間を調整したい

一行おきに書きたい、とかそういうときは特に便利かもしれないです。 setspaceというパッケージを使うとできます。プリアンブルのところに

\usepackage{setspace}

と書いてから、文書本体に

\begin{spacing}{倍率}
行間を調節したい文章をここに書いて!
\end{spacing}

と書けば、\begin\endに挟まれた部分の行間が変更されます。
一行おきに書きたい時は倍率を2.0にすれば楽勝ですね。 それから、箇条書きが意外と幅取っててめんどくさい時も倍率0.9とか0.8にして使えます。

文書全体の行間を調整したい

全体を変更したい時は基本的にプリアンブルで設定を変更すればできます。

\renewcommand{\baselinestretch}{倍率}

と書けばできます。

参考にさせていただきました

空白のコントロールTex tips

qiita.com

www.latex-cmd.com