テキストブラウザを使ってCUIで手軽にpdfの内容を確認する方法
現代を CUI で生き抜く上で大きな障壁となるものの一つが PDF .スキャンしたビットマップデータを変換しただけの躾の悪い屑 PDF はともかく,テキストベースの PDF は中にテキストデータを格納しているので,レンダラを介さずとも中身に直接アクセスできるはず.と思って適当に探したら,
PDFTOHTML conversion program
あった.まさにこれが欲しかった.しかも調べたら既に入っていた. xpdf-utils を入れたときについてきたらしい.
まあとにかく, ~/.zshrc*1 に
p3m() { pdftohtml $1 -stdout | w3m -T text/html; }
などと書いておいてやると,
Yoichiro Nambu - Nobel Lecture, 3.49MB
などの適当な PDF を用意して,
% p3m nambu-slides.pdf
とコマンドを打つだけで,
Y. Nambu, preliminary Notes for the Nobel Lecture I will begin by a short story about my background. I studied physics at the University of Tokyo. I was attracted to particle physics because of the three famous names, Nishina, Tomonaga and Yukawa, who were the founders of particle physics in Japan. But these people were at different institutions than mine. On the other hand, condensed matter physics was pretty good at Tokyo. I got into particle physics only when I came back to Tokyo after the war. In hindsight, though, I must say that my early exposure to condensed matter physics has been quite beneficial to me. 3 / 25
こんな感じに表示される.