[[Mery]] > マクロ

&color(White,#5F2F2F){  ''◆目次◆''  };&br;

#contents

*マクロ [#oa5f5cea]

マクロを使うと LaTeX 環境を簡単に作ることができます.~
マクロは,メニューの [マクロ(M)] から選択または F4 キーで実行できます.~

-[[マクロリファレンス - MeryWiki:http://www.haijin-boys.com/wiki/%E3%83%9E%E3%82%AF%E3%83%AD%E3%83%AA%E3%83%95%E3%82%A1%E3%83%AC%E3%83%B3%E3%82%B9]]
-[[マクロライブラリ - MeryWiki:http://www.haijin-boys.com/wiki/%E3%83%9E%E3%82%AF%E3%83%AD%E3%83%A9%E3%82%A4%E3%83%96%E3%83%A9%E3%83%AA]]
--[[TeX文書のコンパイル - MeryWiki:http://www.haijin-boys.com/wiki/TeX%E6%96%87%E6%9B%B8%E3%81%AE%E3%82%B3%E3%83%B3%E3%83%91%E3%82%A4%E3%83%AB]]
--[[TeX数式のチェック - MeryWiki:http://www.haijin-boys.com/wiki/TeX%E6%95%B0%E5%BC%8F%E3%81%AE%E3%83%81%E3%82%A7%E3%83%83%E3%82%AF]]
-[[Meryのマクロ実験室:http://merysmacro.seesaa.net/]]
-[[まるエミュ for Mery:http://homepage3.nifty.com/kinzoku/editor/]]

**pdfpLaTeX.js [#w4e337a9]
**Typeset.js [#w4e337a9]

----
 (function () {
   var c = document.Path;
   var b = new ActiveXObject("Scripting.FileSystemObject").GetBaseName(document.Name);
   var cd = "cd /d " + ["\"", c, "\""].join("");
   var ptex2pdf = "ptex2pdf -l -ot \"-synctex=1 -guess-input-enc -sjis-terminal\"";
   var encoding = document.Encoding;
   if (encoding == meEncodingUTF8WithoutSignature || encoding == meEncodingUTF8WithSignature || encoding == meEncodingUTF8) {
     ptex2pdf = "ptex2pdf -l -ot \"-synctex=1 -no-guess-input-enc -kanji=utf8 -sjis-terminal\"";
   } else if (encoding == meEncodingShiftJIS) {
     ptex2pdf = "ptex2pdf -l -ot \"-synctex=1 -no-guess-input-enc -kanji=sjis -sjis-terminal\"";
   } else if (encoding == meEncodingEUC) {
     ptex2pdf = "ptex2pdf -l -ot \"-synctex=1 -no-guess-input-enc -kanji=euc -sjis-terminal\"";
   } else if (encoding == meEncodingJIS) {
     ptex2pdf = "ptex2pdf -l -ot \"-synctex=1 -no-guess-input-enc -kanji=jis -sjis-terminal\"";
   }
   ptex2pdf += " " + ["\"", b, "\""].join("");
   var cmd = "cmd /c " + cd + " && " + ptex2pdf;
     var menu = CreatePopupMenu();
     menu.Add("pLaTeX (ptex2pdf)", 1, 0);
     menu.Add("pLaTeX (dvips + ps2pdf)", 2, 0);
     menu.Add("upLaTeX (ptex2pdf)", 3, 0);
     menu.Add("upLaTeX (dvips + ps2pdf)", 4, 0);
     menu.Add("pdfLaTeX", 5, 0);
     menu.Add("LuaLaTeX", 6, 0);
     menu.Add("LuaJITLaTeX", 7, 0);
     menu.Add("XeLaTeX", 8, 0);
     menu.Add("", 0, meMenuSeparator);
     menu.Add("pLaTeX (ptex2pdf) [Adobe Reader]", 11, 0);
     menu.Add("pLaTeX (dvips + ps2pdf) [Adobe Reader]", 12, 0);
     menu.Add("upLaTeX (ptex2pdf) [Adobe Reader]", 13, 0);
     menu.Add("upLaTeX (dvips + ps2pdf) [Adobe Reader]", 14, 0);
     menu.Add("pdfLaTeX [Adobe Reader]", 15, 0);
     menu.Add("LuaLaTeX [Adobe Reader]", 16, 0);
     menu.Add("LuaJITLaTeX [Adobe Reader]", 17, 0);
     menu.Add("XeLaTeX [Adobe Reader]", 18, 0);
     menu.Add("", 0, meMenuSeparator);
     menu.Add("pBibTeX", 51, 0);
     menu.Add("upBibTeX", 52, 0);
     menu.Add("BibTeX", 53, 0);
     menu.Add("BibTeXu", 54, 0);
     menu.Add("", 0, meMenuSeparator);
     menu.Add("Mendex", 61, 0);
     menu.Add("MakeIndex", 62, 0);
     menu.Add("TeXindy", 63, 0);
     menu.Add("", 0, meMenuSeparator);
     menu.Add("TeXworks", 71, 0);
     menu.Add("SumatraPDF", 72, 0);
     menu.Add("fwdsumatrapdf", 73, 0);
     menu.Add("pdfopen", 74, 0);
     menu.Add("", 0, meMenuSeparator);
     menu.Add("Cancel", 99, 0);
 
   var ok = window.Confirm(cmd);
   if (ok) {
     document.Save();
     new ActiveXObject("WScript.Shell").Run(cmd, 1, true);
   }
 }.call(this));
----

[マクロ(M)]-[カスタマイズ(C)...]-[新規作成(N)] で pdfpLaTeX.js を選択します.

[ツール(T)]-[オプション(O)...]-[キーボード] でショートカットキーを追加して割り当てます.

----
&color(#5F9EA0,#5F9EA0){%%%                         &color(Black){''オプション''};                     &color(#DD4444,#DD4444){%%%[ &color(White){''×''}; ]%%%};%%%};&br;
  &color(Black,#EEEEEE){%%%[ 基本 ][ 表示 ][ 記号 ]%%%};''[ キーボード ]''&color(Black,#EEEEEE){%%%[ 履歴 ][ 整形 ]%%%};&br;
&br;
   カテゴリ(%%%C%%%):                  新しいキー(%%%N%%%):&br;
   &color(Black,#EEEEEE){[マクロ                 ''ᐯ'']};   %%%Ctrl+Alt+J%%%&br;
&br;
   コマンド(%%%O%%%):                  現在の割り当て:&br;
   記録/停止&br;
   実行&br;
   名前を付けて保存              現在のキー(%%%U%%%):&br;
   編集&br;
   選択&br;
   これを選択&br;
   マクロのカスタマイズ&br;
   &color(White,#1188FF){pdfpLaTeX.js               };&br;
&br;
----

**pdfpLaTeX2.js [#ia1c6201]

----
 function main()
 {
   var fso = new ActiveXObject("Scripting.FileSystemObject");
   var c = document.Path;
   var b = fso.GetBaseName(document.Name);
   var cd = "cd /d " + ["\"", c, "\""].join("");
   var latex = "platex -synctex=1 -guess-input-enc -sjis-terminal";
   var encoding = document.Encoding;
   if (encoding == meEncodingUTF8WithoutSignature || encoding == meEncodingUTF8WithSignature || encoding == meEncodingUTF8) {
     latex = "platex -synctex=1 -no-guess-input-enc -kanji=utf8 -sjis-terminal";
   } else if (encoding == meEncodingShiftJIS) {
     latex = "platex -synctex=1 -no-guess-input-enc -kanji=sjis -sjis-terminal";
   } else if (encoding == meEncodingEUC) {
     latex = "platex -synctex=1 -no-guess-input-enc -kanji=euc -sjis-terminal";
   } else if (encoding == meEncodingJIS) {
     latex = "platex -synctex=1 -no-guess-input-enc -kanji=jis -sjis-terminal";
   }
   latex += " " + ["\"", b, "\""].join("");
   var dvips = "dvips -Ppdf -z -f" + " " + ["\"", b, ".dvi", "\""].join("") + " | convbkmk -g > " + ["\"", b, ".ps", "\""].join("");
   var ps2pdf = "ps2pdf.bat" + " " + ["\"", b, ".ps", "\""].join("");
   var cmd = "cmd /c " + cd + " && " + latex + " && " + dvips + " && " + ps2pdf;
     var menuItem = menu.Track(0);
     switch (menuItem) {
     case 1:
         var c = document.Path;
         var b = new ActiveXObject("Scripting.FileSystemObject").GetBaseName(document.Name);
         var cd = "cd /d " + ["\"", c, "\""].join("");
         var ptex2pdf = "ptex2pdf -l -ot \"-synctex=1 -guess-input-enc -sjis-terminal\"";
         var encoding = document.Encoding;
         if (encoding == meEncodingUTF8WithoutSignature || encoding == meEncodingUTF8WithSignature || encoding == meEncodingUTF8) {
             ptex2pdf = "ptex2pdf -l -ot \"-synctex=1 -no-guess-input-enc -kanji=utf8 -sjis-terminal\"";
         } else if (encoding == meEncodingShiftJIS) {
             ptex2pdf = "ptex2pdf -l -ot \"-synctex=1 -no-guess-input-enc -kanji=sjis -sjis-terminal\"";
         } else if (encoding == meEncodingEUC) {
             ptex2pdf = "ptex2pdf -l -ot \"-synctex=1 -no-guess-input-enc -kanji=euc -sjis-terminal\"";
         } else if (encoding == meEncodingJIS) {
             ptex2pdf = "ptex2pdf -l -ot \"-synctex=1 -no-guess-input-enc -kanji=jis -sjis-terminal\"";
         }
         ptex2pdf += " " + ["\"", b, "\""].join("");
         var cmd = "cmd /c " + cd + " && " + ptex2pdf;
         execute(cmd);
         break;
     case 2:
         var c = document.Path;
         var b = new ActiveXObject("Scripting.FileSystemObject").GetBaseName(document.Name);
         var cd = "cd /d " + ["\"", c, "\""].join("");
         var latex = "platex -synctex=1 -guess-input-enc -sjis-terminal";
         var encoding = document.Encoding;
         if (encoding == meEncodingUTF8WithoutSignature || encoding == meEncodingUTF8WithSignature || encoding == meEncodingUTF8) {
             latex = "platex -synctex=1 -no-guess-input-enc -kanji=utf8 -sjis-terminal";
         } else if (encoding == meEncodingShiftJIS) {
             latex = "platex -synctex=1 -no-guess-input-enc -kanji=sjis -sjis-terminal";
         } else if (encoding == meEncodingEUC) {
             latex = "platex -synctex=1 -no-guess-input-enc -kanji=euc -sjis-terminal";
         } else if (encoding == meEncodingJIS) {
             latex = "platex -synctex=1 -no-guess-input-enc -kanji=jis -sjis-terminal";
         }
         latex += " " + ["\"", b, "\""].join("");
         var dvips = "dvips -Ppdf -z -f" + " " + ["\"", b, ".dvi", "\""].join("") + " | convbkmk -g > " + ["\"", b, ".ps", "\""].join("");
         var ps2pdf = "ps2pdf.bat" + " " + ["\"", b, ".ps", "\""].join("");
         var cmd = "cmd /c " + cd + " && " + latex + " && " + dvips + " && " + ps2pdf;
         execute(cmd);
         break;
     case 3:
         var c = document.Path;
         var b = new ActiveXObject("Scripting.FileSystemObject").GetBaseName(document.Name);
         var cd = "cd /d " + ["\"", c, "\""].join("");
         var ptex2pdf = "ptex2pdf -l -u -ot \"-synctex=1 -no-guess-input-enc -kanji=utf8\"" + " " + ["\"", b, "\""].join("");
         var cmd = "cmd /c " + cd + " && " + ptex2pdf;
         execute(cmd);
         break;
     case 4:
         var c = document.Path;
         var b = new ActiveXObject("Scripting.FileSystemObject").GetBaseName(document.Name);
         var cd = "cd /d " + ["\"", c, "\""].join("");
         var latex = "uplatex -synctex=1 -no-guess-input-enc -kanji=utf8" + " " + ["\"", b, "\""].join("");
         var dvips = "dvips -Ppdf -z -f" + " " + ["\"", b, ".dvi", "\""].join("") + " | convbkmk -u > " + ["\"", b, ".ps", "\""].join("");
         var ps2pdf = "ps2pdf.bat" + " " + ["\"", b, ".ps", "\""].join("");
         var cmd = "cmd /c " + cd + " && " + latex + " && " + dvips + " && " + ps2pdf;
         execute(cmd);
         break;
     case 5:
         var c = document.Path;
         var b = new ActiveXObject("Scripting.FileSystemObject").GetBaseName(document.Name);
         var cd = "cd /d " + ["\"", c, "\""].join("");
         var pdflatex = "pdflatex -synctex=1" + " " + ["\"", b, "\""].join("");
         var cmd = "cmd /c " + cd + " && " + pdflatex;
         execute(cmd);
         break;
     case 6:
         var c = document.Path;
         var b = new ActiveXObject("Scripting.FileSystemObject").GetBaseName(document.Name);
         var cd = "cd /d " + ["\"", c, "\""].join("");
         var lualatex = "lualatex -synctex=1" + " " + ["\"", b, "\""].join("");
         var cmd = "cmd /c " + cd + " && " + lualatex;
         execute(cmd);
         break;
     case 7:
         var c = document.Path;
         var b = new ActiveXObject("Scripting.FileSystemObject").GetBaseName(document.Name);
         var cd = "cd /d " + ["\"", c, "\""].join("");
         var luajitlatex = "luajitlatex -synctex=1" + " " + ["\"", b, "\""].join("");
         var cmd = "cmd /c " + cd + " && " + luajitlatex;
         execute(cmd);
         break;
     case 8:
         var c = document.Path;
         var b = new ActiveXObject("Scripting.FileSystemObject").GetBaseName(document.Name);
         var cd = "cd /d " + ["\"", c, "\""].join("");
         var xelatex = "xelatex -synctex=1" + " " + ["\"", b, "\""].join("");
         var cmd = "cmd /c " + cd + " && " + xelatex;
         execute(cmd);
         break;
     case 11:
         var c = document.Path;
         var b = new ActiveXObject("Scripting.FileSystemObject").GetBaseName(document.Name);
         var cd = "cd /d " + ["\"", c, "\""].join("");
         var ptex2pdf = "ptex2pdf -l -ot \"-guess-input-enc -sjis-terminal\"";
         var encoding = document.Encoding;
         if (encoding == meEncodingUTF8WithoutSignature || encoding == meEncodingUTF8WithSignature || encoding == meEncodingUTF8) {
             ptex2pdf = "ptex2pdf -l -ot \"-no-guess-input-enc -kanji=utf8 -sjis-terminal\"";
         } else if (encoding == meEncodingShiftJIS) {
             ptex2pdf = "ptex2pdf -l -ot \"-no-guess-input-enc -kanji=sjis -sjis-terminal\"";
         } else if (encoding == meEncodingEUC) {
             ptex2pdf = "ptex2pdf -l -ot \"-no-guess-input-enc -kanji=euc -sjis-terminal\"";
         } else if (encoding == meEncodingJIS) {
             ptex2pdf = "ptex2pdf -l -ot \"-no-guess-input-enc -kanji=jis -sjis-terminal\"";
         }
         ptex2pdf += " " + ["\"", b, "\""].join("");
         var pdf = ["\"", b, ".pdf", "\""].join("");
         var pdfopen = "powershell -Command \"& {$pdf = \"\"" + pdf + "\"\"; $pages = (pdfinfo $pdf | Select-String \"^Pages:\"); $page = (-split $pages)[1]; pdfopen --rxi --file $pdf --page $page}\"";
         var pdfclose = "tasklist /fi \"IMAGENAME eq AcroRd32.exe\" /nh | findstr \"AcroRd32.exe\" > nul && pdfopen --rxi --file " + pdf + " && pdfclose --rxi --file " + pdf;
         var cmd = "cmd /c " + cd + " && " + pdfclose + " & " + ptex2pdf + " && " + pdfopen;
         execute(cmd);
         break;
     case 12:
         var c = document.Path;
         var b = new ActiveXObject("Scripting.FileSystemObject").GetBaseName(document.Name);
         var cd = "cd /d " + ["\"", c, "\""].join("");
         var latex = "platex -guess-input-enc -sjis-terminal";
         var encoding = document.Encoding;
         if (encoding == meEncodingUTF8WithoutSignature || encoding == meEncodingUTF8WithSignature || encoding == meEncodingUTF8) {
             latex = "platex -no-guess-input-enc -kanji=utf8 -sjis-terminal";
         } else if (encoding == meEncodingShiftJIS) {
             latex = "platex -no-guess-input-enc -kanji=sjis -sjis-terminal";
         } else if (encoding == meEncodingEUC) {
             latex = "platex -no-guess-input-enc -kanji=euc -sjis-terminal";
         } else if (encoding == meEncodingJIS) {
             latex = "platex -no-guess-input-enc -kanji=jis -sjis-terminal";
         }
         latex += " " + ["\"", b, "\""].join("");
         var dvips = "dvips -Ppdf -z -f" + " " + ["\"", b, ".dvi", "\""].join("") + " | convbkmk -g > " + ["\"", b, ".ps", "\""].join("");
         var ps2pdf = "ps2pdf.bat" + " " + ["\"", b, ".ps", "\""].join("");
         var pdf = ["\"", b, ".pdf", "\""].join("");
         var pdfopen = "powershell -Command \"& {$pdf = \"\"" + pdf + "\"\"; $pages = (pdfinfo $pdf | Select-String \"^Pages:\"); $page = (-split $pages)[1]; pdfopen --rxi --file $pdf --page $page}\"";
         var pdfclose = "tasklist /fi \"IMAGENAME eq AcroRd32.exe\" /nh | findstr \"AcroRd32.exe\" > nul && pdfopen --rxi --file " + pdf + " && pdfclose --rxi --file " + pdf;
         var cmd = "cmd /c " + cd + " && " + pdfclose + " & " + latex + " && " + dvips + " && " + ps2pdf + " && " + pdfopen;
         execute(cmd);
         break;
     case 13:
         var c = document.Path;
         var b = new ActiveXObject("Scripting.FileSystemObject").GetBaseName(document.Name);
         var cd = "cd /d " + ["\"", c, "\""].join("");
         var ptex2pdf = "ptex2pdf -l -u -ot \"-no-guess-input-enc -kanji=utf8\"" + " " + ["\"", b, "\""].join("");
         var pdf = ["\"", b, ".pdf", "\""].join("");
         var pdfopen = "powershell -Command \"& {$pdf = \"\"" + pdf + "\"\"; $pages = (pdfinfo $pdf | Select-String \"^Pages:\"); $page = (-split $pages)[1]; pdfopen --rxi --file $pdf --page $page}\"";
         var pdfclose = "tasklist /fi \"IMAGENAME eq AcroRd32.exe\" /nh | findstr \"AcroRd32.exe\" > nul && pdfopen --rxi --file " + pdf + " && pdfclose --rxi --file " + pdf;
         var cmd = "cmd /c " + cd + " && " + pdfclose + " & " + ptex2pdf + " && " + pdfopen;
         execute(cmd);
         break;
     case 14:
         var c = document.Path;
         var b = new ActiveXObject("Scripting.FileSystemObject").GetBaseName(document.Name);
         var cd = "cd /d " + ["\"", c, "\""].join("");
         var latex = "uplatex -no-guess-input-enc -kanji=utf8" + " " + ["\"", b, "\""].join("");
         var dvips = "dvips -Ppdf -z -f" + " " + ["\"", b, ".dvi", "\""].join("") + " | convbkmk -u > " + ["\"", b, ".ps", "\""].join("");
         var ps2pdf = "ps2pdf.bat" + " " + ["\"", b, ".ps", "\""].join("");
         var pdf = ["\"", b, ".pdf", "\""].join("");
         var pdfopen = "powershell -Command \"& {$pdf = \"\"" + pdf + "\"\"; $pages = (pdfinfo $pdf | Select-String \"^Pages:\"); $page = (-split $pages)[1]; pdfopen --rxi --file $pdf --page $page}\"";
         var pdfclose = "tasklist /fi \"IMAGENAME eq AcroRd32.exe\" /nh | findstr \"AcroRd32.exe\" > nul && pdfopen --rxi --file " + pdf + " && pdfclose --rxi --file " + pdf;
         var cmd = "cmd /c " + cd + " && " + pdfclose + " & " + latex + " && " + dvips + " && " + ps2pdf + " && " + pdfopen;
         execute(cmd);
         break;
     case 15:
         var c = document.Path;
         var b = new ActiveXObject("Scripting.FileSystemObject").GetBaseName(document.Name);
         var cd = "cd /d " + ["\"", c, "\""].join("");
         var pdflatex = "pdflatex" + " " + ["\"", b, "\""].join("");
         var pdf = ["\"", b, ".pdf", "\""].join("");
         var pdfopen = "powershell -Command \"& {$pdf = \"\"" + pdf + "\"\"; $pages = (pdfinfo $pdf | Select-String \"^Pages:\"); $page = (-split $pages)[1]; pdfopen --rxi --file $pdf --page $page}\"";
         var pdfclose = "tasklist /fi \"IMAGENAME eq AcroRd32.exe\" /nh | findstr \"AcroRd32.exe\" > nul && pdfopen --rxi --file " + pdf + " && pdfclose --rxi --file " + pdf;
         var cmd = "cmd /c " + cd + " && " + pdfclose + " & " + pdflatex + " && " + pdfopen;
         execute(cmd);
         break;
     case 16:
         var c = document.Path;
         var b = new ActiveXObject("Scripting.FileSystemObject").GetBaseName(document.Name);
         var cd = "cd /d " + ["\"", c, "\""].join("");
         var lualatex = "lualatex" + " " + ["\"", b, "\""].join("");
         var pdf = ["\"", b, ".pdf", "\""].join("");
         var pdfopen = "powershell -Command \"& {$pdf = \"\"" + pdf + "\"\"; $pages = (pdfinfo $pdf | Select-String \"^Pages:\"); $page = (-split $pages)[1]; pdfopen --rxi --file $pdf --page $page}\"";
         var pdfclose = "tasklist /fi \"IMAGENAME eq AcroRd32.exe\" /nh | findstr \"AcroRd32.exe\" > nul && pdfopen --rxi --file " + pdf + " && pdfclose --rxi --file " + pdf;
         var cmd = "cmd /c " + cd + " && " + pdfclose + " & " + lualatex + " && " + pdfopen;
         execute(cmd);
         break;
     case 17:
         var c = document.Path;
         var b = new ActiveXObject("Scripting.FileSystemObject").GetBaseName(document.Name);
         var cd = "cd /d " + ["\"", c, "\""].join("");
         var luajitlatex = "luajitlatex" + " " + ["\"", b, "\""].join("");
         var pdf = ["\"", b, ".pdf", "\""].join("");
         var pdfopen = "powershell -Command \"& {$pdf = \"\"" + pdf + "\"\"; $pages = (pdfinfo $pdf | Select-String \"^Pages:\"); $page = (-split $pages)[1]; pdfopen --rxi --file $pdf --page $page}\"";
         var pdfclose = "tasklist /fi \"IMAGENAME eq AcroRd32.exe\" /nh | findstr \"AcroRd32.exe\" > nul && pdfopen --rxi --file " + pdf + " && pdfclose --rxi --file " + pdf;
         var cmd = "cmd /c " + cd + " && " + pdfclose + " & " + luajitlatex + " && " + pdfopen;
         execute(cmd);
         break;
     case 18:
         var c = document.Path;
         var b = new ActiveXObject("Scripting.FileSystemObject").GetBaseName(document.Name);
         var cd = "cd /d " + ["\"", c, "\""].join("");
         var xelatex = "xelatex" + " " + ["\"", b, "\""].join("");
         var pdf = ["\"", b, ".pdf", "\""].join("");
         var pdfopen = "powershell -Command \"& {$pdf = \"\"" + pdf + "\"\"; $pages = (pdfinfo $pdf | Select-String \"^Pages:\"); $page = (-split $pages)[1]; pdfopen --rxi --file $pdf --page $page}\"";
         var pdfclose = "tasklist /fi \"IMAGENAME eq AcroRd32.exe\" /nh | findstr \"AcroRd32.exe\" > nul && pdfopen --rxi --file " + pdf + " && pdfclose --rxi --file " + pdf;
         var cmd = "cmd /c " + cd + " && " + pdfclose + " & " + xelatex + " && " + pdfopen;
         execute(cmd);
         break;
     case 51:
         var c = document.Path;
         var b = new ActiveXObject("Scripting.FileSystemObject").GetBaseName(document.Name);
         var cd = "cd /d " + ["\"", c, "\""].join("");
         var bibtex = "pbibtex -sjis-terminal";
         var encoding = document.Encoding;
         if (encoding == meEncodingUTF8WithoutSignature || encoding == meEncodingUTF8WithSignature || encoding == meEncodingUTF8) {
             bibtex = "pbibtex -kanji=utf8 -sjis-terminal";
         } else if (encoding == meEncodingShiftJIS) {
             bibtex = "pbibtex -kanji=sjis -sjis-terminal";
         } else if (encoding == meEncodingEUC) {
             bibtex = "pbibtex -kanji=euc -sjis-terminal";
         } else if (encoding == meEncodingJIS) {
             bibtex = "pbibtex -kanji=jis  -sjis-terminal";
         }
         bibtex += " " + ["\"", b, "\""].join("");
         var cmd = "cmd /c " + cd + " && " + bibtex;
         execute(cmd);
         break;
     case 52:
         var c = document.Path;
         var b = new ActiveXObject("Scripting.FileSystemObject").GetBaseName(document.Name);
         var cd = "cd /d " + ["\"", c, "\""].join("");
         var bibtex = "upbibtex" + " " + ["\"", b, "\""].join("");
         var cmd = "cmd /c " + cd + " && " + bibtex;
         execute(cmd);
         break;
     case 53:
         var c = document.Path;
         var b = new ActiveXObject("Scripting.FileSystemObject").GetBaseName(document.Name);
         var cd = "cd /d " + ["\"", c, "\""].join("");
         var bibtex = "bibtex" + " " + ["\"", b, "\""].join("");
         var cmd = "cmd /c " + cd + " && " + bibtex;
         execute(cmd);
         break;
     case 54:
         var c = document.Path;
         var b = new ActiveXObject("Scripting.FileSystemObject").GetBaseName(document.Name);
         var cd = "cd /d " + ["\"", c, "\""].join("");
         var bibtex = "bibtexu" + " " + ["\"", b, "\""].join("");
         var cmd = "cmd /c " + cd + " && " + bibtex;
         execute(cmd);
         break;
     case 61:
         var c = document.Path;
         var b = new ActiveXObject("Scripting.FileSystemObject").GetBaseName(document.Name);
         var cd = "cd /d " + ["\"", c, "\""].join("");
         var makeindex = "mendex -T";
         var encoding = document.Encoding;
         if (encoding == meEncodingUTF8WithoutSignature || encoding == meEncodingUTF8WithSignature || encoding == meEncodingUTF8) {
             makeindex = "mendex -U -T";
         } else if (encoding == meEncodingShiftJIS) {
             makeindex = "mendex -S -T";
         } else if (encoding == meEncodingEUC) {
             makeindex = "mendex -E -T";
         } else if (encoding == meEncodingJIS) {
             makeindex = "mendex -J -T";
         }
         makeindex += " " + ["\"", b, "\""].join("");
         var cmd = "cmd /c " + cd + " && " + makeindex;
         execute(cmd);
         break;
     case 62:
         var c = document.Path;
         var b = new ActiveXObject("Scripting.FileSystemObject").GetBaseName(document.Name);
         var cd = "cd /d " + ["\"", c, "\""].join("");
         var makeindex = "makeindex" + " " + ["\"", b, "\""].join("");
         var cmd = "cmd /c " + cd + " && " + makeindex;
         execute(cmd);
         break;
     case 63:
         var c = document.Path;
         var b = new ActiveXObject("Scripting.FileSystemObject").GetBaseName(document.Name);
         var cd = "cd /d " + ["\"", c, "\""].join("");
         var makeindex = "texindy" + " " + ["\"", b, "\""].join("");
         var cmd = "cmd /c " + cd + " && " + makeindex;
         execute(cmd);
         break;
     case 71:
         var fso = new ActiveXObject("Scripting.FileSystemObject");
         var currentTeXFile = document.FullName;
         var pdfFile = currentTeXFile.replace(new RegExp(/\.[^.]*$/), ".pdf");
         var texworks = "texworks";
 
   var ok = window.Confirm(cmd);
   if (ok) {
     document.Save();
     new ActiveXObject("WScript.Shell").Run(cmd, 1, true);
   }
 }
         if (!fso.FileExists(pdfFile)) {
             var mainTeXFile = window.Prompt("Input the path to main TeX file.", pdfFile.replace(new RegExp(/\.[^.]*$/), ".tex"));
             if (mainTeXFile != "") {
                 pdfFile = mainTeXFile.replace(new RegExp(/\.[^.]*$/), ".pdf");
             }
         }
 
 main();
----

[マクロ(M)]-[カスタマイズ(C)...]-[新規作成(N)] で pdfpLaTeX2.js を選択します.

[ツール(T)]-[オプション(O)...]-[キーボード] でショートカットキーを追加して割り当てます.

----
&color(#5F9EA0,#5F9EA0){%%%                         &color(Black){''オプション''};                     &color(#DD4444,#DD4444){%%%[ &color(White){''×''}; ]%%%};%%%};&br;
  &color(Black,#EEEEEE){%%%[ 基本 ][ 表示 ][ 記号 ]%%%};''[ キーボード ]''&color(Black,#EEEEEE){%%%[ 履歴 ][ 整形 ]%%%};&br;
&br;
   カテゴリ(%%%C%%%):                  新しいキー(%%%N%%%):&br;
   &color(Black,#EEEEEE){[マクロ                 ''ᐯ'']};   %%%Ctrl+Alt+K%%%&br;
&br;
   コマンド(%%%O%%%):                  現在の割り当て:&br;
   記録/停止&br;
   実行&br;
   名前を付けて保存              現在のキー(%%%U%%%):&br;
   編集&br;
   選択&br;
   これを選択&br;
   マクロのカスタマイズ&br;
   pdfpLaTeX.js&br;
   &color(White,#1188FF){pdfpLaTeX2.js              };&br;
&br;
----

**pdfupLaTeX.js [#cca95ce9]

----
 (function () {
   var fso = new ActiveXObject("Scripting.FileSystemObject");
   var c = document.Path;
   var b = fso.GetBaseName(document.Name);
   var cd = "cd /d " + ["\"", c, "\""].join("");
   var ptex2pdf = "ptex2pdf -l -u -ot \"-synctex=1 -no-guess-input-enc -kanji=utf8\"" + " " + ["\"", b, "\""].join("");
   var cmd = "cmd /c " + cd + " && " + ptex2pdf;
         var mainTeXDir = fso.GetParentFolderName(pdfFile);
         var cd = "cd /d " + ["\"", mainTeXDir, "\""].join("");
         pdfFile = ["\"", pdfFile, "\""].join("");
 
   var ok = window.Confirm(cmd);
   if (ok) {
     document.Save();
     new ActiveXObject("WScript.Shell").Run(cmd, 1, true);
   }
 }.call(this));
----

[マクロ(M)]-[カスタマイズ(C)...]-[新規作成(N)] で pdfupLaTeX.js を選択します.

[ツール(T)]-[オプション(O)...]-[キーボード] でショートカットキーを追加して割り当てます.

----
&color(#5F9EA0,#5F9EA0){%%%                         &color(Black){''オプション''};                     &color(#DD4444,#DD4444){%%%[ &color(White){''×''}; ]%%%};%%%};&br;
  &color(Black,#EEEEEE){%%%[ 基本 ][ 表示 ][ 記号 ]%%%};''[ キーボード ]''&color(Black,#EEEEEE){%%%[ 履歴 ][ 整形 ]%%%};&br;
&br;
   カテゴリ(%%%C%%%):                  新しいキー(%%%N%%%):&br;
   &color(Black,#EEEEEE){[マクロ                 ''ᐯ'']};   %%%Shift+Alt+J%%%&br;
&br;
   コマンド(%%%O%%%):                  現在の割り当て:&br;
   記録/停止&br;
   実行&br;
   名前を付けて保存              現在のキー(%%%U%%%):&br;
   編集&br;
   選択&br;
   これを選択&br;
   マクロのカスタマイズ&br;
   pdfpLaTeX.js&br;
   pdfpLaTeX2.js&br;
   &color(White,#1188FF){pdfupLaTeX.js             };&br;
&br;
----

**pdfupLaTeX2.js [#s6641f74]

----
 function main()
 {
   var fso = new ActiveXObject("Scripting.FileSystemObject");
   var c = document.Path;
   var b = fso.GetBaseName(document.Name);
   var cd = "cd /d " + ["\"", c, "\""].join("");
   var latex = "uplatex -synctex=1 -no-guess-input-enc -kanji=utf8" + " " + ["\"", b, "\""].join("");
   var dvips = "dvips -Ppdf -z -f" + " " + ["\"", b, ".dvi", "\""].join("") + " | convbkmk -u > " + ["\"", b, ".ps", "\""].join("");
   var ps2pdf = "ps2pdf.bat" + " " + ["\"", b, ".ps", "\""].join("");
   var cmd = "cmd /c " + cd + " && " + latex + " && " + dvips + " && " + ps2pdf;
         var args = texworks + " " + pdfFile;
         var cmd = "cmd /c " + cd + " && echo " + args + " | cmd";
         new ActiveXObject("WScript.Shell").Run(cmd, 1, true);
         break;
     case 72:
         var fso = new ActiveXObject("Scripting.FileSystemObject");
         var mery = editor.FullName;
         var currentTeXFile = document.FullName;
         var pdfFile = currentTeXFile.replace(new RegExp(/\.[^.]*$/), ".pdf");
         var line = document.selection.GetActivePointY(mePosLogical);
         var sumatraPDF = "C:/Program Files/SumatraPDF/SumatraPDF.exe";
         var existSumatraPDF = true;
         var mainTeXDir;
         var cd;
         var cmd;
         var args;
 
   var ok = window.Confirm(cmd);
   if (ok) {
     document.Save();
     new ActiveXObject("WScript.Shell").Run(cmd, 1, true);
   }
 }
         if (!fso.FileExists(sumatraPDF)) {
             sumatraPDF = "C:/Program Files (x86)/SumatraPDF/SumatraPDF.exe";
             if (!fso.FileExists(sumatraPDF)) {
                 sumatraPDF = window.Prompt("Input the path to SumatraPDF.exe.", "SumatraPDF.exe");
                 if (!fso.FileExists(sumatraPDF)) {
                     sumatraPDF = "rundll32 shell32,ShellExec_RunDLL SumatraPDF";
                     existSumatraPDF = false;
                 }
             }
         }
 
 main();
----

[マクロ(M)]-[カスタマイズ(C)...]-[新規作成(N)] で pdfupLaTeX2.js を選択します.

[ツール(T)]-[オプション(O)...]-[キーボード] でショートカットキーを追加して割り当てます.

----
&color(#5F9EA0,#5F9EA0){%%%                         &color(Black){''オプション''};                     &color(#DD4444,#DD4444){%%%[ &color(White){''×''}; ]%%%};%%%};&br;
  &color(Black,#EEEEEE){%%%[ 基本 ][ 表示 ][ 記号 ]%%%};''[ キーボード ]''&color(Black,#EEEEEE){%%%[ 履歴 ][ 整形 ]%%%};&br;
&br;
   カテゴリ(%%%C%%%):                  新しいキー(%%%N%%%):&br;
   &color(Black,#EEEEEE){[マクロ                 ''ᐯ'']};   %%%Shift+Alt+K%%%&br;
&br;
   コマンド(%%%O%%%):                  現在の割り当て:&br;
   記録/停止&br;
   実行&br;
   名前を付けて保存              現在のキー(%%%U%%%):&br;
   編集&br;
   選択&br;
   これを選択&br;
   マクロのカスタマイズ&br;
   pdfpLaTeX.js&br;
   pdfpLaTeX2.js&br;
   pdfupLaTeX.js&br;
   &color(White,#1188FF){pdfupLaTeX2.js             };&br;
&br;
----

**pdfLaTeX.js [#a177f996]

----
 function main()
 {
   var fso = new ActiveXObject("Scripting.FileSystemObject");
   var c = document.Path;
   var b = fso.GetBaseName(document.Name);
   var cd = "cd /d " + ["\"", c, "\""].join("");
   var pdflatex = "pdflatex -synctex=1" + " " + ["\"", b, "\""].join("");
   var cmd = "cmd /c " + cd + " && " + pdflatex;
         if (existSumatraPDF) {
             sumatraPDF = ["\"", sumatraPDF, "\""].join("");
         }
 
   var ok = window.Confirm(cmd);
   if (ok) {
     document.Save();
     new ActiveXObject("WScript.Shell").Run(cmd, 1, true);
   }
 }
         if (!fso.FileExists(pdfFile)) {
             var mainTeXFile = window.Prompt("Input the path to main TeX file.", pdfFile.replace(new RegExp(/\.[^.]*$/), ".tex"));
             if (mainTeXFile != "") {
                 pdfFile = mainTeXFile.replace(new RegExp(/\.[^.]*$/), ".pdf");
             }
         }
 
 main();
----

[マクロ(M)]-[カスタマイズ(C)...]-[新規作成(N)] で pdfLaTeX.js を選択します.

[ツール(T)]-[オプション(O)...]-[キーボード] でショートカットキーを追加して割り当てます.

----
&color(#5F9EA0,#5F9EA0){%%%                         &color(Black){''オプション''};                     &color(#DD4444,#DD4444){%%%[ &color(White){''×''}; ]%%%};%%%};&br;
  &color(Black,#EEEEEE){%%%[ 基本 ][ 表示 ][ 記号 ]%%%};''[ キーボード ]''&color(Black,#EEEEEE){%%%[ 履歴 ][ 整形 ]%%%};&br;
&br;
   カテゴリ(%%%C%%%):                  新しいキー(%%%N%%%):&br;
   &color(Black,#EEEEEE){[マクロ                 ''ᐯ'']};   %%%Shift+Alt+H%%%&br;
&br;
   コマンド(%%%O%%%):                  現在の割り当て:&br;
   記録/停止&br;
   実行&br;
   名前を付けて保存              現在のキー(%%%U%%%):&br;
   編集&br;
   選択&br;
   これを選択&br;
   マクロのカスタマイズ&br;
   pdfpLaTeX.js&br;
   pdfpLaTeX2.js&br;
   pdfupLaTeX.js&br;
   pdfupLaTeX2.js&br;
   &color(White,#1188FF){pdfLaTeX.js                };&br;
&br;
----

**LuaLaTeX.js [#a56da2a2]

----
 function main()
 {
   var fso = new ActiveXObject("Scripting.FileSystemObject");
   var c = document.Path;
   var b = fso.GetBaseName(document.Name);
   var cd = "cd /d " + ["\"", c, "\""].join("");
   var lualatex = "lualatex -synctex=1" + " " + ["\"", b, "\""].join("");
   var cmd = "cmd /c " + cd + " && " + lualatex;
         mainTeXDir = fso.GetParentFolderName(pdfFile);
         cd = "cd /d " + ["\"", mainTeXDir, "\""].join("");
         currentTeXFile = ["\"", currentTeXFile, "\""].join("");
         pdfFile = ["\"", pdfFile, "\""].join("");
 
   var ok = window.Confirm(cmd);
   if (ok) {
     document.Save();
     new ActiveXObject("WScript.Shell").Run(cmd, 1, true);
   }
 }
         args = sumatraPDF + " -reuse-instance " + pdfFile + " -inverse-search \"\\\"" + mery + "\\\" /l %l \\\"%f\\\"\"" + " -forward-search " + currentTeXFile + " " + line;
         cmd = "cmd /c " + cd + " && echo " + args + " | cmd";
         new ActiveXObject("WScript.Shell").Run(cmd, 1, true);
         break;
     case 73:
         var fso = new ActiveXObject("Scripting.FileSystemObject");
         var currentTeXFile = document.FullName;
         var pdfFile = currentTeXFile.replace(new RegExp(/\.[^.]*$/), ".pdf");
         var line = document.selection.GetActivePointY(mePosLogical);
         var fwdsumatrapdf = "C:/w32tex/bin/fwdsumatrapdf.exe";
         var existFwdSumatraPDF = true;
         var mainTeXDir;
         var cd;
         var cmd;
         var args;
         if (!fso.FileExists(fwdsumatrapdf)) {
             fwdsumatrapdf = window.Prompt("Input the path to fwdsumatrapdf.exe.", "fwdsumatrapdf.exe");
             if (!fso.FileExists(fwdsumatrapdf)) {
                 fwdsumatrapdf = "fwdsumatrapdf.exe";
                 existFwdSumatraPDF = false;
             }
         }
 
 main();
----

[マクロ(M)]-[カスタマイズ(C)...]-[新規作成(N)] で LuaLaTeX.js を選択します.

[ツール(T)]-[オプション(O)...]-[キーボード] でショートカットキーを追加して割り当てます.

----
&color(#5F9EA0,#5F9EA0){%%%                         &color(Black){''オプション''};                     &color(#DD4444,#DD4444){%%%[ &color(White){''×''}; ]%%%};%%%};&br;
  &color(Black,#EEEEEE){%%%[ 基本 ][ 表示 ][ 記号 ]%%%};''[ キーボード ]''&color(Black,#EEEEEE){%%%[ 履歴 ][ 整形 ]%%%};&br;
&br;
   カテゴリ(%%%C%%%):                  新しいキー(%%%N%%%):&br;
   &color(Black,#EEEEEE){[マクロ                 ''ᐯ'']};   %%%Shift+Alt+Y%%%&br;
&br;
   コマンド(%%%O%%%):                  現在の割り当て:&br;
   記録/停止&br;
   実行&br;
   名前を付けて保存              現在のキー(%%%U%%%):&br;
   編集&br;
   選択&br;
   これを選択&br;
   マクロのカスタマイズ&br;
   pdfpLaTeX.js&br;
   pdfpLaTeX2.js&br;
   pdfupLaTeX.js&br;
   pdfupLaTeX2.js&br;
   pdfLaTeX.js&br;
   &color(White,#1188FF){LuaLaTeX.js               };&br;
&br;
----

**LuaJITLaTeX.js [#yfd8173e]

----
 function main()
 {
   var fso = new ActiveXObject("Scripting.FileSystemObject");
   var c = document.Path;
   var b = fso.GetBaseName(document.Name);
   var cd = "cd /d " + ["\"", c, "\""].join("");
   var luajitlatex = "luajitlatex -synctex=1" + " " + ["\"", b, "\""].join("");
   var cmd = "cmd /c " + cd + " && " + luajitlatex;
         if (existFwdSumatraPDF) {
             fwdsumatrapdf = ["\"", fwdsumatrapdf, "\""].join("");
         }
 
   var ok = window.Confirm(cmd);
   if (ok) {
     document.Save();
     new ActiveXObject("WScript.Shell").Run(cmd, 1, true);
   }
 }
         if (!fso.FileExists(pdfFile)) {
             var mainTeXFile = window.Prompt("Input the path to main TeX file.", pdfFile.replace(new RegExp(/\.[^.]*$/), ".tex"));
             if (mainTeXFile != "") {
                 pdfFile = mainTeXFile.replace(new RegExp(/\.[^.]*$/), ".pdf");
             }
         }
 
 main();
----

[マクロ(M)]-[カスタマイズ(C)...]-[新規作成(N)] で LuaJITLaTeX.js を選択します.

[ツール(T)]-[オプション(O)...]-[キーボード] でショートカットキーを追加して割り当てます.

----
&color(#5F9EA0,#5F9EA0){%%%                         &color(Black){''オプション''};                     &color(#DD4444,#DD4444){%%%[ &color(White){''×''}; ]%%%};%%%};&br;
  &color(Black,#EEEEEE){%%%[ 基本 ][ 表示 ][ 記号 ]%%%};''[ キーボード ]''&color(Black,#EEEEEE){%%%[ 履歴 ][ 整形 ]%%%};&br;
&br;
   カテゴリ(%%%C%%%):                  新しいキー(%%%N%%%):&br;
   &color(Black,#EEEEEE){[マクロ                 ''ᐯ'']};   %%%Shift+Alt+U%%%&br;
&br;
   コマンド(%%%O%%%):                  現在の割り当て:&br;
   記録/停止&br;
   実行&br;
   名前を付けて保存              現在のキー(%%%U%%%):&br;
   編集&br;
   選択&br;
   これを選択&br;
   マクロのカスタマイズ&br;
   pdfpLaTeX.js&br;
   pdfpLaTeX2.js&br;
   pdfupLaTeX.js&br;
   pdfupLaTeX2.js&br;
   pdfLaTeX.js&br;
   LuaLaTeX.js&br;
   &color(White,#1188FF){LuaJITLaTeX.js             };&br;
&br;
----

**XeLaTeX.js [#x3721d4b]

----
 function main()
 {
   var fso = new ActiveXObject("Scripting.FileSystemObject");
   var c = document.Path;
   var b = fso.GetBaseName(document.Name);
   var cd = "cd /d " + ["\"", c, "\""].join("");
   var xelatex = "xelatex -synctex=1" + " " + ["\"", b, "\""].join("");
   var cmd = "cmd /c " + cd + " && " + xelatex;
         mainTeXDir = fso.GetParentFolderName(pdfFile);
         cd = "cd /d " + ["\"", mainTeXDir, "\""].join("");
         currentTeXFile = ["\"", currentTeXFile, "\""].join("");
         pdfFile = ["\"", pdfFile, "\""].join("");
 
   var ok = window.Confirm(cmd);
   if (ok) {
     document.Save();
     new ActiveXObject("WScript.Shell").Run(cmd, 1, true);
   }
 }
         args = fwdsumatrapdf + " " + pdfFile + " " + currentTeXFile + " " + line;
         cmd = "cmd /c " + cd + " && " + args;
         new ActiveXObject("WScript.Shell").Run(cmd, 1, true);
         break;
     case 74:
         var fso = new ActiveXObject("Scripting.FileSystemObject");
         var currentTeXFile = document.FullName;
         var pdfFile = currentTeXFile.replace(new RegExp(/\.[^.]*$/), ".pdf");
         var pdfopen = "pdfopen";
 
 main();
----

[マクロ(M)]-[カスタマイズ(C)...]-[新規作成(N)] で XeLaTeX.js を選択します.

[ツール(T)]-[オプション(O)...]-[キーボード] でショートカットキーを追加して割り当てます.

----
&color(#5F9EA0,#5F9EA0){%%%                         &color(Black){''オプション''};                     &color(#DD4444,#DD4444){%%%[ &color(White){''×''}; ]%%%};%%%};&br;
  &color(Black,#EEEEEE){%%%[ 基本 ][ 表示 ][ 記号 ]%%%};''[ キーボード ]''&color(Black,#EEEEEE){%%%[ 履歴 ][ 整形 ]%%%};&br;
&br;
   カテゴリ(%%%C%%%):                  新しいキー(%%%N%%%):&br;
   &color(Black,#EEEEEE){[マクロ                 ''ᐯ'']};   %%%Shift+Alt+I%%%&br;
&br;
   コマンド(%%%O%%%):                  現在の割り当て:&br;
   記録/停止&br;
   実行&br;
   名前を付けて保存              現在のキー(%%%U%%%):&br;
   編集&br;
   選択&br;
   これを選択&br;
   マクロのカスタマイズ&br;
   pdfpLaTeX.js&br;
   pdfpLaTeX2.js&br;
   pdfupLaTeX.js&br;
   pdfupLaTeX2.js&br;
   pdfLaTeX.js&br;
   LuaLaTeX.js&br;
   LuaJITLaTeX.js&br;
   &color(White,#1188FF){XeLaTeX.js               };&br;
&br;
----

**pBibTeX.js [#qbbeae1b]

----
 function main()
 {
   var fso = new ActiveXObject("Scripting.FileSystemObject");
   var c = document.Path;
   var b = fso.GetBaseName(document.Name);
   var cd = "cd /d " + ["\"", c, "\""].join("");
   var bibtex = "pbibtex -sjis-terminal";
   var encoding = document.Encoding;
   if (encoding == meEncodingUTF8WithoutSignature || encoding == meEncodingUTF8WithSignature || encoding == meEncodingUTF8) {
     bibtex = "pbibtex -kanji=utf8 -sjis-terminal";
   } else if (encoding == meEncodingShiftJIS) {
     bibtex = "pbibtex -kanji=sjis -sjis-terminal";
   } else if (encoding == meEncodingEUC) {
     bibtex = "pbibtex -kanji=euc -sjis-terminal";
   } else if (encoding == meEncodingJIS) {
     bibtex = "pbibtex -kanji=jis  -sjis-terminal";
   }
   bibtex += " " + ["\"", b, "\""].join("");
   var cmd = "cmd /c " + cd + " && " + bibtex;
         if (!fso.FileExists(pdfFile)) {
             var mainTeXFile = window.Prompt("Input the path to main TeX file.", pdfFile.replace(new RegExp(/\.[^.]*$/), ".tex"));
             if (mainTeXFile != "") {
                 pdfFile = mainTeXFile.replace(new RegExp(/\.[^.]*$/), ".pdf");
             }
         }
 
   var ok = window.Confirm(cmd);
   if (ok) {
     document.Save();
     new ActiveXObject("WScript.Shell").Run(cmd, 1, true);
   }
 }
         var mainTeXDir = fso.GetParentFolderName(pdfFile);
         var cd = "cd /d " + ["\"", mainTeXDir, "\""].join("");
         pdfFile = ["\"", pdfFile, "\""].join("");
 
 main();
----

[マクロ(M)]-[カスタマイズ(C)...]-[新規作成(N)] で pBibTeX.js を選択します.

[ツール(T)]-[オプション(O)...]-[キーボード] でショートカットキーを追加して割り当てます.

----
&color(#5F9EA0,#5F9EA0){%%%                         &color(Black){''オプション''};                     &color(#DD4444,#DD4444){%%%[ &color(White){''×''}; ]%%%};%%%};&br;
  &color(Black,#EEEEEE){%%%[ 基本 ][ 表示 ][ 記号 ]%%%};''[ キーボード ]''&color(Black,#EEEEEE){%%%[ 履歴 ][ 整形 ]%%%};&br;
&br;
   カテゴリ(%%%C%%%):                  新しいキー(%%%N%%%):&br;
   &color(Black,#EEEEEE){[マクロ                 ''ᐯ'']};   %%%Ctrl+Alt+N%%%&br;
&br;
   コマンド(%%%O%%%):                  現在の割り当て:&br;
   記録/停止&br;
   実行&br;
   名前を付けて保存              現在のキー(%%%U%%%):&br;
   編集&br;
   選択&br;
   これを選択&br;
   マクロのカスタマイズ&br;
   pdfpLaTeX.js&br;
   pdfpLaTeX2.js&br;
   pdfupLaTeX.js&br;
   pdfupLaTeX2.js&br;
   pdfLaTeX.js&br;
   LuaLaTeX.js&br;
   LuaJITLaTeX.js&br;
   XeLaTeX.js&br;
   &color(White,#1188FF){pBibTeX.js                };&br;
&br;
----

**upBibTeX.js [#v9f70ec9]

----
 function main()
 {
   var fso = new ActiveXObject("Scripting.FileSystemObject");
   var c = document.Path;
   var b = fso.GetBaseName(document.Name);
   var cd = "cd /d " + ["\"", c, "\""].join("");
   var bibtex = "upbibtex" + " " + ["\"", b, "\""].join("");
   var cmd = "cmd /c " + cd + " && " + bibtex;
 
   var ok = window.Confirm(cmd);
   if (ok) {
     document.Save();
     new ActiveXObject("WScript.Shell").Run(cmd, 1, true);
   }
 }
 
 main();
----

[マクロ(M)]-[カスタマイズ(C)...]-[新規作成(N)] で upBibTeX.js を選択します.

[ツール(T)]-[オプション(O)...]-[キーボード] でショートカットキーを追加して割り当てます.

----
&color(#5F9EA0,#5F9EA0){%%%                         &color(Black){''オプション''};                     &color(#DD4444,#DD4444){%%%[ &color(White){''×''}; ]%%%};%%%};&br;
  &color(Black,#EEEEEE){%%%[ 基本 ][ 表示 ][ 記号 ]%%%};''[ キーボード ]''&color(Black,#EEEEEE){%%%[ 履歴 ][ 整形 ]%%%};&br;
&br;
   カテゴリ(%%%C%%%):                  新しいキー(%%%N%%%):&br;
   &color(Black,#EEEEEE){[マクロ                 ''ᐯ'']};   %%%Shift+Alt+N%%%&br;
&br;
   コマンド(%%%O%%%):                  現在の割り当て:&br;
   記録/停止&br;
   実行&br;
   名前を付けて保存              現在のキー(%%%U%%%):&br;
   編集&br;
   選択&br;
   これを選択&br;
   マクロのカスタマイズ&br;
   pdfpLaTeX.js&br;
   pdfpLaTeX2.js&br;
   pdfupLaTeX.js&br;
   pdfupLaTeX2.js&br;
   pdfLaTeX.js&br;
   LuaLaTeX.js&br;
   LuaJITLaTeX.js&br;
   XeLaTeX.js&br;
   pBibTeX.js&br;
   &color(White,#1188FF){upBibTeX.js                };&br;
&br;
----

**Mendex.js [#ff7fca42]

----
 function main()
 {
   var fso = new ActiveXObject("Scripting.FileSystemObject");
   var c = document.Path;
   var b = fso.GetBaseName(document.Name);
   var cd = "cd /d " + ["\"", c, "\""].join("");
   var makeindex = "mendex -T";
   var encoding = document.Encoding;
   if (encoding == meEncodingUTF8WithoutSignature || encoding == meEncodingUTF8WithSignature || encoding == meEncodingUTF8) {
     makeindex = "mendex -U -T";
   } else if (encoding == meEncodingShiftJIS) {
     makeindex = "mendex -S -T";
   } else if (encoding == meEncodingEUC) {
     makeindex = "mendex -E -T";
   } else if (encoding == meEncodingJIS) {
     makeindex = "mendex -J -T";
   }
   makeindex += " " + ["\"", b, "\""].join("");
   var cmd = "cmd /c " + cd + " && " + makeindex;
 
   var ok = window.Confirm(cmd);
   if (ok) {
     document.Save();
     new ActiveXObject("WScript.Shell").Run(cmd, 1, true);
   }
 }
 
 main();
----

[マクロ(M)]-[カスタマイズ(C)...]-[新規作成(N)] で Mendex.js を選択します.

[ツール(T)]-[オプション(O)...]-[キーボード] でショートカットキーを追加して割り当てます.

----
&color(#5F9EA0,#5F9EA0){%%%                         &color(Black){''オプション''};                     &color(#DD4444,#DD4444){%%%[ &color(White){''×''}; ]%%%};%%%};&br;
  &color(Black,#EEEEEE){%%%[ 基本 ][ 表示 ][ 記号 ]%%%};''[ キーボード ]''&color(Black,#EEEEEE){%%%[ 履歴 ][ 整形 ]%%%};&br;
&br;
   カテゴリ(%%%C%%%):                  新しいキー(%%%N%%%):&br;
   &color(Black,#EEEEEE){[マクロ                 ''ᐯ'']};   %%%Ctrl+Alt+M%%%&br;
&br;
   コマンド(%%%O%%%):                  現在の割り当て:&br;
   記録/停止&br;
   実行&br;
   名前を付けて保存              現在のキー(%%%U%%%):&br;
   編集&br;
   選択&br;
   これを選択&br;
   マクロのカスタマイズ&br;
   pdfpLaTeX.js&br;
   pdfpLaTeX2.js&br;
   pdfupLaTeX.js&br;
   pdfupLaTeX2.js&br;
   pdfLaTeX.js&br;
   LuaLaTeX.js&br;
   LuaJITLaTeX.js&br;
   XeLaTeX.js&br;
   pBibTeX.js&br;
   upBibTeX.js&br;
   &color(White,#1188FF){Mendex.js                 };&br;
&br;
----

**TeXworks.js [#a5baaf50]

----
 function main()
 {
   var fso = new ActiveXObject("Scripting.FileSystemObject");
   var currentTeXFile = document.FullName;
   var pdfFile = currentTeXFile.replace(new RegExp(/\.[^.]*$/), ".pdf");
   var texworks = "texworks";
 
   if (!fso.FileExists(pdfFile)) {
     var mainTeXFile = window.Prompt("Input the path to main TeX file.", pdfFile.replace(new RegExp(/\.[^.]*$/), ".tex"));
     if (mainTeXFile != "") {
       pdfFile = mainTeXFile.replace(new RegExp(/\.[^.]*$/), ".pdf");
         var args = pdfopen + " --rxi --file " + pdfFile;
         var cmd = "cmd /c " + cd + " && echo " + args + " | cmd";
         new ActiveXObject("WScript.Shell").Run(cmd, 1, true);
         break;
     case 99:
         Quit();
         break;
     default:
         Quit();
         break;
     }
   }
 
   var mainTeXDir = fso.GetParentFolderName(pdfFile);
   var cd = "cd /d " + ["\"", mainTeXDir, "\""].join("");
   pdfFile = ["\"", pdfFile, "\""].join("");
 
   var args = texworks + " " + pdfFile;
   var cmd = "cmd /c " + cd + " && echo " + args + " | cmd";
   new ActiveXObject("WScript.Shell").Run(cmd, 1, true);
 }
 
 main();
     function execute(commandLine)
     {
         var ok = window.Confirm(commandLine);
         if (ok) {
             document.Save();
             new ActiveXObject("WScript.Shell").Run(commandLine, 1, true);
         }
     }
 }.call(this));
----

[マクロ(M)]-[カスタマイズ(C)...]-[新規作成(N)] で TeXworks.js を選択します.
[マクロ(M)]-[カスタマイズ(C)...]-[新規作成(N)] で Typeset.js を選択します.

[ツール(T)]-[オプション(O)...]-[キーボード] でショートカットキーを追加して割り当てます.
[ツール(T)]-[オプション(O)...]-[キーボード] でショートカットキー (Ctrl+T) を追加して割り当てます.

----
&color(#5F9EA0,#5F9EA0){%%%                         &color(Black){''オプション''};                     &color(#DD4444,#DD4444){%%%[ &color(White){''×''}; ]%%%};%%%};&br;
  &color(Black,#EEEEEE){%%%[ 基本 ][ 表示 ][ 記号 ]%%%};''[ キーボード ]''&color(Black,#EEEEEE){%%%[ 履歴 ][ 整形 ]%%%};&br;
&br;
   カテゴリ(%%%C%%%):                  新しいキー(%%%N%%%):&br;
   &color(Black,#EEEEEE){[マクロ                 ''ᐯ'']};   %%%Ctrl+Alt+O%%%&br;
   &color(Black,#EEEEEE){[マクロ                 ''ᐯ'']};   %%%Ctrl+T%%%&br;
&br;
   コマンド(%%%O%%%):                  現在の割り当て:&br;
   記録/停止&br;
   実行&br;
   名前を付けて保存              現在のキー(%%%U%%%):&br;
   編集&br;
   選択&br;
   これを選択&br;
   マクロのカスタマイズ&br;
   pdfpLaTeX.js&br;
   pdfpLaTeX2.js&br;
   pdfupLaTeX.js&br;
   pdfupLaTeX2.js&br;
   pdfLaTeX.js&br;
   LuaLaTeX.js&br;
   LuaJITLaTeX.js&br;
   XeLaTeX.js&br;
   pBibTeX.js&br;
   upBibTeX.js&br;
   Mendex.js&br;
   &color(White,#1188FF){TeXworks.js                };&br;
   &color(White,#1188FF){Typeset.js                };&br;
&br;
----

//*その他の便利な TeX 用マクロ [#w4fa8cd3]
//
//**[[Beta, Build: 2.0.9.3936とマクロ:http://www.haijin-boys.com/index.php?fuseaction=weblog.entryInquire&entry_id=50546e5d130fe0.87291176#comment]] [#ebdddd03]
//
//**[[テキストエディタMery用LaTeXコンパイルマクロ:http://blog.kassyi.com/2011/10/merylatex.html]] [#ffd665b4]
//
//**MeryからTeXのコンパイル&PDF生成ができるようにする (LaTeXMacro.js + makepdf.ps1) [#n2ac0dc8]
//
//-[[TexをWindowsで使う:http://blog.kassyi.com/2011/05/texwindows_05.html]]
//-[[TeXをWindowsで使う(まとめ):http://blog.kassyi.com/2011/05/texwindows.html]]

*SumatraPDF との連携 [#ra6f502f]

**forward and inverse search (SumatraPDF を前面に表示したい場合) [#deefc535]

***SumatraPDF.js [#r19c8de4]
----
 function main()
 {
   var fso = new ActiveXObject("Scripting.FileSystemObject");
   var mery = editor.FullName;
   var currentTeXFile = document.FullName;
   var pdfFile = currentTeXFile.replace(new RegExp(/\.[^.]*$/), ".pdf");
   var line = document.selection.GetActivePointY(mePosLogical);
   var sumatraPDF = "C:/Program Files/SumatraPDF/SumatraPDF.exe";
   var mainTeXDir;
   var cd;
   var cmd;
   var args;
 
   if (!fso.FileExists(sumatraPDF)) {
     sumatraPDF = "C:/Program Files (x86)/SumatraPDF/SumatraPDF.exe";
     if (!fso.FileExists(sumatraPDF)) {
       sumatraPDF = window.Prompt("Input the path to SumatraPDF.exe.", "SumatraPDF.exe");
       if (!fso.FileExists(sumatraPDF)) {
         sumatraPDF = "SumatraPDF.exe";
       }
     }
   }
 
   sumatraPDF = ["\"", sumatraPDF, "\""].join("");
 
   if (!fso.FileExists(pdfFile)) {
     var mainTeXFile = window.Prompt("Input the path to main TeX file.", pdfFile.replace(new RegExp(/\.[^.]*$/), ".tex"));
     if (mainTeXFile != "") {
       pdfFile = mainTeXFile.replace(new RegExp(/\.[^.]*$/), ".pdf");
     }
   }
 
   mainTeXDir = fso.GetParentFolderName(pdfFile);
   cd = "cd /d " + ["\"", mainTeXDir, "\""].join("");
   currentTeXFile = ["\"", currentTeXFile, "\""].join("");
   pdfFile = ["\"", pdfFile, "\""].join("");
 
   args = sumatraPDF + " -reuse-instance " + pdfFile + " -inverse-search \"\\\"" + mery + "\\\" /l %l \\\"%f\\\"\"" + " -forward-search " + currentTeXFile + " " + line;
   cmd = "cmd /c " + cd + " && echo " + args + " | cmd";
   new ActiveXObject("WScript.Shell").Run(cmd, 1, true);
 }
 
 main();
----
Typeset.js を実行して SumatraPDF を選択します.~

**forward search (SumatraPDF を前面に表示したくない場合) [#t56d91ba]

[[SumatraPDF/fwdsumatrapdf]] の fwdsumatrapdf.exe を使用します.~

***fwdsumatrapdf.js [#a81d6b86]
----
 function main()
 {
   var fso = new ActiveXObject("Scripting.FileSystemObject");
   var currentTeXFile = document.FullName;
   var pdfFile = currentTeXFile.replace(new RegExp(/\.[^.]*$/), ".pdf");
   var line = document.selection.GetActivePointY(mePosLogical);
   var fwdsumatrapdf = "C:/w32tex/NDde/Binary/fwdsumatrapdf.exe";
   var mainTeXDir;
   var cd;
   var cmd;
   var args;
Typeset.js を実行して fwdsumatrapdf を選択します.~

   if (!fso.FileExists(fwdsumatrapdf)) {
     fwdsumatrapdf = window.Prompt("Input the path to fwdsumatrapdf.exe.", "fwdsumatrapdf.exe");
     if (!fso.FileExists(fwdsumatrapdf)) {
       fwdsumatrapdf = "fwdsumatrapdf.exe";
     }
   }
 
   fwdsumatrapdf = ["\"", fwdsumatrapdf, "\""].join("");
 
   if (!fso.FileExists(pdfFile)) {
     var mainTeXFile = window.Prompt("Input the path to main TeX file.", pdfFile.replace(new RegExp(/\.[^.]*$/), ".tex"));
     if (mainTeXFile != "") {
       pdfFile = mainTeXFile.replace(new RegExp(/\.[^.]*$/), ".pdf");
     }
   }
 
   mainTeXDir = fso.GetParentFolderName(pdfFile);
   cd = "cd /d " + ["\"", mainTeXDir, "\""].join("");
   currentTeXFile = ["\"", currentTeXFile, "\""].join("");
   pdfFile = ["\"", pdfFile, "\""].join("");
 
   args = fwdsumatrapdf + " " + pdfFile + " " + currentTeXFile + " " + line;
   cmd = "cmd /c " + cd + " && " + args;
   new ActiveXObject("WScript.Shell").Run(cmd, 1, true);
 }
 
 main();
----
**inverse search [#d4cfb140]

 "C:\Mery\Mery.exe" /l %l "%f"

*Adobe Reader との連携 [#efc77172]

**pdfpLaTeXA.js [#h14da8ca]

----
 (function () {
   var fso = new ActiveXObject("Scripting.FileSystemObject");
   var c = document.Path;
   var b = fso.GetBaseName(document.Name);
   var cd = "cd /d " + ["\"", c, "\""].join("");
   var ptex2pdf = "ptex2pdf -l -ot \"-guess-input-enc -sjis-terminal\"";
   var encoding = document.Encoding;
   if (encoding == meEncodingUTF8WithoutSignature || encoding == meEncodingUTF8WithSignature || encoding == meEncodingUTF8) {
     ptex2pdf = "ptex2pdf -l -ot \"-no-guess-input-enc -kanji=utf8 -sjis-terminal\"";
   } else if (encoding == meEncodingShiftJIS) {
     ptex2pdf = "ptex2pdf -l -ot \"-no-guess-input-enc -kanji=sjis -sjis-terminal\"";
   } else if (encoding == meEncodingEUC) {
     ptex2pdf = "ptex2pdf -l -ot \"-no-guess-input-enc -kanji=euc -sjis-terminal\"";
   } else if (encoding == meEncodingJIS) {
     ptex2pdf = "ptex2pdf -l -ot \"-no-guess-input-enc -kanji=jis -sjis-terminal\"";
   }
   ptex2pdf += " " + ["\"", b, "\""].join("");
   var pdf = ["\"", b, ".pdf", "\""].join("");
   var pdfopen = "powershell -Command \"& {$pdf = \"\"" + pdf + "\"\"; $pages = (pdfinfo $pdf | Select-String \"^Pages:\"); $page = (-split $pages)[1]; pdfopen --rxi --file $pdf --page $page}\"";
   var pdfclose = "tasklist /fi \"IMAGENAME eq AcroRd32.exe\" /nh | findstr \"AcroRd32.exe\" > nul && pdfopen --rxi --file " + pdf + " && pdfclose --rxi --file " + pdf;
   var cmd = "cmd /c " + cd + " && " + pdfclose + " & " + ptex2pdf + " && " + pdfopen;
 
   var ok = window.Confirm(cmd);
   if (ok) {
     document.Save();
     new ActiveXObject("WScript.Shell").Run(cmd, 1, true);
   }
 }.call(this));
----

**pdfpLaTeX2A.js [#gd894185]

----
 function main()
 {
   var fso = new ActiveXObject("Scripting.FileSystemObject");
   var c = document.Path;
   var b = fso.GetBaseName(document.Name);
   var cd = "cd /d " + ["\"", c, "\""].join("");
   var latex = "platex -guess-input-enc -sjis-terminal";
   var encoding = document.Encoding;
   if (encoding == meEncodingUTF8WithoutSignature || encoding == meEncodingUTF8WithSignature || encoding == meEncodingUTF8) {
     latex = "platex -no-guess-input-enc -kanji=utf8 -sjis-terminal";
   } else if (encoding == meEncodingShiftJIS) {
     latex = "platex -no-guess-input-enc -kanji=sjis -sjis-terminal";
   } else if (encoding == meEncodingEUC) {
     latex = "platex -no-guess-input-enc -kanji=euc -sjis-terminal";
   } else if (encoding == meEncodingJIS) {
     latex = "platex -no-guess-input-enc -kanji=jis -sjis-terminal";
   }
   latex += " " + ["\"", b, "\""].join("");
   var dvips = "dvips -Ppdf -z -f" + " " + ["\"", b, ".dvi", "\""].join("") + " | convbkmk -g > " + ["\"", b, ".ps", "\""].join("");
   var ps2pdf = "ps2pdf.bat" + " " + ["\"", b, ".ps", "\""].join("");
   var pdf = ["\"", b, ".pdf", "\""].join("");
   var pdfopen = "powershell -Command \"& {$pdf = \"\"" + pdf + "\"\"; $pages = (pdfinfo $pdf | Select-String \"^Pages:\"); $page = (-split $pages)[1]; pdfopen --rxi --file $pdf --page $page}\"";
   var pdfclose = "tasklist /fi \"IMAGENAME eq AcroRd32.exe\" /nh | findstr \"AcroRd32.exe\" > nul && pdfopen --rxi --file " + pdf + " && pdfclose --rxi --file " + pdf;
   var cmd = "cmd /c " + cd + " && " + pdfclose + " & " + latex + " && " + dvips + " && " + ps2pdf + " && " + pdfopen;
 
   var ok = window.Confirm(cmd);
   if (ok) {
     document.Save();
     new ActiveXObject("WScript.Shell").Run(cmd, 1, true);
   }
 }
 
 main();
----

**pdfupLaTeXA.js [#hdc45060]

----
 (function () {
   var fso = new ActiveXObject("Scripting.FileSystemObject");
   var c = document.Path;
   var b = fso.GetBaseName(document.Name);
   var cd = "cd /d " + ["\"", c, "\""].join("");
   var ptex2pdf = "ptex2pdf -l -u -ot \"-no-guess-input-enc -kanji=utf8\"" + " " + ["\"", b, "\""].join("");
   var pdf = ["\"", b, ".pdf", "\""].join("");
   var pdfopen = "powershell -Command \"& {$pdf = \"\"" + pdf + "\"\"; $pages = (pdfinfo $pdf | Select-String \"^Pages:\"); $page = (-split $pages)[1]; pdfopen --rxi --file $pdf --page $page}\"";
   var pdfclose = "tasklist /fi \"IMAGENAME eq AcroRd32.exe\" /nh | findstr \"AcroRd32.exe\" > nul && pdfopen --rxi --file " + pdf + " && pdfclose --rxi --file " + pdf;
   var cmd = "cmd /c " + cd + " && " + pdfclose + " & " + ptex2pdf + " && " + pdfopen;
 
   var ok = window.Confirm(cmd);
   if (ok) {
     document.Save();
     new ActiveXObject("WScript.Shell").Run(cmd, 1, true);
   }
 }.call(this));
----

**pdfupLaTeX2A.js [#r820202a]

----
 function main()
 {
   var fso = new ActiveXObject("Scripting.FileSystemObject");
   var c = document.Path;
   var b = fso.GetBaseName(document.Name);
   var cd = "cd /d " + ["\"", c, "\""].join("");
   var latex = "uplatex -no-guess-input-enc -kanji=utf8" + " " + ["\"", b, "\""].join("");
   var dvips = "dvips -Ppdf -z -f" + " " + ["\"", b, ".dvi", "\""].join("") + " | convbkmk -u > " + ["\"", b, ".ps", "\""].join("");
   var ps2pdf = "ps2pdf.bat" + " " + ["\"", b, ".ps", "\""].join("");
   var pdf = ["\"", b, ".pdf", "\""].join("");
   var pdfopen = "powershell -Command \"& {$pdf = \"\"" + pdf + "\"\"; $pages = (pdfinfo $pdf | Select-String \"^Pages:\"); $page = (-split $pages)[1]; pdfopen --rxi --file $pdf --page $page}\"";
   var pdfclose = "tasklist /fi \"IMAGENAME eq AcroRd32.exe\" /nh | findstr \"AcroRd32.exe\" > nul && pdfopen --rxi --file " + pdf + " && pdfclose --rxi --file " + pdf;
   var cmd = "cmd /c " + cd + " && " + pdfclose + " & " + latex + " && " + dvips + " && " + ps2pdf + " && " + pdfopen;
 
   var ok = window.Confirm(cmd);
   if (ok) {
     document.Save();
     new ActiveXObject("WScript.Shell").Run(cmd, 1, true);
   }
 }
 
 main();
----

**pdfLaTeXA.js [#u17bbe76]

----
 function main()
 {
   var fso = new ActiveXObject("Scripting.FileSystemObject");
   var c = document.Path;
   var b = fso.GetBaseName(document.Name);
   var cd = "cd /d " + ["\"", c, "\""].join("");
   var pdflatex = "pdflatex" + " " + ["\"", b, "\""].join("");
   var pdf = ["\"", b, ".pdf", "\""].join("");
   var pdfopen = "powershell -Command \"& {$pdf = \"\"" + pdf + "\"\"; $pages = (pdfinfo $pdf | Select-String \"^Pages:\"); $page = (-split $pages)[1]; pdfopen --rxi --file $pdf --page $page}\"";
   var pdfclose = "tasklist /fi \"IMAGENAME eq AcroRd32.exe\" /nh | findstr \"AcroRd32.exe\" > nul && pdfopen --rxi --file " + pdf + " && pdfclose --rxi --file " + pdf;
   var cmd = "cmd /c " + cd + " && " + pdfclose + " & " + pdflatex + " && " + pdfopen;
 
   var ok = window.Confirm(cmd);
   if (ok) {
     document.Save();
     new ActiveXObject("WScript.Shell").Run(cmd, 1, true);
   }
 }
 
 main();
----

**LuaLaTeXA.js [#k5350e5c]

----
 function main()
 {
   var fso = new ActiveXObject("Scripting.FileSystemObject");
   var c = document.Path;
   var b = fso.GetBaseName(document.Name);
   var cd = "cd /d " + ["\"", c, "\""].join("");
   var lualatex = "lualatex" + " " + ["\"", b, "\""].join("");
   var pdf = ["\"", b, ".pdf", "\""].join("");
   var pdfopen = "powershell -Command \"& {$pdf = \"\"" + pdf + "\"\"; $pages = (pdfinfo $pdf | Select-String \"^Pages:\"); $page = (-split $pages)[1]; pdfopen --rxi --file $pdf --page $page}\"";
   var pdfclose = "tasklist /fi \"IMAGENAME eq AcroRd32.exe\" /nh | findstr \"AcroRd32.exe\" > nul && pdfopen --rxi --file " + pdf + " && pdfclose --rxi --file " + pdf;
   var cmd = "cmd /c " + cd + " && " + pdfclose + " & " + lualatex + " && " + pdfopen;
 
   var ok = window.Confirm(cmd);
   if (ok) {
     document.Save();
     new ActiveXObject("WScript.Shell").Run(cmd, 1, true);
   }
 }
 
 main();
----

**LuaJITLaTeXA.js [#occ79e7c]

----
 function main()
 {
   var fso = new ActiveXObject("Scripting.FileSystemObject");
   var c = document.Path;
   var b = fso.GetBaseName(document.Name);
   var cd = "cd /d " + ["\"", c, "\""].join("");
   var luajitlatex = "luajitlatex" + " " + ["\"", b, "\""].join("");
   var pdf = ["\"", b, ".pdf", "\""].join("");
   var pdfopen = "powershell -Command \"& {$pdf = \"\"" + pdf + "\"\"; $pages = (pdfinfo $pdf | Select-String \"^Pages:\"); $page = (-split $pages)[1]; pdfopen --rxi --file $pdf --page $page}\"";
   var pdfclose = "tasklist /fi \"IMAGENAME eq AcroRd32.exe\" /nh | findstr \"AcroRd32.exe\" > nul && pdfopen --rxi --file " + pdf + " && pdfclose --rxi --file " + pdf;
   var cmd = "cmd /c " + cd + " && " + pdfclose + " & " + luajitlatex + " && " + pdfopen;
 
   var ok = window.Confirm(cmd);
   if (ok) {
     document.Save();
     new ActiveXObject("WScript.Shell").Run(cmd, 1, true);
   }
 }
 
 main();
----

**XeLaTeXA.js [#hbb42785]

----
 function main()
 {
   var fso = new ActiveXObject("Scripting.FileSystemObject");
   var c = document.Path;
   var b = fso.GetBaseName(document.Name);
   var cd = "cd /d " + ["\"", c, "\""].join("");
   var xelatex = "xelatex" + " " + ["\"", b, "\""].join("");
   var pdf = ["\"", b, ".pdf", "\""].join("");
   var pdfopen = "powershell -Command \"& {$pdf = \"\"" + pdf + "\"\"; $pages = (pdfinfo $pdf | Select-String \"^Pages:\"); $page = (-split $pages)[1]; pdfopen --rxi --file $pdf --page $page}\"";
   var pdfclose = "tasklist /fi \"IMAGENAME eq AcroRd32.exe\" /nh | findstr \"AcroRd32.exe\" > nul && pdfopen --rxi --file " + pdf + " && pdfclose --rxi --file " + pdf;
   var cmd = "cmd /c " + cd + " && " + pdfclose + " & " + xelatex + " && " + pdfopen;
 
   var ok = window.Confirm(cmd);
   if (ok) {
     document.Save();
     new ActiveXObject("WScript.Shell").Run(cmd, 1, true);
   }
 }
 
 main();
----