サクラエディタ > マクロ
マクロを使うと LaTeX 環境を簡単に作ることができます. 共通設定のマクロタブからマクロファイルが格納されているフォルダを参照して,名前,File,Id を指定し,マクロを実行するたびにファイルを読み込みなおす にチェックを入れて設定をクリックします. マクロを実行するたびにファイルを読み込みなおす のチェックが外れている場合,マクロを登録した後で,マクロファイルの内容を変更しても変更内容が反映されないので注意してください. 登録したマクロは,メニューの [ツール(T)] > [登録済みマクロ(B)] から選択することで実行できます. 登録したくない場合は [ツール(T)] > [名前を指定してマクロ実行(E)...] からファイルを選択して実行できます.
共通設定 [ ? ][ 🗙 ]
[ ファイル ][ ファイル名表示 ][ バックアップ ][ 書式 ][ 検索 ][ キー割り当て ]
[ 全般 ][ ウィンドウ ][ メインメニュー ][ ツールバー ][ タブバー ][ ステータスバー ][ 編集 ]
[ カスタムメニュー ][ 強調キーワード ][ 支援 ][ マクロ ][ プラグイン ]
マクロ一覧 .\macro\ [ 参照(R)... ]
∣ 番号 ∣ マクロ名 ∣ ファイル名 ∣ 実行時に読み込み ∣ 自動実行 ∣
∣ 0 Typeset Typeset.js on
∣ 1 off
∣ 2 off
∣ … …
∣ 47 off
∣ 48 off
∣ 49 off
名前(N) Typeset Id: [0 ᐯ]
File Typeset.js ᐯ [ 設定(A) ]
☑マクロを実行するたびにファイルを読み込みなおす(L) キャンセル確認待ち時間 10 秒
自動実行: ☐新規/開ファイル後(O) ☐タイプ変更後(T) ☐ファイル保存前(S)
共通設定 [ ? ][ 🗙 ]
[ カスタムメニュー ][ 強調キーワード ][ 支援 ][ マクロ ][ プラグイン ]
[ 全般 ][ ウィンドウ ][ メインメニュー ][ ツールバー ][ タブバー ][ ステータスバー ][ 編集 ]
[ ファイル ][ ファイル名表示 ][ バックアップ ][ 書式 ][ 検索 ][ キー割り当て ]
種別(K) [ 外部マクロ ᐯ] [ インポート(I)... ] [ エクスポート(X)... ]
機能(F) キー(Y)
マクロ 0 (未登録) ダブルクリック
マクロ 1 (未登録) ☐Shift 右クリック
マクロ 2 (未登録) 中クリック
マクロ 3 (未登録) ☐Ctrl 左サイドクリック
マクロ 4 (未登録) 右サイドクリック
マクロ 5 (未登録) ☐Alt トリプルクリック
マクロ 6 (未登録) クアドラプルクリック
マクロ 7 (未登録) ホイールアップ
マクロ 8 (未登録) ホイールダウン
マクロ 9 (未登録) ホイール左
… …
機能に割り当てられているキー(G)
[割付(B)] キーに割り当てられている機能
[解除(R)] 現在位置の単語選択
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,\
[]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;
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);
}
})();
Typeset.js を実行して
を選択します.
再び Typeset.js を実行して SumatraPDF を選択します.
SumatraPDF/fwdsumatrapdf の fwdsumatrapdf.exe を使用します.
Typeset.js を実行して
を選択します.
再び Typeset.js を実行して fwdsumatrapdf を選択します.
■ 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"
Typeset.js を実行して
を選択します.
再び Typeset.js を実行して TeXworks を選択します.
Typeset.js を実行して
を選択します.