7
11

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

DockerとRe:VIEWで本を書くメモ

Last updated at Posted at 2018-03-04

本を書きたくなる日が来るとして,本の書き方をググったところ,Re:VIEWがヒットしたのでメモ.

gemで必要なアプリをインストールしたり,texliveが新し目である必要が合ったりするので,Dockerでcleanな環境を作りたい.

ぐぐったところ,あった.

これを使えばいい気もするが,全てを把握するという意味で,これを参考にして自分でもやってみた.

Dockerfile
FROM ubuntu:18.04

RUN apt update

# for tex
ENV DEBIAN_FRONTEND noninteractive
RUN apt install -y texlive-latex-extra texlive-fonts-recommended texlive-lang-japanese fonts-lmodern

# for review
RUN apt install -y rbenv ruby-build ruby-dev
RUN gem install review review-peg --no-rdoc --no-ri

# for noto font
RUN apt install -y fonts-noto-cjk fonts-noto-cjk-extra
RUN apt install -y git
RUN git clone https://github.com/vvakame/docker-review.git
RUN mv docker-review/noto /usr/share/texlive/texmf-dist/fonts/map/dvipdfmx/ptex-fontmaps/
RUN rm -rf docker-review
RUN mktexlsr && kanji-config-updmap-sys noto

CMD ["/bin/bash"]

noto fontsはGoogleの人たちが "no more tofu"という意味で作ったフォント.tofuというのは文字化けしたときの白い四角□のことらしい.

使い方

  1. docker imageを作る
  2. Re:VIEWの作業フォルダを作る
    • sudo docker run --rm -it -v `pwd`:/ eisoku9618/kuroiwa_dockefiles_for_review /bin/bash
    • review-init my_book
  3. pdfに変換する
    • sudo docker run --rm -v `pwd`/my_book:/tmp eisoku9618/kuroiwa_dockefiles_for_review /bin/sh -c "cd /tmp && review-pdfmaker config.yml"

これをgitで管理してCIすれば良さそう

編集方法

普通にemacsで編集していくが,こまめに保存してこまめに成果物を見たい.
調べてみたらshellで解決する作戦が合って,
それをワンライナーにした

oneliner
fname="my_book/hoge.re"; last=`ls --full-time $fname | awk '{print $7}'`; while true; do sleep 1; current=`ls --full-time $fname | awk '{print $7}'`; if [ $last != $current ] ; then echo ""; echo "updated: $current"; last=$current; sudo docker run --rm -v `pwd`/my_book:/tmp eisoku9618/kuroiwa_dockefiles_for_review /bin/sh -c "cd /tmp && review-pdfmaker config.yml"; fi; done
7
11
1

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
7
11

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?