Skip to content
This repository has been archived by the owner on Sep 1, 2020. It is now read-only.

Commit

Permalink
Use latexmk (copied from jsk-report-template/jsai-report)
Browse files Browse the repository at this point in the history
  • Loading branch information
wkentaro committed Jun 14, 2018
1 parent 589ae9a commit 6439c91
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 169 deletions.
61 changes: 28 additions & 33 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,46 +1,41 @@
###########################################################
# Thesis Generator for Creative Informatics
# Makefile for compiling a conference / journal paper
# Author: Yuki Furuta <[email protected]>
# Date: 2015/11/12
###########################################################

TARGET := main

.PHONY: all open clean wipe forever preinstall pub publish
OS=$(shell uname -s)
ifeq ($(OS), Linux)
OMAKE_INSTALL=sudo apt-get install -y -qq omake fam
TEX_INSTALL=sudo apt-get install -y -qq texlive texlive-lang-cjk texlive-science texlive-fonts-recommended texlive-fonts-extra xdvik-ja dvipsk-ja gv
endif
ifeq ($(OS), Darwin)
OMAKE_INSTALL=brew install -y opam && opam init -y -j4 -q && eval `opam config env` && opam install omake -y -j4 -q
TEX_INSTALL=brew install -y caskroom/cask/brew-cask && brew cask install -y mactex && sudo tlmgr update --self --all
endif

all: preinstall
omake

forever: preinstall
omake -P
OS := $(shell uname -s)
LATEXMK := $(shell command -v latexmk 2> /dev/null)
LATEXMK_OPTION := -time -recorder -rules
LATEXMK_EXEC := latexmk $(LATEXMK_OPTION)

open: preinstall
omake preview
.PHONY: all install preview clean wipe

publish: preinstall
omake publish
pub: publish
all: install
$(LATEXMK_EXEC) -pvc- $(TARGET)

quiet: preinstall
omake 2>&1 | egrep '^\!.*$$|error|Error|Warning' -C3
preview: install
$(LATEXMK_EXEC) -pv $(TARGET)

todo:
egrep -r -C3 -n --color=auto "nowprinting|TODO" src
forever: install
$(LATEXMK_EXEC) -pvc $(TARGET)

clean: preinstall
omake clean
clean: install
$(LATEXMK_EXEC) -c

wipe: clean
git clean -X -f -i -e '.tex'
wipe: install clean
$(LATEXMK_EXEC) -C
git clean -X -f -i -e '.tex' -e '.tex.orig'

preinstall:
@if ! which omake > /dev/null; then $(OMAKE_INSTALL); fi
@if ! which platex > /dev/null; then $(TEX_INSTALL); fi
install:
ifndef LATEXMK
@echo 'installing components...'
ifeq ($(OS), Linux)
sudo apt install -y -qq texlive texlive-lang-cjk texlive-science texlive-fonts-recommended texlive-fonts-extra xdvik-ja dvipsk-ja gv latexmk
endif
ifeq ($(OS), Darwin)
brew tap caskroom/cask && brew cask install -v mactex && sudo tlmgr update --self --all
endif
endif
91 changes: 0 additions & 91 deletions OMakefile

This file was deleted.

45 changes: 0 additions & 45 deletions OMakeroot

This file was deleted.

13 changes: 13 additions & 0 deletions latexmkrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
$latex = 'platex -interaction=nonstopmode -halt-on-error -shell-escape';
$bibtex = 'pbibtex';
$dvipdf = 'dvipdfmx %O -o %D %S';
$makeindex = 'mendex %O -o %D %S';

$pdf_mode = 3; # for japanese
# $pdf_mode = 1; # for english

if ($^O eq 'darwin') {
$pdf_previewer = 'open -a Preview';
} elsif ($^O eq 'linux') {
$pdf_previewer = 'evince';
}

0 comments on commit 6439c91

Please sign in to comment.