Skip to content

Instantly share code, notes, and snippets.

@ychubachi
Last active August 3, 2022 11:50
Show Gist options
  • Save ychubachi/b4d08afa295e213f9508e883ec563fb0 to your computer and use it in GitHub Desktop.
Save ychubachi/b4d08afa295e213f9508e883ec563fb0 to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl
# Ref.
# - https://texwiki.texjp.org/?Latexmk#ke005cd5
# Latexmk-upLaTeX の場合
# latexmk -gg -pdfdvi foo.tex
# Latexmk-upLaTeX-pdfps の場合
# latexmk -gg -pdfps foo.tex
# Latexmk-pdfLaTeX の場合
# latexmk -gg -pdf foo.tex
# Latexmk-LuaLaTeX の場合
# latexmk -gg -pdflua foo.tex
# Latexmk-XeLaTeX の場合
# latexmk -gg -pdfxe foo.tex
$latex_option = '%O -shell-escape -synctex=1 -halt-on-error -interaction=nonstopmode -file-line-error %S';
$latex_prefix = 'p'; # 'p' or 'up'
if ($^O eq 'MSWin32') {
$latex = 'latex -kanji=utf8 -no-guess-input-enc ';
} else {
$latex = 'latex';
}
# 最近のlatex関連
$pdflatex = 'pdflatex ' . $latex_option;
$lualatex = 'lualatex ' . $latex_option;
$xelatex = 'xelatex ' . $latex_option;
# platex/uplatex関連
$latex = $latex_prefix . $latex . $latex_option;
$bibtex = $latex_prefix . 'bibtex %O %B'; # 文献作成
# p/up/xe/lua共通
$makeindex = 'upmendex %O -o %D %S'; # 索引作成
# BibLaTexパッケージ用
$biber = 'biber %O --bblenoding=utf8 -u -U --output_safechars %B';
# dvi,ps関連
$dvipdf = 'dvipdfmx %O -o %D %S';
$dvips = 'dvips %O -z -f %S | convbkmk -u > %D';
$ps2pdf = 'ps2pdf %O %S %D';
# pdf/dviプレビュー関連
$pdf_mode = 3;
$preview_continuous_mode = 1;
if ($^O eq 'linux') {
$dvi_previewer = "xdg-open %S";
$pdf_previewer = "xdg-open %S";
} elsif ($^O eq 'darwin') {
$dvi_previewer = "open %S";
$pdf_previewer = "open %S";
} else {
$dvi_previewer = "start %S";
$pdf_previewer = "start %S";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment