[[サクラエディタ]] > マクロ

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

----
#contents
----

*マクロ [#k75075b0]

-サクラエディタ Ver. 2.0.7.0 で ExpandParameter にタイプ別設定の名前などの追加が行われました (→ [[Sakura Editor / Code / Commit [r2746]:http://sourceforge.net/p/sakura-editor/code/2746/]])
-サクラエディタ Ver. 2.0.6.0 で ExpandParameter の機能追加が行われました (→ [[Sakura Editor / PatchUnicode / #302 ExpandParameter機能追加等:http://sourceforge.net/p/sakura-editor/patchunicode/302/]])
-[[Macro - SakuraEditorWiki:http://sakura.qp.land.to/?Macro]]
//-[[サクラエディタマクロ:http://www.geocities.jp/maru3128/SakuraMacro/]]
//--[[リファレンス目次:http://www.geocities.jp/maru3128/SakuraMacro/reference/]]
//---[[S_ExpandParameter:http://www.geocities.jp/maru3128/SakuraMacro/reference/other/S_ExpandParameter.html]]
--[[Macro/投稿:http://sakura.qp.land.to/?Macro%2F%C5%EA%B9%C6]]
-[https://sourceforge.net/p/sakura-editor/patchunicode/761/ Sakura Editor / PatchUnicode / #761 ポップアップメニュー作成マクロ追加]
-[https://sourceforge.net/p/sakura-editor/code/3907/ Sakura Editor / Code / Commit [r3907] New: ポップアップメニュー作成マクロ追加]
//-[[サクラエディタマクロ:http://sakura.qp.land.to/SakuraMacro/]]
//--[[リファレンス目次:http://sakura.qp.land.to/SakuraMacro/reference/]]
//---[[S_ExpandParameter:http://sakura.qp.land.to/SakuraMacro/reference/other/S_ExpandParameter.html]]
//-[[サクラエディタ  ヘルプ目次:http://sakura-editor.svn.sourceforge.net/viewvc/sakura-editor/help/trunk2/_RESOURCE/HLP000001.html]]
//--[[ヘルプファイル更新履歴:http://sakura-editor.svn.sourceforge.net/viewvc/sakura-editor/help/trunk2/_RESOURCE/HLP_HISTORY.html]]
//--[[マクロ:http://sakura-editor.svn.sourceforge.net/viewvc/sakura-editor/help/trunk2/_RESOURCE/HLP000001.html#c927]]
//--[[ExpandParameter:http://sakura-editor.svn.sourceforge.net/viewvc/sakura-editor/help/trunk2/_RESOURCE/HLP000284.html]]
//-[[サクラエディタ  ヘルプ目次:https://sourceforge.net/p/sakura-editor/code/HEAD/tree/help/trunk2/_RESOURCE/HLP000001.html]]
//--[[ヘルプファイル更新履歴:https://sourceforge.net/p/sakura-editor/code/HEAD/tree/help/trunk2/_RESOURCE/HLP_HISTORY.html]]
//--[[マクロ:https://sourceforge.net/p/sakura-editor/code/HEAD/tree/help/trunk2/_RESOURCE/HLP000001.html#c927]]
//--[[ExpandParameter:https://sourceforge.net/p/sakura-editor/code/HEAD/tree/help/trunk2/_RESOURCE/HLP000284.html]]
-[[サクラエディタ  ヘルプ目次:http://sakura-editor.sourceforge.net/htmlhelp2/]]
//--[[ヘルプファイル更新履歴:http://sakura-editor.sourceforge.net/htmlhelp2/HLP_HISTORY.html]]
--[[マクロ:http://sakura-editor.sourceforge.net/htmlhelp2/#c927]]
---[[外部コマンド実行:http://sakura-editor.sourceforge.net/htmlhelp2/HLP000103.html]]
---[[マクロ専用関数:http://sakura-editor.sourceforge.net/htmlhelp2/HLP000268.html]]
---[[ExpandParameter:http://sakura-editor.sourceforge.net/htmlhelp2/HLP000284.html]]
-[[Windows Script Host:http://msdn.microsoft.com/ja-jp/library/cc364455.aspx]]
-[[Windows Script Host Laboratory:http://www.roy.hi-ho.ne.jp/mutaguchi/wsh/]]
-[[サクラエディタのマクロが50件しか登録できない悩みを解決するかも知れない launcher.js:http://muumoo.jp/news/2006/10/04/0launcherjs.html]]
-[[TOY BOX ver.0.2: サクラエディタ:http://toybox-v2.blogspot.com/search/label/%E3%82%B5%E3%82%AF%E3%83%A9%E3%82%A8%E3%83%87%E3%82%A3%E3%82%BF]]
--[[サクラエディタでよく使うマクロ2つ:http://toybox-v2.blogspot.com/2011/09/2.html]]
-[[サクラエディタを青空文庫形式入力支援に使うためのマクロについて:http://takenokoshobo.com/kdp/manual_ao_epub/4.html]]
-[[選択行コメントアウト:http://sakura.qp.land.to/?Macro%2F%C5%EA%B9%C6%2F64]]
(maru さん)
//(JScript)
-[[upLaTeX (ptex2pdf) または LuaLaTeX でタイプセット → PDF を表示:http://sakura.qp.land.to/?Macro%2F%C5%EA%B9%C6%2F76]]
(sai さん)
//(JScript)
-[[LaTeX用タイプセットスクリプト:http://sakura.qp.land.to/?Macro%2F%C5%EA%B9%C6%2F79]]
(sai さん)
-[[Tex用画像挿入:http://sakura.qp.land.to/?Macro%2F%C5%EA%B9%C6%2F77]]
(てふにしゃん さん)
-[[Tex用数式挿入:http://sakura.qp.land.to/?Macro%2F%C5%EA%B9%C6%2F78]]
(てふにしゃん さん)
//(JScript)
-[[VSライクなhtml終タグ自動補完 & texの\end補完:http://sakura.qp.land.to/?Macro%2F%C5%EA%B9%C6%2F158]]
(peak さん)
//(JScript)
-[[LaTeX+SakuraEditorマクロ:http://www.sidewarehouse.net/sakura.html]]
(横倉 勇希 さん)
//(JScript)
-[[SakuraエディタのTeX用マクロ:http://execyou.blogspot.com/]]
(横前 拓磨 さん)
//(JScript)
-[[サクラエディタ - PukiWiki for PBCG Lab:http://www.slis.tsukuba.ac.jp/~fujisawa.makoto.fu/cgi-bin/wiki/index.php?%A5%B5%A5%AF%A5%E9%A5%A8%A5%C7%A5%A3%A5%BF]]
(藤澤 誠 (fujis) さん)
//(JScript)
-[[サクラエディタで Aspell のマクロを作ってみる(不完全版):http://margaret-sdpara.blogspot.jp/2014/04/aspell.html]]
(Margaret さん)
//(JScript)

マクロを使うと LaTeX 環境を簡単に作ることができます.~
共通設定のマクロタブからマクロファイルが格納されているフォルダを参照して,名前,File,Id を指定し,マクロを実行するたびにファイルを読み込みなおす にチェックを入れて設定をクリックします.~
マクロを実行するたびにファイルを読み込みなおす のチェックが外れている場合,マクロを登録した後で,マクロファイルの内容を変更しても変更内容が反映されないので注意してください.~
登録したマクロは,メニューの [ツール(T)] → [登録済みマクロ(B)] から選択することで実行できます.~
マクロを使うと LaTeX 環境を簡単に作ることができます.
共通設定のマクロタブからマクロファイルが格納されているフォルダを参照して,名前,File,Id を指定し,マクロを実行するたびにファイルを読み込みなおす にチェックを入れて設定をクリックします.
マクロを実行するたびにファイルを読み込みなおす のチェックが外れている場合,マクロを登録した後で,マクロファイルの内容を変更しても変更内容が反映されないので注意してください.
登録したマクロは,メニューの [ツール(T)] > [登録済みマクロ(B)] から選択することで実行できます.
登録したくない場合は [ツール(T)] > [名前を指定してマクロ実行(E)...] からファイルを選択して実行できます.

----
&color(#FF77AA,#FF77AA){%%%                             &color(Black){''共通設定''};                     &color(#FF77AA,#FA77AA){%%%[ &color(Black){''?''}; ]%%%};&color(#DD4444,#DD4444){%%%[ &color(White){''×''}; ]%%%};%%%};&br;
>
&color(#FF77AA,#FF77AA){%%%                             &color(Black){''共通設定''};                     &color(#FF77AA,#FA77AA){%%%[ &color(Black){''?''}; ]%%%};&color(#DD4444,#DD4444){%%%[ &color(White){''🗙''}; ]%%%};%%%};&br;
 &color(Black,#EEEEEE){%%%[  ファイル  ][  ファイル名表示  ][  バックアップ  ][  書式   ][  検索   ][  キー割り当て  ]%%%};&br;
 &color(Black,#EEEEEE){%%%[ 全般 ][ ウィンドウ ][ メインメニュー ][ ツールバー ][ タブバー ][ ステータスバー ][ 編集 ]%%%};&br;
 &color(Black,#EEEEEE){%%%[  カスタムメニュー   ][  強調キーワード   ][  支援   ]%%%};''[   マクロ    ]''&color(Black,#EEEEEE){%%%[  プラグイン  ]%%%};&br;

&br;
 マクロ一覧    %%%.\macro\%%%                                    &color(Black,#EEEEEE){[ 参照(R)... ]};&br;
 ∣%%% 番号 ∣ マクロ名    ∣ ファイル名    ∣ 実行時に読み込み   ∣ 自動実行    %%%∣&br;
 ∣&color(White,#1188FF){ 0     pdfpLaTeX   pdfpLaTeX.js      on                        };&br;
 ∣&color(White,#1188FF){ 0     Typeset     Typeset.js       on                        };&br;
 ∣ 1                             off&br;
 ∣ 2                             off&br;
 ∣ …                              …&br;
 ∣ 47                             off&br;
 ∣ 48                             off&br;
 ∣ 49                             off&br;

  名前(N)  %%%pdfpLaTeX                                  %%%  Id: &color(Black,#EEEEEE){[0   ''ᐯ'']};&br;
  File     %%%pdfpLaTeX.js                                 ''ᐯ''%%%  &color(Black,#EEEEEE){[ 設定(A) ]};&br;
&br;
  名前(N)  %%%Typeset                                    %%%  Id: &color(Black,#EEEEEE){[0   ''ᐯ'']};&br;
  File     %%%Typeset.js                                   ''ᐯ''%%%  &color(Black,#EEEEEE){[ 設定(A) ]};&br;
  ☑マクロを実行するたびにファイルを読み込みなおす(L)   キャンセル確認待ち時間 %%%10%%%  秒&br;
  自動実行:  ☐新規/開ファイル後(O)   ☐タイプ変更後(T)   ☐ファイル保存前(S)&br;
----
<

以下のマクロを使用する場合は サクラエディタ Ver. 2.0.6.0 以上が必要です.
**マクロにショートカットキーを割り当てる方法 [#ubcf1bda]

**pdfpLaTeX.js [#y5c91d76]

----
 (function () {
   var c = Editor.ExpandParameter("$e");
   var b = Editor.ExpandParameter("$g");
   var cd = "cd /d " + ["\"", c, "\""].join("");
   var ptex2pdf = "ptex2pdf -l -ot \"-synctex=1 -guess-input-enc -sjis-terminal\"";
   var charCode = Editor.GetCharCode();
   if (charCode == 4) {
     ptex2pdf = "ptex2pdf -l -ot \"-synctex=1 -no-guess-input-enc -kanji=utf8 -sjis-terminal\"";
   } else if (charCode == 0) {
     ptex2pdf = "ptex2pdf -l -ot \"-synctex=1 -no-guess-input-enc -kanji=sjis -sjis-terminal\"";
   } else if (charCode == 2) {
     ptex2pdf = "ptex2pdf -l -ot \"-synctex=1 -no-guess-input-enc -kanji=euc -sjis-terminal\"";
   } else if (charCode == 1) {
     ptex2pdf = "ptex2pdf -l -ot \"-synctex=1 -no-guess-input-enc -kanji=jis -sjis-terminal\"";
   }
   ptex2pdf += " " + ["\"", b, "\""].join("");
   var cmd = "cmd /c " + cd + " && " + ptex2pdf;
 
   var button = Editor.MessageBox(cmd, 1);
   if (button == 1) {
     Editor.FileSave();
     Editor.ExecCommand(cmd, 1);
   }
 }.call(this));
----

:キー割り当て|Ctrl+Alt+J

**pdfpLaTeX2.js [#u8bcfaaf]

----
 (function () {
   var c = Editor.ExpandParameter("$e");
   var b = Editor.ExpandParameter("$g");
   var cd = "cd /d " + ["\"", c, "\""].join("");
   var latex = "platex -synctex=1 -guess-input-enc -sjis-terminal";
   var charCode = Editor.GetCharCode();
   if (charCode == 4) {
     latex = "platex -synctex=1 -no-guess-input-enc -kanji=utf8 -sjis-terminal";
   } else if (charCode == 0) {
     latex = "platex -synctex=1 -no-guess-input-enc -kanji=sjis -sjis-terminal";
   } else if (charCode == 2) {
     latex = "platex -synctex=1 -no-guess-input-enc -kanji=euc -sjis-terminal";
   } else if (charCode == 1) {
     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 button = Editor.MessageBox(cmd, 1);
   if (button == 1) {
     Editor.FileSave();
     Editor.ExecCommand(cmd, 1);
   }
 }.call(this));
----

:キー割り当て|Ctrl+Alt+K

**pdfupLaTeX.js [#l9863978]

----
 (function () {
   var c = Editor.ExpandParameter("$e");
   var b = Editor.ExpandParameter("$g");
   var cd = "cd /d " + ["\"", c, "\""].join("");
   var ptex2pdf = "ptex2pdf -l -u -ot \"-synctex=1 -no-guess-input-enc -kanji=utf8 -sjis-terminal\"" + " " + ["\"", b, "\""].join("");
   var cmd = "cmd /c " + cd + " && " + ptex2pdf;
 
   var button = Editor.MessageBox(cmd, 1);
   if (button == 1) {
     Editor.FileSave();
     Editor.ExecCommand(cmd, 1);
   }
 }.call(this));
----

:キー割り当て|Shift+Alt+J

**pdfupLaTeX2.js [#h46c2bcd]

----
 (function () {
   var c = Editor.ExpandParameter("$e");
   var b = Editor.ExpandParameter("$g");
   var cd = "cd /d " + ["\"", c, "\""].join("");
   var latex = "uplatex -synctex=1 -no-guess-input-enc -kanji=utf8 -sjis-terminal" + " " + ["\"", 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 button = Editor.MessageBox(cmd, 1);
   if (button == 1) {
     Editor.FileSave();
     Editor.ExecCommand(cmd, 1);
   }
 }.call(this));
----

:キー割り当て|Shift+Alt+K

**pdfLaTeX.js [#yf857fdc]

----
 (function () {
   var c = Editor.ExpandParameter("$e");
   var b = Editor.ExpandParameter("$g");
   var cd = "cd /d " + ["\"", c, "\""].join("");
   var pdflatex = "pdflatex -synctex=1" + " " + ["\"", b, "\""].join("");
   var cmd = "cmd /c " + cd + " && " + pdflatex;
 
   var button = Editor.MessageBox(cmd, 1);
   if (button == 1) {
     Editor.FileSave();
     Editor.ExecCommand(cmd, 1);
   }
 }.call(this));
----

:キー割り当て|Shift+Alt+H

**LuaLaTeX.js [#b5787795]

----
 (function () {
   var c = Editor.ExpandParameter("$e");
   var b = Editor.ExpandParameter("$g");
   var cd = "cd /d " + ["\"", c, "\""].join("");
   var lualatex = "lualatex -synctex=1" + " " + ["\"", b, "\""].join("");
   var cmd = "cmd /c " + cd + " && " + lualatex;
 
   var button = Editor.MessageBox(cmd, 1);
   if (button == 1) {
     Editor.FileSave();
     Editor.ExecCommand(cmd, 1);
   }
 }.call(this));
----

:キー割り当て|Shift+Alt+Y

**LuaJITLaTeX.js [#w564abd7]

----
 (function () {
   var c = Editor.ExpandParameter("$e");
   var b = Editor.ExpandParameter("$g");
   var cd = "cd /d " + ["\"", c, "\""].join("");
   var luajitlatex = "luajitlatex -synctex=1" + " " + ["\"", b, "\""].join("");
   var cmd = "cmd /c " + cd + " && " + luajitlatex;
 
   var button = Editor.MessageBox(cmd, 1);
   if (button == 1) {
     Editor.FileSave();
     Editor.ExecCommand(cmd, 1);
   }
 }.call(this));
----

:キー割り当て|Shift+Alt+U

**XeLaTeX.js [#pf46590c]

----
 (function () {
   var c = Editor.ExpandParameter("$e");
   var b = Editor.ExpandParameter("$g");
   var cd = "cd /d " + ["\"", c, "\""].join("");
   var xelatex = "xelatex -synctex=1" + " " + ["\"", b, "\""].join("");
   var cmd = "cmd /c " + cd + " && " + xelatex;
 
   var button = Editor.MessageBox(cmd, 1);
   if (button == 1) {
     Editor.FileSave();
     Editor.ExecCommand(cmd, 1);
   }
 }.call(this));
----

:キー割り当て|Shift+Alt+I

**pBibTeX.js [#ib5040ed]

----
 (function () {
   var c = Editor.ExpandParameter("$e");
   var b = Editor.ExpandParameter("$g");
   var cd = "cd /d " + ["\"", c, "\""].join("");
   var bibtex = "pbibtex -sjis-terminal";
   var charCode = Editor.GetCharCode();
   if (charCode == 4) {
     bibtex = "pbibtex -kanji=utf8 -sjis-terminal";
   } else if (charCode == 0) {
     bibtex = "pbibtex -kanji=sjis -sjis-terminal";
   } else if (charCode == 2) {
     bibtex = "pbibtex -kanji=euc -sjis-terminal";
   } else if (charCode == 1) {
     bibtex = "pbibtex -kanji=jis -sjis-terminal";
   }
   bibtex += " " + ["\"", b, "\""].join("");
   var cmd = "cmd /c " + cd + " && " + bibtex;
 
   var button = Editor.MessageBox(cmd, 1);
   if (button == 1) {
     Editor.FileSave();
     Editor.ExecCommand(cmd, 1);
   }
 }.call(this));
----

:キー割り当て|Ctrl+Alt+N

**upBibTeX.js [#deacfc6b]

----
 (function () {
   var c = Editor.ExpandParameter("$e");
   var b = Editor.ExpandParameter("$g");
   var cd = "cd /d " + ["\"", c, "\""].join("");
   var bibtex = "upbibtex" + " " + ["\"", b, "\""].join("");
   var cmd = "cmd /c " + cd + " && " + bibtex;
 
   var button = Editor.MessageBox(cmd, 1);
   if (button == 1) {
     Editor.FileSave();
     Editor.ExecCommand(cmd, 1);
   }
 }.call(this));
----

:キー割り当て|Shift+Alt+N

**BibTeX.js [#acb2369f]

----
 (function () {
   var c = Editor.ExpandParameter("$e");
   var b = Editor.ExpandParameter("$g");
   var cd = "cd /d " + ["\"", c, "\""].join("");
   var bibtex = "bibtex" + " " + ["\"", b, "\""].join("");
   var cmd = "cmd /c " + cd + " && " + bibtex;
 
   var button = Editor.MessageBox(cmd, 1);
   if (button == 1) {
     Editor.FileSave();
     Editor.ExecCommand(cmd, 1);
   }
 }.call(this));
----

**BibTeXu.js [#ld3350a2]

----
 (function () {
   var c = Editor.ExpandParameter("$e");
   var b = Editor.ExpandParameter("$g");
   var cd = "cd /d " + ["\"", c, "\""].join("");
   var bibtex = "bibtexu" + " " + ["\"", b, "\""].join("");
   var cmd = "cmd /c " + cd + " && " + bibtex;
 
   var button = Editor.MessageBox(cmd, 1);
   if (button == 1) {
     Editor.FileSave();
     Editor.ExecCommand(cmd, 1);
   }
 }.call(this));
----

**Mendex.js [#p1a2e7ba]

----
 (function () {
   var c = Editor.ExpandParameter("$e");
   var b = Editor.ExpandParameter("$g");
   var cd = "cd /d " + ["\"", c, "\""].join("");
   var makeindex = "mendex -T";
   var charCode = Editor.GetCharCode();
   if (charCode == 4) {
     makeindex = "mendex -U -T";
   } else if (charCode == 0) {
     makeindex = "mendex -S -T";
   } else if (charCode == 2) {
     makeindex = "mendex -E -T";
   } else if (charCode == 1) {
     makeindex = "mendex -J -T";
   }
   makeindex += " " + ["\"", b, "\""].join("");
   var cmd = "cmd /c " + cd + " && " + makeindex;
 
   var button = Editor.MessageBox(cmd, 1);
   if (button == 1) {
     Editor.FileSave();
     Editor.ExecCommand(cmd, 1);
   }
 }.call(this));
----

:キー割り当て|Ctrl+Alt+M

**MakeIndex.js [#t0c4bf6a]

----
 (function () {
   var c = Editor.ExpandParameter("$e");
   var b = Editor.ExpandParameter("$g");
   var cd = "cd /d " + ["\"", c, "\""].join("");
   var makeindex = "makeindex" + " " + ["\"", b, "\""].join("");
   var cmd = "cmd /c " + cd + " && " + makeindex;
 
   var button = Editor.MessageBox(cmd, 1);
   if (button == 1) {
     Editor.FileSave();
     Editor.ExecCommand(cmd, 1);
   }
 }.call(this));
----

**TeXindy.js [#f07f070d]

----
 (function () {
   var c = Editor.ExpandParameter("$e");
   var b = Editor.ExpandParameter("$g");
   var cd = "cd /d " + ["\"", c, "\""].join("");
   var makeindex = "texindy" + " " + ["\"", b, "\""].join("");
   var cmd = "cmd /c " + cd + " && " + makeindex;
 
   var button = Editor.MessageBox(cmd, 1);
   if (button == 1) {
     Editor.FileSave();
     Editor.ExecCommand(cmd, 1);
   }
 }.call(this));
----

**TeXworks.js [#w4b007fd]

----
 (function () {
   var fso = new ActiveXObject("Scripting.FileSystemObject");
   var currentTeXFile = Editor.ExpandParameter("$F");
   var pdfFile = currentTeXFile.replace(new RegExp(/\.[^.]*$/), ".pdf");
   var texworks = "texworks";
 
   if (!fso.FileExists(pdfFile)) {
     var mainTeXFile = Editor.InputBox("Input the path to main TeX file.", pdfFile.replace(new RegExp(/\.[^.]*$/), ".tex"), 255);
     if (mainTeXFile != "") {
       pdfFile = mainTeXFile.replace(new RegExp(/\.[^.]*$/), ".pdf");
     }
   }
 
   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";
   Editor.ExecCommand(cmd, 1);
 }.call(this));
----

:キー割り当て|Ctrl+Alt+O

*マクロにショートカットキーを割り当てる方法 [#ubcf1bda]

-[[キー割り当て一覧:http://sakura-editor.sourceforge.net/htmlhelp/HLP000107.html]]
-[[キー割り当て一覧:http://sakura-editor.sourceforge.net/htmlhelp2/HLP000107.html]]
-[[Macro/マクロファイルの実行 - SakuraEditorWiki:http://sakura.qp.land.to/?Macro%2F%A5%DE%A5%AF%A5%ED%A5%D5%A5%A1%A5%A4%A5%EB%A4%CE%BC%C2%B9%D4]]
-[[サクラエディタの外部マクロにショートカットキーに割り当てる:http://d.hatena.ne.jp/nanntekotta/20100623/]]
-[[サクラエディタの自作マクロにショートカットキーを割り当てる方法:http://muumoo.jp/news/2008/02/10/0sakuramacro.html]]

----
&color(#FF77AA,#FF77AA){%%%                             &color(Black){''共通設定''};                     &color(#FF77AA,#FA77AA){%%%[ &color(Black){''?''}; ]%%%};&color(#DD4444,#DD4444){%%%[ &color(White){''×''}; ]%%%};%%%};&br;
>
&color(#FF77AA,#FF77AA){%%%                             &color(Black){''共通設定''};                     &color(#FF77AA,#FA77AA){%%%[ &color(Black){''?''}; ]%%%};&color(#DD4444,#DD4444){%%%[ &color(White){''🗙''}; ]%%%};%%%};&br;
 &color(Black,#EEEEEE){%%%[  カスタムメニュー   ][  強調キーワード   ][  支援    ][   マクロ    ][  プラグイン  ]%%%};&br;
 &color(Black,#EEEEEE){%%%[ 全般  ][ ウィンドウ ][ メインメニュー ][ ツールバー ][ タブバー ][ ステータスバー ][ 編集 ]%%%};&br;
 &color(Black,#EEEEEE){%%%[  ファイル  ][  ファイル名表示  ][  バックアップ  ][  書式   ][  検索   ]%%%};''[  キー割り当て  ]''&br;

&br;
      種別(K) &color(Black,#EEEEEE){[ 外部マクロ      ''ᐯ'']};          &color(Black,#EEEEEE){[ インポート(I)... ]}; &color(Black,#EEEEEE){[ エクスポート(X)... ]};&br;
  機能(F)                             キー(Y)&br;
  マクロ 0 (未登録)                        &color(White,#1188FF){ダブルクリック              };&br;
  マクロ 1 (未登録)                 ☐Shift    右クリック&br;
  マクロ 2 (未登録)                        中クリック&br;
  マクロ 3 (未登録)                 ☐Ctrl    左サイドクリック&br;
  マクロ 4 (未登録)                        右サイドクリック&br;
  マクロ 5 (未登録)                 ☐Alt    トリプルクリック&br;
  マクロ 6 (未登録)                        クアドラプルクリック&br;
  マクロ 7 (未登録)                        ホイールアップ&br;
  マクロ 8 (未登録)                        ホイールダウン&br;
  マクロ 9 (未登録)                        ホイール左&br;
  …                                 …&br;
 %%% 機能に割り当てられているキー(G)    %%%&br;
&br;
                             &color(#888888,#EEEEEE){[割付(B)]}; キーに割り当てられている機能&br;
 %%%                          %%%  &color(Black,#EEEEEE){[解除(R)]}; %%%現在位置の単語選択%%%&br;
  ☐ウィンドウ毎にアクセラレータテーブルを作成する(Wine用)(W)&br;
----
&br;
<

*その他の便利な TeX 用マクロ [#u28c7ea5]
**Typeset.js [#i861969f]

**Macro - SakuraEditorWiki [#o5661c6c]
-[[Macro - SakuraEditorWiki:http://sakura.qp.land.to/?Macro]]
--[[Macro/投稿:http://sakura.qp.land.to/?Macro%2F%C5%EA%B9%C6]]
***選択行コメントアウト [#ned6c107]
-[[選択行コメントアウト:http://sakura.qp.land.to/?Macro%2F%C5%EA%B9%C6%2F64]]
(maru さん)
//(JScript)
***Tex用画像挿入 [#yc92f02e]
-[[Tex用画像挿入:http://sakura.qp.land.to/?Macro%2F%C5%EA%B9%C6%2F77]]
(てふにしゃん さん)
***Tex用数式挿入 [#r86d3294]
-[[Tex用数式挿入:http://sakura.qp.land.to/?Macro%2F%C5%EA%B9%C6%2F78]]
(てふにしゃん さん)
***TeX→PDF用マクロ [#l1f44e08]
-[[TeX→PDF用マクロ:http://sakura.qp.land.to/?Macro%2F%C5%EA%B9%C6%2F79]]
(てふにしゃん さん)
//(JScript)
***VSライクなhtml終タグ自動補完 &amp; texの\end補完: [#sfb49cfa]
-[[VSライクなhtml終タグ自動補完 &amp; texの\end補完:http://sakura.qp.land.to/?Macro%2F%C5%EA%B9%C6%2F158]]
(peak さん)
//(JScript)
**LaTeX+SakuraEditorマクロ [#y54f2100]
-[[LaTeX+SakuraEditorマクロ:http://www.sidewarehouse.net/sakura.html]]
(横倉 勇希 さん)
//(JScript)
//**サクラエディタ用TeXマクロ [#c3c7d37d]
//-[[サクラエディタ用TeXマクロ:http://kentarodev.up.seesaa.net/files/fileIndex.html]]
//(Kentaro (PortableMe) さん)
//(JScript)
**SakuraエディタのTeX用マクロ [#ra3e1193]
-[[SakuraエディタのTeX用マクロ:http://execyou.blogspot.com/]]
(横前 拓磨 さん)
//(JScript)
**サクラエディタ - PukiWiki for PBCG Lab [#t65f472c]
-[[サクラエディタ - PukiWiki for PBCG Lab:http://www.slis.tsukuba.ac.jp/~fujis/cgi-bin/wiki/index.php?%A5%B5%A5%AF%A5%E9%A5%A8%A5%C7%A5%A3%A5%BF]]
(藤澤 誠 (fujis) さん)
//(JScript)
//**TeXファイルのコンパイル [#k202d7e6]
//-[[TeXファイルのコンパイル:http://gusukus.blog50.fc2.com/blog-entry-10.html]]
//-[[TeXファイルのコンパイル:http://web.archive.org/web/20080611144911/http://gusukus.blog50.fc2.com/]]
//(ぐすく さん)
//-[[TeXファイルのコンパイル &#8211; サクラエディタ用マクロ | shiro.be:http://shiro.be/archives/135]]
//(しろ さん)
//(JScript)
**サクラエディタでAspell [#b5a2307d]
-[[サクラエディタでAspell:http://detail.chiebukuro.yahoo.co.jp/qa/question_detail/q1036830290]]
(angel_o_f_hell さん, pa10user さん)
//(JScript)
-[[Aspell の導入:http://yaplog.jp/ukokke69/archive/2032]] (うこっけ さん)
Typeset.js を使用する場合は サクラエディタ Ver. 2.2.0.0 以降が必要です.

*SumatraPDF との連携 [#t7a83c73]
Typeset.js をメインメニューに追加する場合は [設定(O)] &gt; [共通設定(C)...] のメインメニューのタブの種別(K)から外部マクロを選択してTypesetを選び [>>(B)] をクリックして追加します.

**forward and inverse search (SumatraPDF を前面に表示したい場合) [#p7bf3825]
キー割り当てを行う場合は Ctrl+Alt+J などのまだ割り当てられていないキーに設定してください.

***SumatraPDF.js [#s758d3d9]
----
 (function () {
   var fso = new ActiveXObject("Scripting.FileSystemObject");
   var sakuraEditor = Editor.ExpandParameter("$S");
   var currentTeXFile = Editor.ExpandParameter("$F");
   var pdfFile = currentTeXFile.replace(new RegExp(/\.[^.]*$/), ".pdf");
   var line = Editor.ExpandParameter("$y");
   var sumatraPDF = "C:/Program Files/SumatraPDF/SumatraPDF.exe";
   var mainTeXDir;
   var cd;
   var cmd;
   var args;
     var menuItem = Editor.CreateMenu(0, "\
 []upLaTeX (ptex2pdf),\
 []upLaTeX (dvips + ps2pdf),\
 []pLaTeX-ng,\
 []pdfLaTeX,\
 []LuaLaTeX,\
 []LuajitLaTeX,\
 []XeLaTeX,\
 []Latexmk,\
 []Latexmk-upLaTeX,\
 []Latexmk-upLaTeX-pdfps,\
 []Latexmk-pLaTeX-ng,\
 []Latexmk-pdfLaTeX,\
 []Latexmk-LuaLaTeX,\
 []Latexmk-LuajitLaTeX,\
 []Latexmk-XeLaTeX,\
 []Latexmk-upLaTeX-acroread,\
 []Latexmk-upLaTeX-pdfps-acroread,\
 []Latexmk-pLaTeX-ng-acroread,\
 []Latexmk-pdfLaTeX-acroread,\
 []Latexmk-LuaLaTeX-acroread,\
 []Latexmk-LuajitLaTeX-acroread,\
 []Latexmk-XeLaTeX-acroread,\
 -,\
 []SumatraPDF,\
 []fwdsumatrapdf,\
 []TeXworks,\
 []TeXstudio,\
 []Adobe Acrobat Reader DC,\
 -,\
 []Quit");
     switch (menuItem) {
     case 1:
         var c = Editor.ExpandParameter("$e");
         var b = Editor.ExpandParameter("$g");
         var cd = "cd /d " + ["\"", c, "\""].join("");
         var ptex2pdf = "ptex2pdf -u -l -ot \"-no-guess-input-enc -kanji=utf8 -synctex=1\"" + " " + ["\"", b, "\""].join("");
         var cmd = "cmd /c " + cd + " && " + ptex2pdf;
         execute(cmd, true);
         break;
     case 2:
         var c = Editor.ExpandParameter("$e");
         var b = Editor.ExpandParameter("$g");
         var cd = "cd /d " + ["\"", c, "\""].join("");
         var latex = "uplatex -no-guess-input-enc -kanji=utf8 -synctex=1" + " " + ["\"", b, "\""].join("");
         var dvips = "dvips -Ppdf -z -f" + " " + ["\"", b, ".dvi", "\""].join("") + " | convbkmk -u > " + ["\"", b, ".ps", "\""].join("");
         var ps2pdf = "ps2pdf.exe" + " " + ["\"", b, ".ps", "\""].join("");
         var cmd = "cmd /c " + cd + " && " + latex + " && " + dvips + " && " + ps2pdf;
         execute(cmd, true);
         break;
     case 3:
         var c = Editor.ExpandParameter("$e");
         var b = Editor.ExpandParameter("$g");
         var cd = "cd /d " + ["\"", c, "\""].join("");
         var platex_ng = "platex-ng -synctex=1" + " " + ["\"", b, "\""].join("");
         var cmd = "cmd /c " + cd + " && " + platex_ng;
         execute(cmd, true);
         break;
     case 4:
         var c = Editor.ExpandParameter("$e");
         var b = Editor.ExpandParameter("$g");
         var cd = "cd /d " + ["\"", c, "\""].join("");
         var pdflatex = "pdflatex -synctex=1" + " " + ["\"", b, "\""].join("");
         var cmd = "cmd /c " + cd + " && " + pdflatex;
         execute(cmd, true);
         break;
     case 5:
         var c = Editor.ExpandParameter("$e");
         var b = Editor.ExpandParameter("$g");
         var cd = "cd /d " + ["\"", c, "\""].join("");
         var lualatex = "lualatex -synctex=1" + " " + ["\"", b, "\""].join("");
         var cmd = "cmd /c " + cd + " && " + lualatex;
         execute(cmd, true);
         break;
     case 6:
         var c = Editor.ExpandParameter("$e");
         var b = Editor.ExpandParameter("$g");
         var cd = "cd /d " + ["\"", c, "\""].join("");
         var luajitlatex = "luajitlatex -synctex=1" + " " + ["\"", b, "\""].join("");
         var cmd = "cmd /c " + cd + " && " + luajitlatex;
         execute(cmd, true);
         break;
     case 7:
         var c = Editor.ExpandParameter("$e");
         var b = Editor.ExpandParameter("$g");
         var cd = "cd /d " + ["\"", c, "\""].join("");
         var xelatex = "xelatex -synctex=1" + " " + ["\"", b, "\""].join("");
         var cmd = "cmd /c " + cd + " && " + xelatex;
         execute(cmd, true);
         break;
     case 8:
         var c = Editor.ExpandParameter("$e");
         var b = Editor.ExpandParameter("$g");
         var cd = "cd /d " + ["\"", c, "\""].join("");
         var latexmk = "latexmk" + " " + ["\"", b, "\""].join("");
         var cmd = "cmd /c " + cd + " && " + latexmk;
         execute(cmd, true);
         break;
     case 9:
         var c = Editor.ExpandParameter("$e");
         var b = Editor.ExpandParameter("$g");
         var cd = "cd /d " + ["\"", c, "\""].join("");
         var latexmk = "latexmk -e \"$$latex=q/uplatex %O -kanji=utf8 -no-guess-input-enc -synctex=1 %S/\" -e \"$$bibtex=q/bibtexu %O %B/\" -e \"$$biber=q/biber %O --bblencoding=utf8 -u -U --output_safechars %B/\" -e \"$$makeindex=q/upmendex %O -o %D %S/\" -e \"$$dvipdf=q/dvipdfmx %O -o %D %S/\" -norc -gg -pdfdvi" + " " + ["\"", b, "\""].join("");
         var cmd = "cmd /c " + cd + " && " + latexmk;
         execute(cmd, true);
         break;
     case 10:
         var c = Editor.ExpandParameter("$e");
         var b = Editor.ExpandParameter("$g");
         var cd = "cd /d " + ["\"", c, "\""].join("");
         var latexmk = "latexmk -e \"$$latex=q/uplatex %O -kanji=utf8 -no-guess-input-enc -synctex=1 %S/\" -e \"$$bibtex=q/bibtexu %O %B/\" -e \"$$biber=q/biber %O --bblencoding=utf8 -u -U --output_safechars %B/\" -e \"$$makeindex=q/upmendex %O -o %D %S/\" -e \"$$dvips=q/dvips %O -z -f %S | convbkmk -u > %D/\" -e \"$$ps2pdf=q/ps2pdf.exe %O %S %D/\" -norc -gg -pdfps" + " " + ["\"", b, "\""].join("");
         var cmd = "cmd /c " + cd + " && " + latexmk;
         execute(cmd, true);
         break;
     case 11:
         var c = Editor.ExpandParameter("$e");
         var b = Editor.ExpandParameter("$g");
         var cd = "cd /d " + ["\"", c, "\""].join("");
         var latexmk = "latexmk -e \"$$pdflatex=q/platex-ng %O -synctex=1 %S/\" -e \"$$bibtex=q/bibtexu %O %B/\" -e \"$$biber=q/biber %O --bblencoding=utf8 -u -U --output_safechars %B/\" -e \"$$makeindex=q/upmendex %O -o %D %S/\" -norc -gg -pdf" + " " + ["\"", b, "\""].join("");
         var cmd = "cmd /c " + cd + " && " + latexmk;
         execute(cmd, true);
         break;
     case 12:
         var c = Editor.ExpandParameter("$e");
         var b = Editor.ExpandParameter("$g");
         var cd = "cd /d " + ["\"", c, "\""].join("");
         var latexmk = "latexmk -e \"$$pdflatex=q/pdflatex %O -synctex=1 %S/\" -e \"$$bibtex=q/bibtex %O %B/\" -e \"$$biber=q/biber %O --bblencoding=utf8 -u -U --output_safechars %B/\" -e \"$$makeindex=q/makeindex %O -o %D %S/\" -norc -gg -pdf" + " " + ["\"", b, "\""].join("");
         var cmd = "cmd /c " + cd + " && " + latexmk;
         execute(cmd, true);
         break;
     case 13:
         var c = Editor.ExpandParameter("$e");
         var b = Editor.ExpandParameter("$g");
         var cd = "cd /d " + ["\"", c, "\""].join("");
         var latexmk = "latexmk -e \"$$lualatex=q/lualatex %O -synctex=1 %S/\" -e \"$$bibtex=q/bibtexu %O %B/\" -e \"$$biber=q/biber %O --bblencoding=utf8 -u -U --output_safechars %B/\" -e \"$$makeindex=q/upmendex %O -o %D %S/\" -norc -gg -pdflua" + " " + ["\"", b, "\""].join("");
         var cmd = "cmd /c " + cd + " && " + latexmk;
         execute(cmd, true);
         break;
     case 14:
         var c = Editor.ExpandParameter("$e");
         var b = Editor.ExpandParameter("$g");
         var cd = "cd /d " + ["\"", c, "\""].join("");
         var latexmk = "latexmk -e \"$$lualatex=q/luajitlatex %O -synctex=1 %S/\" -e \"$$bibtex=q/bibtexu %O %B/\" -e \"$$biber=q/biber %O --bblencoding=utf8 -u -U --output_safechars %B/\" -e \"$$makeindex=q/upmendex %O -o %D %S/\" -norc -gg -pdflua" + " " + ["\"", b, "\""].join("");
         var cmd = "cmd /c " + cd + " && " + latexmk;
         execute(cmd, true);
         break;
     case 15:
         var c = Editor.ExpandParameter("$e");
         var b = Editor.ExpandParameter("$g");
         var cd = "cd /d " + ["\"", c, "\""].join("");
         var latexmk = "latexmk -e \"$$xelatex=q/xelatex %O -synctex=1 %S/\" -e \"$$bibtex=q/bibtexu %O %B/\" -e \"$$biber=q/biber %O --bblencoding=utf8 -u -U --output_safechars %B/\" -e \"$$makeindex=q/upmendex %O -o %D %S/\" -norc -gg -pdfxe" + " " + ["\"", b, "\""].join("");
         var cmd = "cmd /c " + cd + " && " + latexmk;
         execute(cmd, true);
         break;
     case 16:
         var currentTeXFile = Editor.ExpandParameter("$F");
         var suffix = /\.[^.]*$/;
         var pdfFile = currentTeXFile.replace(suffix, ".pdf");
         var line = Editor.ExpandParameter("$y");
         var c = Editor.ExpandParameter("$e");
         var b = Editor.ExpandParameter("$g");
         var cd = "cd /d " + ["\"", c, "\""].join("");
         var latexmk = "latexmk -e \"$$latex=q/uplatex %O -kanji=utf8 -no-guess-input-enc -synctex=1 %S/\" -e \"$$bibtex=q/bibtexu %O %B/\" -e \"$$biber=q/biber %O --bblencoding=utf8 -u -U --output_safechars %B/\" -e \"$$makeindex=q/upmendex %O -o %D %S/\" -e \"$$dvipdf=q/dvipdfmx %O -o %D %S/\" -norc -gg -pdfdvi" + " " + ["\"", b, "\""].join("");
         var pdf = ["\"", b, ".pdf", "\""].join("");
         var pdfopen = "synctex view -i \"" + line + ":0:" + currentTeXFile + "\" -o \"" + pdfFile + "\" -x \"pdfopen --page %{page+1} --file \"%{output}\"\"";
         var pdfclose = "tasklist /fi \"IMAGENAME eq Acrobat.exe\" /nh | findstr \"Acrobat.exe\" > nul && pdfopen --file " + pdf + " && pdfclose --file " + pdf;
         var cmd = "cmd /c " + cd + " && " + pdfclose + " & " + latexmk + " && " + pdfopen;
         execute(cmd, true);
         break;
     case 17:
         var currentTeXFile = Editor.ExpandParameter("$F");
         var suffix = /\.[^.]*$/;
         var pdfFile = currentTeXFile.replace(suffix, ".pdf");
         var line = Editor.ExpandParameter("$y");
         var c = Editor.ExpandParameter("$e");
         var b = Editor.ExpandParameter("$g");
         var cd = "cd /d " + ["\"", c, "\""].join("");
         var latexmk = "latexmk -e \"$$latex=q/uplatex %O -kanji=utf8 -no-guess-input-enc -synctex=1 %S/\" -e \"$$bibtex=q/bibtexu %O %B/\" -e \"$$biber=q/biber %O --bblencoding=utf8 -u -U --output_safechars %B/\" -e \"$$makeindex=q/upmendex %O -o %D %S/\" -e \"$$dvips=q/dvips %O -z -f %S | convbkmk -u > %D/\" -e \"$$ps2pdf=q/ps2pdf.exe %O %S %D/\" -norc -gg -pdfps" + " " + ["\"", b, "\""].join("");
         var pdf = ["\"", b, ".pdf", "\""].join("");
         var pdfopen = "synctex view -i \"" + line + ":0:" + currentTeXFile + "\" -o \"" + pdfFile + "\" -x \"pdfopen --page %{page+1} --file \"%{output}\"\"";
         var pdfclose = "tasklist /fi \"IMAGENAME eq Acrobat.exe\" /nh | findstr \"Acrobat.exe\" > nul && pdfopen --file " + pdf + " && pdfclose --file " + pdf;
         var cmd = "cmd /c " + cd + " && " + pdfclose + " & " + latexmk + " && " + pdfopen;
         execute(cmd, true);
         break;
     case 18:
         var currentTeXFile = Editor.ExpandParameter("$F");
         var suffix = /\.[^.]*$/;
         var pdfFile = currentTeXFile.replace(suffix, ".pdf");
         var line = Editor.ExpandParameter("$y");
         var c = Editor.ExpandParameter("$e");
         var b = Editor.ExpandParameter("$g");
         var cd = "cd /d " + ["\"", c, "\""].join("");
         var latexmk = "latexmk -e \"$$pdflatex=q/platex-ng %O -synctex=1 %S/\" -e \"$$bibtex=q/bibtexu %O %B/\" -e \"$$biber=q/biber %O --bblencoding=utf8 -u -U --output_safechars %B/\" -e \"$$makeindex=q/upmendex %O -o %D %S/\" -norc -gg -pdf" + " " + ["\"", b, "\""].join("");
         var pdf = ["\"", b, ".pdf", "\""].join("");
         var pdfopen = "synctex view -i \"" + line + ":0:" + currentTeXFile + "\" -o \"" + pdfFile + "\" -x \"pdfopen --page %{page+1} --file \"%{output}\"\"";
         var pdfclose = "tasklist /fi \"IMAGENAME eq Acrobat.exe\" /nh | findstr \"Acrobat.exe\" > nul && pdfopen --file " + pdf + " && pdfclose --file " + pdf;
         var cmd = "cmd /c " + cd + " && " + pdfclose + " & " + latexmk + " && " + pdfopen;
         execute(cmd, true);
         break;
     case 19:
         var currentTeXFile = Editor.ExpandParameter("$F");
         var suffix = /\.[^.]*$/;
         var pdfFile = currentTeXFile.replace(suffix, ".pdf");
         var line = Editor.ExpandParameter("$y");
         var c = Editor.ExpandParameter("$e");
         var b = Editor.ExpandParameter("$g");
         var cd = "cd /d " + ["\"", c, "\""].join("");
         var latexmk = "latexmk -e \"$$pdflatex=q/pdflatex %O -synctex=1 %S/\" -e \"$$bibtex=q/bibtex %O %B/\" -e \"$$biber=q/biber %O --bblencoding=utf8 -u -U --output_safechars %B/\" -e \"$$makeindex=q/makeindex %O -o %D %S/\" -norc -gg -pdf" + " " + ["\"", b, "\""].join("");
         var pdf = ["\"", b, ".pdf", "\""].join("");
         var pdfopen = "synctex view -i \"" + line + ":0:" + currentTeXFile + "\" -o \"" + pdfFile + "\" -x \"pdfopen --page %{page+1} --file \"%{output}\"\"";
         var pdfclose = "tasklist /fi \"IMAGENAME eq Acrobat.exe\" /nh | findstr \"Acrobat.exe\" > nul && pdfopen --file " + pdf + " && pdfclose --file " + pdf;
         var cmd = "cmd /c " + cd + " && " + pdfclose + " & " + latexmk + " && " + pdfopen;
         execute(cmd, true);
         break;
     case 20:
         var currentTeXFile = Editor.ExpandParameter("$F");
         var suffix = /\.[^.]*$/;
         var pdfFile = currentTeXFile.replace(suffix, ".pdf");
         var line = Editor.ExpandParameter("$y");
         var c = Editor.ExpandParameter("$e");
         var b = Editor.ExpandParameter("$g");
         var cd = "cd /d " + ["\"", c, "\""].join("");
         var latexmk = "latexmk -e \"$$lualatex=q/lualatex %O -synctex=1 %S/\" -e \"$$bibtex=q/bibtexu %O %B/\" -e \"$$biber=q/biber %O --bblencoding=utf8 -u -U --output_safechars %B/\" -e \"$$makeindex=q/upmendex %O -o %D %S/\" -norc -gg -pdflua" + " " + ["\"", b, "\""].join("");
         var pdf = ["\"", b, ".pdf", "\""].join("");
         var pdfopen = "synctex view -i \"" + line + ":0:" + currentTeXFile + "\" -o \"" + pdfFile + "\" -x \"pdfopen --page %{page+1} --file \"%{output}\"\"";
         var pdfclose = "tasklist /fi \"IMAGENAME eq Acrobat.exe\" /nh | findstr \"Acrobat.exe\" > nul && pdfopen --file " + pdf + " && pdfclose --file " + pdf;
         var cmd = "cmd /c " + cd + " && " + pdfclose + " & " + latexmk + " && " + pdfopen;
         execute(cmd, true);
         break;
     case 21:
         var currentTeXFile = Editor.ExpandParameter("$F");
         var suffix = /\.[^.]*$/;
         var pdfFile = currentTeXFile.replace(suffix, ".pdf");
         var line = Editor.ExpandParameter("$y");
         var c = Editor.ExpandParameter("$e");
         var b = Editor.ExpandParameter("$g");
         var cd = "cd /d " + ["\"", c, "\""].join("");
         var latexmk = "latexmk -e \"$$lualatex=q/luajitlatex %O -synctex=1 %S/\" -e \"$$bibtex=q/bibtexu %O %B/\" -e \"$$biber=q/biber %O --bblencoding=utf8 -u -U --output_safechars %B/\" -e \"$$makeindex=q/upmendex %O -o %D %S/\" -norc -gg -pdflua" + " " + ["\"", b, "\""].join("");
         var pdf = ["\"", b, ".pdf", "\""].join("");
         var pdfopen = "synctex view -i \"" + line + ":0:" + currentTeXFile + "\" -o \"" + pdfFile + "\" -x \"pdfopen --page %{page+1} --file \"%{output}\"\"";
         var pdfclose = "tasklist /fi \"IMAGENAME eq Acrobat.exe\" /nh | findstr \"Acrobat.exe\" > nul && pdfopen --file " + pdf + " && pdfclose --file " + pdf;
         var cmd = "cmd /c " + cd + " && " + pdfclose + " & " + latexmk + " && " + pdfopen;
         execute(cmd, true);
         break;
     case 22:
         var currentTeXFile = Editor.ExpandParameter("$F");
         var suffix = /\.[^.]*$/;
         var pdfFile = currentTeXFile.replace(suffix, ".pdf");
         var line = Editor.ExpandParameter("$y");
         var c = Editor.ExpandParameter("$e");
         var b = Editor.ExpandParameter("$g");
         var cd = "cd /d " + ["\"", c, "\""].join("");
         var latexmk = "latexmk -e \"$$xelatex=q/xelatex %O -synctex=1 %S/\" -e \"$$bibtex=q/bibtexu %O %B/\" -e \"$$biber=q/biber %O --bblencoding=utf8 -u -U --output_safechars %B/\" -e \"$$makeindex=q/upmendex %O -o %D %S/\" -norc -gg -pdfxe" + " " + ["\"", b, "\""].join("");
         var pdf = ["\"", b, ".pdf", "\""].join("");
         var pdfopen = "synctex view -i \"" + line + ":0:" + currentTeXFile + "\" -o \"" + pdfFile + "\" -x \"pdfopen --page %{page+1} --file \"%{output}\"\"";
         var pdfclose = "tasklist /fi \"IMAGENAME eq Acrobat.exe\" /nh | findstr \"Acrobat.exe\" > nul && pdfopen --file " + pdf + " && pdfclose --file " + pdf;
         var cmd = "cmd /c " + cd + " && " + pdfclose + " & " + latexmk + " && " + pdfopen;
         execute(cmd, true);
         break;
     case 23:
         var fso = new ActiveXObject("Scripting.FileSystemObject");
         var wshShell = new ActiveXObject("WScript.Shell");
         var sakuraEditor = Editor.ExpandParameter("$S");
         var currentTeXFile = Editor.ExpandParameter("$F");
         var suffix = /\.[^.]*$/;
         var pdfFile = currentTeXFile.replace(suffix, ".pdf");
         var line = Editor.ExpandParameter("$y");
         var sumatraPDF = "C:\\Program Files\\SumatraPDF\\SumatraPDF.exe";
         var existSumatraPDF = true;
 
   if (!fso.FileExists(sumatraPDF)) {
     sumatraPDF = "C:/Program Files (x86)/SumatraPDF/SumatraPDF.exe";
     if (!fso.FileExists(sumatraPDF)) {
       sumatraPDF = Editor.InputBox("Input the path to SumatraPDF.exe.", "SumatraPDF.exe", 255);
       if (!fso.FileExists(sumatraPDF)) {
         sumatraPDF = "SumatraPDF.exe";
       }
     }
   }
         try {
             sumatraPDF = wshShell.RegRead("HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\SumatraPDF.exe\\");
         } catch (e) {
             if (!fso.FileExists(sumatraPDF)) {
                 sumatraPDF = Editor.InputBox("Input the path to SumatraPDF.exe.", "SumatraPDF.exe", 255);
                 if (!fso.FileExists(sumatraPDF)) {
                     sumatraPDF = "rundll32 shell32,ShellExec_RunDLL SumatraPDF";
                     existSumatraPDF = false;
                 }
             }
         }
 
   sumatraPDF = ["\"", sumatraPDF, "\""].join("");
         if (existSumatraPDF) {
             sumatraPDF = ["\"", sumatraPDF, "\""].join("");
         }
 
   if (!fso.FileExists(pdfFile)) {
     var mainTeXFile = Editor.InputBox("Input the path to main TeX file.", pdfFile.replace(new RegExp(/\.[^.]*$/), ".tex"), 255);
     if (mainTeXFile != "") {
       pdfFile = mainTeXFile.replace(new RegExp(/\.[^.]*$/), ".pdf");
     }
   }
         if (!fso.FileExists(pdfFile)) {
             var mainTeXFile = Editor.InputBox("Input the path to main TeX file.", pdfFile.replace(suffix, ".tex"), 255);
             if (mainTeXFile != "") {
                 pdfFile = mainTeXFile.replace(suffix, ".pdf");
             }
         }
 
   mainTeXDir = fso.GetParentFolderName(pdfFile);
   cd = "cd /d " + ["\"", mainTeXDir, "\""].join("");
   currentTeXFile = ["\"", currentTeXFile, "\""].join("");
   pdfFile = ["\"", pdfFile, "\""].join("");
         var mainTeXDir = fso.GetParentFolderName(pdfFile);
         var cd = "cd /d " + ["\"", mainTeXDir, "\""].join("");
         currentTeXFile = ["\"", currentTeXFile, "\""].join("");
         pdfFile = ["\"", pdfFile, "\""].join("");
 
   args = sumatraPDF + " -reuse-instance " + pdfFile + " -inverse-search \"\\\"" + sakuraEditor + "\\\" -Y=%l \\\"%f\\\"\"" + " -forward-search " + currentTeXFile + " " + line;
   cmd = "cmd /c " + cd + " && echo " + args + " | cmd";
   Editor.ExecCommand(cmd, 1);
 }.call(this));
----

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

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

***fwdsumatrapdf.js [#ce8c0353]
----
 (function () {
   var fso = new ActiveXObject("Scripting.FileSystemObject");
   var currentTeXFile = Editor.ExpandParameter("$F");
   var pdfFile = currentTeXFile.replace(new RegExp(/\.[^.]*$/), ".pdf");
   var line = Editor.ExpandParameter("$y");
   var fwdsumatrapdf = "C:/w32tex/bin/fwdsumatrapdf.exe";
   var mainTeXDir;
   var cd;
   var cmd;
   var args;

   if (!fso.FileExists(fwdsumatrapdf)) {
     fwdsumatrapdf = Editor.InputBox("Input the path to fwdsumatrapdf.exe.", "fwdsumatrapdf.exe", 255);
     if (!fso.FileExists(fwdsumatrapdf)) {
       fwdsumatrapdf = "fwdsumatrapdf.exe";
     }
   }
         var args = sumatraPDF + " -reuse-instance " + pdfFile + " -inverse-search \"\\\"" + sakuraEditor + "\\\" -X=%c -Y=%l \\\"%f\\\"\"" + " -forward-search " + currentTeXFile + " " + line;
         var cmd = "cmd /c " + cd + " && echo " + args + " | cmd";
         execute(cmd, false);
         break;
     case 24:
         var fso = new ActiveXObject("Scripting.FileSystemObject");
         var currentTeXFile = Editor.ExpandParameter("$F");
         var suffix = /\.[^.]*$/;
         var pdfFile = currentTeXFile.replace(suffix, ".pdf");
         var line = Editor.ExpandParameter("$y");
         var fwdsumatrapdf = "fwdsumatrapdf.exe";
 
   fwdsumatrapdf = ["\"", fwdsumatrapdf, "\""].join("");
         if (!fso.FileExists(pdfFile)) {
             var mainTeXFile = Editor.InputBox("Input the path to main TeX file.", pdfFile.replace(suffix, ".tex"), 255);
             if (mainTeXFile != "") {
                 pdfFile = mainTeXFile.replace(suffix, ".pdf");
             }
         }
 
   if (!fso.FileExists(pdfFile)) {
     var mainTeXFile = Editor.InputBox("Input the path to main TeX file.", pdfFile.replace(new RegExp(/\.[^.]*$/), ".tex"), 255);
     if (mainTeXFile != "") {
       pdfFile = mainTeXFile.replace(new RegExp(/\.[^.]*$/), ".pdf");
     }
   }
         var mainTeXDir = fso.GetParentFolderName(pdfFile);
         var cd = "cd /d " + ["\"", mainTeXDir, "\""].join("");
         currentTeXFile = ["\"", currentTeXFile, "\""].join("");
         pdfFile = ["\"", pdfFile, "\""].join("");
 
   mainTeXDir = fso.GetParentFolderName(pdfFile);
   cd = "cd /d " + ["\"", mainTeXDir, "\""].join("");
   currentTeXFile = ["\"", currentTeXFile, "\""].join("");
   pdfFile = ["\"", pdfFile, "\""].join("");
         var args = fwdsumatrapdf + " " + pdfFile + " " + currentTeXFile + " " + line;
         var cmd = "cmd /c " + cd + " && " + args;
         execute(cmd, false);
         break;
     case 25:
         var fso = new ActiveXObject("Scripting.FileSystemObject");
         var currentTeXFile = Editor.ExpandParameter("$F");
         var suffix = /\.[^.]*$/;
         var pdfFile = currentTeXFile.replace(suffix, ".pdf");
         var line = Editor.ExpandParameter("$y");
         var texworks = "texworks";
 
   args = fwdsumatrapdf + " " + pdfFile + " " + currentTeXFile + " " + line;
   cmd = "cmd /c " + cd + " && " + args;
   Editor.ExecCommand(cmd, 1);
 }.call(this));
         if (!fso.FileExists(pdfFile)) {
             var mainTeXFile = Editor.InputBox("Input the path to main TeX file.", pdfFile.replace(suffix, ".tex"), 255);
             if (mainTeXFile != "") {
                 pdfFile = mainTeXFile.replace(suffix, ".pdf");
             }
         }
 
         var mainTeXDir = fso.GetParentFolderName(pdfFile);
         var cd = "cd /d " + ["\"", mainTeXDir, "\""].join("");
         var args = "synctex view -i \"" + line + ":0:" + currentTeXFile + "\" -o \"" + pdfFile + "\" -x \"" + texworks + " --position=%{page+1} \"%{output}\"\"";
 
         var cmd = "cmd /c " + cd + " && echo " + args + " | cmd";
         execute(cmd, false);
         break;
     case 26:
         var fso = new ActiveXObject("Scripting.FileSystemObject");
         var currentTeXFile = Editor.ExpandParameter("$F");
         var suffix = /\.[^.]*$/;
         var pdfFile = currentTeXFile.replace(suffix, ".pdf");
         var line = Editor.ExpandParameter("$y");
         var texstudio = "texstudio";
 
         if (!fso.FileExists(pdfFile)) {
             var mainTeXFile = Editor.InputBox("Input the path to main TeX file.", pdfFile.replace(suffix, ".tex"), 255);
             if (mainTeXFile != "") {
                 pdfFile = mainTeXFile.replace(suffix, ".pdf");
             }
         }
 
         var mainTeXDir = fso.GetParentFolderName(pdfFile);
         var cd = "cd /d " + ["\"", mainTeXDir, "\""].join("");
         var args = "synctex view -i \"" + line + ":0:" + currentTeXFile + "\" -o \"" + pdfFile + "\" -x \"" + texstudio + " --pdf-viewer-only --page %{page+1} \"%{output}\"\"";
 
         var cmd = "cmd /c " + cd + " && echo " + args + " | cmd";
         execute(cmd, false);
         break;
     case 27:
         var fso = new ActiveXObject("Scripting.FileSystemObject");
         var currentTeXFile = Editor.ExpandParameter("$F");
         var suffix = /\.[^.]*$/;
         var pdfFile = currentTeXFile.replace(suffix, ".pdf");
         var line = Editor.ExpandParameter("$y");
         var pdfopen = "pdfopen";
 
         if (!fso.FileExists(pdfFile)) {
             var mainTeXFile = Editor.InputBox("Input the path to main TeX file.", pdfFile.replace(suffix, ".tex"), 255);
             if (mainTeXFile != "") {
                 pdfFile = mainTeXFile.replace(suffix, ".pdf");
             }
         }
 
         var mainTeXDir = fso.GetParentFolderName(pdfFile);
         var cd = "cd /d " + ["\"", mainTeXDir, "\""].join("");
         var args = "synctex view -i \"" + line + ":0:" + currentTeXFile + "\" -o \"" + pdfFile + "\" -x \"" + pdfopen + " --page %{page+1} --file \"%{output}\"\"";
 
         var cmd = "cmd /c " + cd + " && echo " + args + " | cmd";
         execute(cmd, false);
         break;
     case 28:
         return;
         break;
     default:
         return;
         break;
     }
 
     function execute(commandLine, save) {
         Editor.StatusMsg(commandLine, 0);
         if (save) {
             Editor.FileSave();
         }
         Editor.ExecCommand(commandLine, 0x81);
     }
 })();
----

**inverse search [#uf1eff38]
 "C:\Program Files\sakura\sakura.exe" -Y=%l "%f"
 "C:\Program Files (x86)\sakura\sakura.exe" -Y=%l "%f"
または
 "C:\Program Files\sakura\sakura.exe" -Y:%l "%f"
 "C:\Program Files (x86)\sakura\sakura.exe" -Y:%l "%f"
*SumatraPDF との連携 [#t7a83c73]

*Adobe Reader との連携 [#md7b02af]
**forward and inverse search (SumatraPDF を前面に表示したい場合) [#p7bf3825]

**pdfpLaTeXA.js [#m4b6208e]
Typeset.js を実行して

----
 (function () {
   var c = Editor.ExpandParameter("$e");
   var b = Editor.ExpandParameter("$g");
   var cd = "cd /d " + ["\"", c, "\""].join("");
   var ptex2pdf = "ptex2pdf -l -ot \"-guess-input-enc -sjis-terminal\"";
   var charCode = Editor.GetCharCode();
   if (charCode == 4) {
     ptex2pdf = "ptex2pdf -l -ot \"-no-guess-input-enc -kanji=utf8 -sjis-terminal\"";
   } else if (charCode == 0) {
     ptex2pdf = "ptex2pdf -l -ot \"-no-guess-input-enc -kanji=sjis -sjis-terminal\"";
   } else if (charCode == 2) {
     ptex2pdf = "ptex2pdf -l -ot \"-no-guess-input-enc -kanji=euc -sjis-terminal\"";
   } else if (charCode == 1) {
     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 button = Editor.MessageBox(cmd, 1);
   if (button == 1) {
     Editor.FileSave();
     Editor.ExecCommand(cmd, 1);
   }
 }.call(this));
----
-upLaTeX (ptex2pdf)
-upLaTeX (dvips + ps2pdf)
-pLaTeX-ng
-pdfLaTeX
-LuaLaTeX
-LuajitLaTeX
-XeLaTeX
-Latexmk-upLaTeX
-Latexmk-upLaTeX-pdfps
-Latexmk-pLaTeX-ng
-Latexmk-pdfLaTeX
-Latexmk-LuaLaTeX
-Latexmk-LuajitLaTeX
-Latexmk-XeLaTeX

**pdfpLaTeX2A.js [#dab82aa3]
を選択します.

----
 (function () {
   var c = Editor.ExpandParameter("$e");
   var b = Editor.ExpandParameter("$g");
   var cd = "cd /d " + ["\"", c, "\""].join("");
   var latex = "platex -guess-input-enc -sjis-terminal";
   var charCode = Editor.GetCharCode();
   if (charCode == 4) {
     latex = "platex -no-guess-input-enc -kanji=utf8 -sjis-terminal";
   } else if (charCode == 0) {
     latex = "platex -no-guess-input-enc -kanji=sjis -sjis-terminal";
   } else if (charCode == 2) {
     latex = "platex -no-guess-input-enc -kanji=euc -sjis-terminal";
   } else if (charCode == 1) {
     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 button = Editor.MessageBox(cmd, 1);
   if (button == 1) {
     Editor.FileSave();
     Editor.ExecCommand(cmd, 1);
   }
 }.call(this));
----
再び Typeset.js を実行して SumatraPDF を選択します.

**pdfupLaTeXA.js [#p63937bf]
**forward search (SumatraPDF を前面に表示したくない場合) [#wa5982c4]

----
 (function () {
   var c = Editor.ExpandParameter("$e");
   var b = Editor.ExpandParameter("$g");
   var cd = "cd /d " + ["\"", c, "\""].join("");
   var ptex2pdf = "ptex2pdf -l -u -ot \"-no-guess-input-enc -kanji=utf8 -sjis-terminal\"" + " " + ["\"", 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 button = Editor.MessageBox(cmd, 1);
   if (button == 1) {
     Editor.FileSave();
     Editor.ExecCommand(cmd, 1);
   }
 }.call(this));
----
[[SumatraPDF/fwdsumatrapdf]] の fwdsumatrapdf.exe を使用します.~

**pdfupLaTeX2A.js [#q7e5677d]
Typeset.js を実行して

----
 (function () {
   var c = Editor.ExpandParameter("$e");
   var b = Editor.ExpandParameter("$g");
   var cd = "cd /d " + ["\"", c, "\""].join("");
   var latex = "uplatex -no-guess-input-enc -kanji=utf8 -sjis-terminal" + " " + ["\"", 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 button = Editor.MessageBox(cmd, 1);
   if (button == 1) {
     Editor.FileSave();
     Editor.ExecCommand(cmd, 1);
   }
 }.call(this));
----
-upLaTeX (ptex2pdf)
-upLaTeX (dvips + ps2pdf)
-pLaTeX-ng
-pdfLaTeX
-LuaLaTeX
-LuajitLaTeX
-XeLaTeX
-Latexmk-upLaTeX
-Latexmk-upLaTeX-pdfps
-Latexmk-pLaTeX-ng
-Latexmk-pdfLaTeX
-Latexmk-LuaLaTeX
-Latexmk-LuajitLaTeX
-Latexmk-XeLaTeX

**pdfLaTeXA.js [#sf8bfeac]
を選択します.

----
 (function () {
   var c = Editor.ExpandParameter("$e");
   var b = Editor.ExpandParameter("$g");
   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 button = Editor.MessageBox(cmd, 1);
   if (button == 1) {
     Editor.FileSave();
     Editor.ExecCommand(cmd, 1);
   }
 }.call(this));
----
再び Typeset.js を実行して fwdsumatrapdf を選択します.

**LuaLaTeXA.js [#y3996da5]
**inverse search [#uf1eff38]
■ 64-bit Windows で 64-bit サクラエディタを使用する場合~
■ 32-bit Windows で 32-bit サクラエディタを使用する場合~
 "C:\Program Files\sakura\sakura.exe" -X=%c -Y=%l "%f"
■ 64-bit Windows で 32-bit サクラエディタを使用する場合~
 "C:\Program Files (x86)\sakura\sakura.exe" -X=%c -Y=%l "%f"
または~

----
 (function () {
   var c = Editor.ExpandParameter("$e");
   var b = Editor.ExpandParameter("$g");
   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 button = Editor.MessageBox(cmd, 1);
   if (button == 1) {
     Editor.FileSave();
     Editor.ExecCommand(cmd, 1);
   }
 }.call(this));
----
■ 64-bit Windows で 64-bit サクラエディタを使用する場合~
■ 32-bit Windows で 32-bit サクラエディタを使用する場合~
 "C:\Program Files\sakura\sakura.exe" -X:%c -Y:%l "%f"
■ 64-bit Windows で 32-bit サクラエディタを使用する場合~
 "C:\Program Files (x86)\sakura\sakura.exe" -X:%c -Y:%l "%f"

**LuaJITLaTeXA.js [#cfc61c8f]
*TeXworks との連携 [#s01ddee6]

----
 (function () {
   var c = Editor.ExpandParameter("$e");
   var b = Editor.ExpandParameter("$g");
   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 button = Editor.MessageBox(cmd, 1);
   if (button == 1) {
     Editor.FileSave();
     Editor.ExecCommand(cmd, 1);
   }
 }.call(this));
----
Typeset.js を実行して

**XeLaTeXA.js [#n9a237cf]
-upLaTeX (ptex2pdf)
-upLaTeX (dvips + ps2pdf)
-pLaTeX-ng
-pdfLaTeX
-LuaLaTeX
-LuajitLaTeX
-XeLaTeX
-Latexmk-upLaTeX
-Latexmk-upLaTeX-pdfps
-Latexmk-pLaTeX-ng
-Latexmk-pdfLaTeX
-Latexmk-LuaLaTeX
-Latexmk-LuajitLaTeX
-Latexmk-XeLaTeX

----
 (function () {
   var c = Editor.ExpandParameter("$e");
   var b = Editor.ExpandParameter("$g");
   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 button = Editor.MessageBox(cmd, 1);
   if (button == 1) {
     Editor.FileSave();
     Editor.ExecCommand(cmd, 1);
   }
 }.call(this));
----
を選択します.

再び Typeset.js を実行して TeXworks を選択します.

*Adobe Acrobat Reader との連携 [#md7b02af]

Typeset.js を実行して

-Latexmk-upLaTeX-acroread
-Latexmk-upLaTeX-pdfps-acroread
-Latexmk-pLaTeX-ng-acroread
-Latexmk-pdfLaTeX-acroread
-Latexmk-LuaLaTeX-acroread
-Latexmk-LuajitLaTeX-acroread
-Latexmk-XeLaTeX-acroread

を選択します.