TeXでコンパイル→Adobe Readerで表示
- ページ: Macro/投稿
- 作者: sai
- カテゴリー: js
- 投稿日: 2014-01-22 (水) 11:00:00
メッセージ
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
| | (function () {
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 ptex2pdf = "ptex2pdf -u -l -ot \"-no-guess-input-enc -kanji=utf8 -synctex=1\"" + " " + ["\"", b, "\""].join("");
var pdf = ["\"", b, ".pdf", "\""].join("");
var pdfopen = "powershell -Command \"& {$$line = \"\"\"" + line + "\"\"\"; $$src = \"\"\"" + currentTeXFile + "\"\"\"; $$pdf = \"\"\"" + pdfFile + "\"\"\"; $$param = $$line + \"\"\":0:\"\"\" + $$src; $$pageInfo = (synctex view -i $$param -o $$pdf | Select-String \"^Page:\"); $$page = ($$pageInfo -split \"\"\":\"\"\")[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;
Editor.StatusMsg(cmd, 0);
Editor.FileSave();
Editor.ExecCommand(cmd, 0x81);
}.call(this));
|
|