Macro/投稿/79

http://sakura.qp.land.to/?Macro%2F%C5%EA%B9%C6%2F79


Top > Macro > 投稿 > 79

LaTeX用タイプセットスクリプト

  • ページ: Macro/投稿
  • 作者: sai
  • カテゴリー: js
  • 投稿日: 2015-10-27 (火) 00:00:00

メッセージ

LaTeX用タイプセットスクリプト

  • Typeset.js

サクラエディタ Ver. 2.2.0.0 以降が必要です.

fileTypeset.js
  0
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
(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 -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 \"$$pdflatex=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 -pdf" + " " + ["\"", 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 \"$$pdflatex=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 -pdf" + " " + ["\"", 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 \"$$pdflatex=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 -pdf" + " " + ["\"", 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 --r15 --page %{page+1} --file \"%{output}\"\"";
        var pdfclose = "tasklist /fi \"IMAGENAME eq AcroRd32.exe\" /nh | findstr \"AcroRd32.exe\" > nul && pdfopen --r15 --file " + pdf + " && pdfclose --r15 --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 --r15 --page %{page+1} --file \"%{output}\"\"";
        var pdfclose = "tasklist /fi \"IMAGENAME eq AcroRd32.exe\" /nh | findstr \"AcroRd32.exe\" > nul && pdfopen --r15 --file " + pdf + " && pdfclose --r15 --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 --r15 --page %{page+1} --file \"%{output}\"\"";
        var pdfclose = "tasklist /fi \"IMAGENAME eq AcroRd32.exe\" /nh | findstr \"AcroRd32.exe\" > nul && pdfopen --r15 --file " + pdf + " && pdfclose --r15 --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 --r15 --page %{page+1} --file \"%{output}\"\"";
        var pdfclose = "tasklist /fi \"IMAGENAME eq AcroRd32.exe\" /nh | findstr \"AcroRd32.exe\" > nul && pdfopen --r15 --file " + pdf + " && pdfclose --r15 --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 \"$$pdflatex=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 -pdf" + " " + ["\"", b, "\""].join("");
        var pdf = ["\"", b, ".pdf", "\""].join("");
        var pdfopen = "synctex view -i \"" + line + ":0:" + currentTeXFile + "\" -o \"" + pdfFile + "\" -x \"pdfopen --r15 --page %{page+1} --file \"%{output}\"\"";
        var pdfclose = "tasklist /fi \"IMAGENAME eq AcroRd32.exe\" /nh | findstr \"AcroRd32.exe\" > nul && pdfopen --r15 --file " + pdf + " && pdfclose --r15 --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 \"$$pdflatex=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 -pdf" + " " + ["\"", b, "\""].join("");
        var pdf = ["\"", b, ".pdf", "\""].join("");
        var pdfopen = "synctex view -i \"" + line + ":0:" + currentTeXFile + "\" -o \"" + pdfFile + "\" -x \"pdfopen --r15 --page %{page+1} --file \"%{output}\"\"";
        var pdfclose = "tasklist /fi \"IMAGENAME eq AcroRd32.exe\" /nh | findstr \"AcroRd32.exe\" > nul && pdfopen --r15 --file " + pdf + " && pdfclose --r15 --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 \"$$pdflatex=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 -pdf" + " " + ["\"", b, "\""].join("");
        var pdf = ["\"", b, ".pdf", "\""].join("");
        var pdfopen = "synctex view -i \"" + line + ":0:" + currentTeXFile + "\" -o \"" + pdfFile + "\" -x \"pdfopen --r15 --page %{page+1} --file \"%{output}\"\"";
        var pdfclose = "tasklist /fi \"IMAGENAME eq AcroRd32.exe\" /nh | findstr \"AcroRd32.exe\" > nul && pdfopen --r15 --file " + pdf + " && pdfclose --r15 --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 + " --r15 --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);
    }
})();


URL B I U SIZE Black Maroon Green Olive Navy Purple Teal Gray Silver Red Lime Yellow Blue Fuchsia Aqua White

添付ファイル: fileTypeset.js 174件 [詳細]

リロード   新規 編集 凍結 差分 添付 複製 名前変更   ホーム 一覧 単語検索 最終更新 バックアップ リンク元   ヘルプ   最終更新のRSS
Last-modified: 2015-10-27 (火) 22:56:57 (1147d)