- 追加された行はこの色です。
- 削除された行はこの色です。
[[サクラエディタ]] > マクロ
----
#contents
----
*マクロ [#k75075b0]
-[[Macro - SakuraEditorWiki:http://sakura.qp.land.to/?Macro]]
--[[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://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]]
//-[[サクラエディタマクロ: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]]
//-[[サクラエディタ ヘルプ目次: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)] から選択することで実行できます.
登録したくない場合は [ツール(T)] > [名前を指定してマクロ実行(E)...] からファイルを選択して実行できます.
>
&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 Typeset Typeset.js on };&br;
∣ 1 off&br;
∣ 2 off&br;
∣ … …&br;
∣ 47 off&br;
∣ 48 off&br;
∣ 49 off&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;
<
**マクロにショートカットキーを割り当てる方法 [#ubcf1bda]
-[[キー割り当て一覧: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(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;
&br;
<
**Typeset.js [#i861969f]
Typeset.js を使用する場合は サクラエディタ Ver. 2.2.0.0 以降が必要です.
Typeset.js をメインメニューに追加する場合は [設定(O)] > [共通設定(C)...] のメインメニューのタブの種別(K)から外部マクロを選択してTypesetを選び [>>(B)] をクリックして追加します.
キー割り当てを行う場合は Ctrl+Alt+J などのまだ割り当てられていないキーに設定してください.
----
(function () {
var menuItem = Editor.CreateMenu(0, "\
[]upLaTeX (ptex2pdf),\
[]upLaTeX (dvips + ps2pdf),\
[]pLaTeX-ng,\
[]pdfLaTeX,\
[]LuaLaTeX,\
[]LuaJITLaTeX,\
[]LuajitLaTeX,\
[]XeLaTeX,\
[]Latexmk,\
[]Latexmk-upLaTeX,\
[]Latexmk-upLaTeX-pdfps,\
[]Latexmk-pLaTeX-ng,\
[]Latexmk-pdfLaTeX,\
[]Latexmk-LuaLaTeX,\
[]Latexmk-LuaJITLaTeX,\
[]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-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/upbibtex %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/upbibtex %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/upbibtex %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/upbibtex %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/upbibtex %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/upbibtex %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/upbibtex %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 AcroRd32.exe\" /nh | findstr \"AcroRd32.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/upbibtex %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 AcroRd32.exe\" /nh | findstr \"AcroRd32.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/upbibtex %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 AcroRd32.exe\" /nh | findstr \"AcroRd32.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 AcroRd32.exe\" /nh | findstr \"AcroRd32.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/upbibtex %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 AcroRd32.exe\" /nh | findstr \"AcroRd32.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/upbibtex %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 AcroRd32.exe\" /nh | findstr \"AcroRd32.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/upbibtex %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 AcroRd32.exe\" /nh | findstr \"AcroRd32.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;
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;
}
}
}
if (existSumatraPDF) {
sumatraPDF = ["\"", sumatraPDF, "\""].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");
}
}
var mainTeXDir = fso.GetParentFolderName(pdfFile);
var cd = "cd /d " + ["\"", mainTeXDir, "\""].join("");
currentTeXFile = ["\"", currentTeXFile, "\""].join("");
pdfFile = ["\"", pdfFile, "\""].join("");
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";
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("");
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";
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);
}
})();
----
*SumatraPDF との連携 [#t7a83c73]
**forward and inverse search (SumatraPDF を前面に表示したい場合) [#p7bf3825]
Typeset.js を実行して
-upLaTeX (ptex2pdf)
-upLaTeX (dvips + ps2pdf)
-pLaTeX-ng
-pdfLaTeX
-LuaLaTeX
-LuaJITLaTeX
-LuajitLaTeX
-XeLaTeX
-Latexmk-upLaTeX
-Latexmk-upLaTeX-pdfps
-Latexmk-pLaTeX-ng
-Latexmk-pdfLaTeX
-Latexmk-LuaLaTeX
-Latexmk-LuaJITLaTeX
-Latexmk-LuajitLaTeX
-Latexmk-XeLaTeX
を選択します.
再び Typeset.js を実行して SumatraPDF を選択します.
**forward search (SumatraPDF を前面に表示したくない場合) [#wa5982c4]
[[SumatraPDF/fwdsumatrapdf]] の fwdsumatrapdf.exe を使用します.~
Typeset.js を実行して
-upLaTeX (ptex2pdf)
-upLaTeX (dvips + ps2pdf)
-pLaTeX-ng
-pdfLaTeX
-LuaLaTeX
-LuaJITLaTeX
-LuajitLaTeX
-XeLaTeX
-Latexmk-upLaTeX
-Latexmk-upLaTeX-pdfps
-Latexmk-pLaTeX-ng
-Latexmk-pdfLaTeX
-Latexmk-LuaLaTeX
-Latexmk-LuaJITLaTeX
-Latexmk-LuajitLaTeX
-Latexmk-XeLaTeX
を選択します.
再び Typeset.js を実行して fwdsumatrapdf を選択します.
**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"
または~
■ 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"
*TeXworks との連携 [#s01ddee6]
Typeset.js を実行して
-upLaTeX (ptex2pdf)
-upLaTeX (dvips + ps2pdf)
-pLaTeX-ng
-pdfLaTeX
-LuaLaTeX
-LuaJITLaTeX
-LuajitLaTeX
-XeLaTeX
-Latexmk-upLaTeX
-Latexmk-upLaTeX-pdfps
-Latexmk-pLaTeX-ng
-Latexmk-pdfLaTeX
-Latexmk-LuaLaTeX
-Latexmk-LuaJITLaTeX
-Latexmk-LuajitLaTeX
-Latexmk-XeLaTeX
を選択します.
再び Typeset.js を実行して TeXworks を選択します.
*Adobe Acrobat Reader DC との連携 [#md7b02af]
Typeset.js を実行して
-Latexmk-upLaTeX-acroread
-Latexmk-upLaTeX-pdfps-acroread
-Latexmk-pLaTeX-ng-acroread
-Latexmk-pdfLaTeX-acroread
-Latexmk-LuaLaTeX-acroread
-Latexmk-LuaJITLaTeX-acroread
-Latexmk-LuajitLaTeX-acroread
-Latexmk-XeLaTeX-acroread
を選択します.