3
0

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 3 years have passed since last update.

メモ:.latexmkrcで出力先のフォルダを指定する

Posted at

はじめに

.latexmkrc を編集することで中間生成物等を指定先のフォルダに保存する方法を忘れないように自分用のメモ。
正直、これから LaTeX 自体使うことがほぼなくなるので みることがあるのか...

やり方

.latexmkrc に$out_dir = (出力先のディレクトリ)を記述してあげれば、指定したディレクトリに保存できる。
$aux_dirを記述すると中間生成物だけを指定したディレクトリに保存できる。
以下、自分の例を載せておきます。(out_dir の部分以外Tex Wikiの設定を引用しています。)

.latecmkrc
if ($^O eq 'MSWin32') {
  $latex = 'platex %O -kanji=utf8 -guess-input-enc -synctex=1 -interaction=nonstopmode %S';
  $bibtex = 'pbibtex %O -kanji=utf8 %B';
  $makeindex = 'mendex %O -U -o %D %S';
  $dvipdf = 'dvipdfmx -f noembed.map %O -o %D %S';
  $dvips = 'dvips %O -z -f %S | convbkmk -g > %D';
  $ps2pdf = 'ps2pdf.bat %O %S %D';
  $pdf_mode = 3;
  $out_dir = 'out'; //$out_dir = %OUTPUTDIR%で出力先を指定 
  if (-f 'C:/Program Files/SumatraPDF/SumatraPDF.exe') {
    $pdf_previewer = '"C:/Program Files/SumatraPDF/SumatraPDF.exe" -reuse-instance';
  } elsif (-f 'C:/Program Files (x86)/SumatraPDF/SumatraPDF.exe') {
    $pdf_previewer = '"C:/Program Files (x86)/SumatraPDF/SumatraPDF.exe" -reuse-instance';
  } else {
    $pdf_previewer = 'texworks';
  }
} else {
  $latex = 'platex %O -synctex=1 -interaction=nonstopmode %S';
  $bibtex = 'pbibtex %O %B';
  $makeindex = 'mendex %O -o %D %S';
  $dvipdf = 'dvipdfmx -f yu.map %O -o %D %S';
  $dvips = 'dvips %O -z -f %S | convbkmk -g > %D';
  $ps2pdf = 'ps2pdf %O %S %D';
  $pdf_mode = 3;
  $out_dir = 'out'; //$out_dir = %OUTPUTDIR%で出力先を指定
}

おわりに

latexmk -hでオプションを調べた時、outdir=dir出力先を指定できることはわかったけど、$outdir = dirだと出力先を変更できなかったのがよくわからない。.latexmkrc の記述ルールについて詳しく書いてあるサイトとかあれば教えてくださるとすごくうれしいです。

参考文献

[Tex Wiki : latexmk] https://texwiki.texjp.org/?Latexmk#ra50ed94
[引数について記述してくれてるQiita記事]Latexmkから学ぶPDF化までの処理の流れ

3
0
0

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
3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?