最終更新:2017-08-15 (火) 22:22:39 (5d)

Sakura Editor

Download

official build

64-bit build

test build

fork

Repository

Changelog

bregonig.dll

Sakura Editor で正規表現を使用する場合は正規表現ライブラリ bregonig.dll を使用する

bregonig.dll がインストールされていれば [設定(O)] > [共通設定(C)...] > [検索] の 検索/置換/Grep で

bregonig.dll Ver.4.12 with Onigmo 6.1.2

のように bregonig.dll のバージョンが表示される

 共通設定                                                                                      |      ||   🗙   |
  |   カスタムメニュー   |   強調キーワード   |     支援     |    マクロ    |    プラグイン    |
  |  全般  | ウィンドウ | メインメニュー | ツールバー | タブバー | ステータスバー |  編集  |
  |   ファイル   |  ファイル名表示  |  バックアップ  |   書式   |   検索   |   キー割り当て   |

      検索/置換/Grep
      ☑ カーソル位置の文字列をデフォルトの検索文字列にする(C)
      ☑ 次・前検索で他のビューでの検索条件変更を引き継ぐ(I)
      正規表現ライブラリ指定(L)
      bregonig.dll Ver.4.12 with Onigmo 6.1.2

      Grep
      ☐ Grepモードで保存確認する(V)
      ☐ リアルタイムで表示する(R)

      Grep結果からのタブジャンプ
      ☑ エンターキーでタグジャンプ(E)
      ☑ ダブルクリックでタグジャンプ(W)

      タグジャンプ
      タグジャンプの検索(T):                      [ヒットしたら次のファイルを検索しない  ᐯ]
      キーワード指定のタグファイル検索(K):  [次のファイルを検索する                      ᐯ]
                                                                                                                        

LaTeX macro

Typeset.js

Sakura Editor Ver. 2.2.0.0 以降が必要.


(function () {
    var menuItem = Editor.CreateMenu(0, "\
[]upLaTeX (ptex2pdf),\
[]upLaTeX (dvips + ps2pdf),\
[]pLaTeX-ng,\
[]pdfLaTeX,\
[]LuaLaTeX,\
[]LuaJITLaTeX,\
[]XeLaTeX,\
[]Latexmk,\
[]Latexmk-upLaTeX-pdfdvi,\
[]Latexmk-upLaTeX-pdfps,\
[]Latexmk-pLaTeX-ng,\
[]Latexmk-pdfLaTeX,\
[]Latexmk-LuaLaTeX,\
[]Latexmk-LuaJITLaTeX,\
[]Latexmk-XeLaTeX,\
[]Latexmk-upLaTeX-pdfdvi-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 -cmdx -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 -cmdx -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 -cmdx %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 -cmdx %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 -cmdx %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 -cmdx %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);
    }
})();