|
* TeXでコンパイル→Adobe Readerで表示 [#z27b03ee] -ページ: [[Macro/投稿]] -作者: [[てふにしゃん]] -カテゴリー: js -投稿日: 2014-01-22 (水) 11:00:00 ** メッセージ [#cc3bd5df] #code(javascript){{ (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)); }} ---- #comment |