白猫学生のブログ

自分の趣味をひたすら投稿するブログ

Texmakerの設定 (Windows)

はじめに

Texmakerを最初に設定したとき,ものすごく苦戦したのを今でも覚えています.
当時は設定内容もよくわからずひたすらサイトからコピペしては試してを繰り返していました.(だから苦戦したんだけども・・・)
もしバックアップデータと同時にデータ損失したらまた苦戦しそうなので,記事にして残しておきます.
記事というほど解説もしないし,ただひたすら自分の設定を残しておくだけですけど,Latexをただ使いたいだけの人にとっては参考になると思います.





f:id:KevinArrow:20160905170323g:plain

Latexのインストール

まず,Texmakerをインストールする前に,Latexをインストールしてください.
以下のサイトが非常に便利です.

簡単LaTeXインストールWindows編(2016年4月版)

このサイトはこまめに更新されているのでググってみるといいかもしれません


設定内容

名前 内容
LaTeX uplatex -no-guess-input-enc -synctex=1 -interaction=nonstopmode %.tex
PdfLaTeX pdflatex -synctex=1 -interaction=nonstopmode %.tex
XeLaTeX xelatex -synctex=1 -interaction=nonstopmode %.tex
LuaLaTeX lualatex -synctex=1 -interaction=nonstopmode %.tex luajitlatex -synctex=1 -interaction=nonstopmode %.tex
Latexmk ruby -e "cmd='latexmk -e '+0x22.chr+'$latex=q/uplatex '+0x25.chr+'O'+' -kanji=utf8 -no-guess-input-enc -synctex=1 -interaction=nonstopmode '+0x25.chr+'S'+'/'+0x22.chr+' -e '+0x22.chr+'$bibtex=q/upbibtex '+0x25.chr+'O'+' '+0x25.chr+'B'+'/'+0x22.chr+' -e '+0x22.chr+'$biber=q/biber '+0x25.chr+'O'+' --bblencoding=utf8 -u -U --output_safechars '+0x25.chr+'B'+'/'+0x22.chr+' -e '+0x22.chr+'$makeindex=q/upmendex '+0x25.chr+'O'+' -o '+0x25.chr+'D'+' '+0x25.chr+'S'+'/'+0x22.chr+' -e '+0x22.chr+'$dvipdf=q/dvipdfmx '+0x25.chr+'O'+' -o '+0x25.chr+'D'+' '+0x25.chr+'S'+'/'+0x22.chr+' -norc -gg -pdfdvi '+'%.tex';system(cmd)"
Bib(la)tex biber --bblencoding=utf8 -u -U --output_safechars % upbibtex %
Makeindex upmendex %.idx
dvips ruby -e "cmd='dvips -Ppdf -z -f '+0x22.chr+ARGV[0]+'.dvi'+0x22.chr+' '+0x7c.chr+' '+'convbkmk -u'+' '+0x3e.chr+' '+0x22.chr+ARGV[0]+'.ps'+0x22.chr;system(cmd)" %
Dvipdfm dvipdfmx %.dvi
ps2pdf ps2pdf.exe %.ps
metapost upmpost -interaction=nonstopmode %
Asymptote asy %.asy
ghostscript rungs.exe
R Sweave R CMD Sweave %.Rnw
Dvi Viewer "C:/dviout/dviout.exe" %.dvi
PS Viewer "C:/Program Files/Ghostgum/gsview/gsview32.exe" -e %.ps
PDF Viewer powershell -Command "& {$line=[char]0x22+@+[char]0x22;$tex=[char]0x22+'#.tex'+[char]0x22;$pdf=[char]0x22+'%.pdf'+[char]0x22;$texmaker='C:\Program Files (x86)\Texmaker\texmaker.exe';$f=[char]0x25+'f';$l=[char]0x25+'l';$inverse_search=[char]0x22+[char]0x5c+[char]0x22+$texmaker+[char]0x5c+[char]0x22+' '+[char]0x5c+[char]0x22+$f+[char]0x5c+[char]0x22+' -line '+$l+[char]0x22;$sumatrapdf=[char]0x22+'C:\Program Files (x86)\SumatraPDF\SumatraPDF.exe'+[char]0x22;Start-Process $sumatrapdf -ArgumentList ('-reuse-instance','-inverse-search',$inverse_search,$pdf,'-forward-search',$tex,$line)}" powershell -Command "& {$line=[char]0x22+@+[char]0x22;$tex=[char]0x22+'#.tex'+[char]0x22;$pdf=[char]0x22+'%.pdf'+[char]0x22;$texmaker='C:\Program Files\Texmaker\texmaker.exe';$f=[char]0x25+'f';$l=[char]0x25+'l';$inverse_search=[char]0x22+[char]0x5c+[char]0x22+$texmaker+[char]0x5c+[char]0x22+' '+[char]0x5c+[char]0x22+$f+[char]0x5c+[char]0x22+' -line '+$l+[char]0x22;$sumatrapdf=[char]0x22+'C:\Program Files\SumatraPDF\SumatraPDF.exe'+[char]0x22;Start-Process $sumatrapdf -ArgumentList ('-reuse-instance','-inverse-search',$inverse_search,$pdf,'-forward-search',$tex,$line)}" "C:\Program Files (x86)\SumatraPDF\SumatraPDF.exe" -reuse-instance %.pdf -forward-search #.tex @ "C:\Program Files\SumatraPDF\SumatraPDF.exe" -reuse-instance %.pdf -forward-search #.tex @ powershell -Command "& {$param=[char]0x22+'@:0:#.tex'+[char]0x22; $pdf=[char]0x22+'%.pdf'+[char]0x22; $page=[char]0x25+'{page+1}'; $o=[char]0x27+[char]0x25+'{output}'+[char]0x27; synctex view -i $param -o $pdf -x """texworks --position=$page $o"""}"


f:id:KevinArrow:20160905183124p:plain


For .asy files
"C:/Program Files/Asymptote/asy.exe" -f pdf -noView %.asy|"C:/Program Files/Adobe/Reader 11.0/Reader/AcroRd32.exe" %.pdf

f:id:KevinArrow:20160905183819p:plain


サンプルプログラム

\documentclass[a4paper, uplatex]{jsarticle}

\begin{document}

\section{Test}
ほげほげ \LaTeX

\end{document}



さいごに

Latexの設定は昔と比べて楽になったとはいえ,大変なことには変わりはないと思う