*マクロ [#m32041fb] -[[秀まるおのホームページ(サイトー企画) ヘルプファイルサイト:http://homepage3.nifty.com/kons/hidemaru/helpsite/]] --[[秀丸エディタ マクロ言語ヘルプ目次:http://homepage3.nifty.com/kons/hidemaru/helpsite/hidemac/]] マクロを使うと LaTeX 環境を簡単に作ることができます.~ **[[祝鳥 (のりてふ)>祝鳥]] [#mdf32e5b] //**RaTeX0e [#s1e27527] //-[[RaTeX0e:http://uca-works.com/program/ratex.html]] //(福中 公輔 さん) // //**AutoHotKey スクリプト [#va7fd93d] //-[[AutoHotKey スクリプト:http://ryo-t.com/diary/?p=94]] //(谷内 稜 さん) // //**秀丸エディタで LaTeX [#ubdba7fd] //-[[秀丸エディタで LaTeX (hidemacro-070502.tar.gz):http://www.cymric.jp/old/tex/hidemaru.html]] //(Maxima 普及委員会) // //**秀丸で簡単コンパイル [#m6700653] //-[[秀丸で簡単コンパイル:http://imawamukashi.web.fc2.com/TeX/hidemacro.html]] //(Outsider's Website) // //**秀丸マクロ for TeX editing [#h3f49b53] //-[[秀丸マクロ for TeX editing:http://wiki.livedoor.jp/fuhmi/d/%CA%AA%C3%D6]] //(fuhmi さん) // //**トリビュート [#qac4762a] //-[[トリビュート:http://www.vector.co.jp/soft/win95/writing/se259789.html]], [[LaTeX2e 用強調表示定義ファイル:http://homepage2.nifty.com/masema/software/LaTeX_hilight.html]] //(ませま さん) // //**LaTeX Compile HIDEMARU Macro [#w6e15581] //-[[LaTeX Compile HIDEMARU Macro (LaTeXコンパイル用秀丸マクロ):http://hide.maruo.co.jp/lib/macro/lcm11.html]] //(岩里 さん) // //**TeX用改行コード挿入マクロ [#ndf01264] //-[[TeX用改行コード挿入マクロ:http://hide.maruo.co.jp/lib/macro/il-fc093.html]] (haze さん) // //**TeX Module Control with HIDEMARU Macro [#rff2c60d] //-[[TeX Module Control with HIDEMARU Macro:http://www.ceres.dti.ne.jp/~sugiura/hidemaru/macros/tex_mc/index.html]] //(杉浦 方紀 さん) // //**LaTeX コンパイル支援マクロ [#ob9080ba] //-[[LaTeX コンパイル支援マクロ:http://www.seman.cs.uec.ac.jp/~inuzuka/hidemac.html]] //(犬塚 敦史 さん) // //**飛鳥 (ひちょう) HiTeX [#y3147877] //-[[飛鳥 (ひちょう) HiTeX:http://www.yatex.org/HiTeX/]] //(安田 晴行 さん) **pdfpLaTeX.mac [#h4eb5579] ---- call main; endmacro; main: ##fso = createobject("Scripting.FileSystemObject"); $$c = callmethod_returnstr(##fso, "GetParentFolderName", filename2); $$b = callmethod_returnstr(##fso, "GetBaseName", filename2); releaseobject ##fso; $$cd = "cd /d " + "\"" + $$c + "\""; $$latex = "platex -synctex=1 -guess-input-enc -sjis-terminal"; if ((charset & 0x3F) == 6) { $$latex = "platex -synctex=1 -no-guess-input-enc -kanji=utf8 -sjis-terminal"; } else if ((charset & 0x3F) == 1) { $$latex = "platex -synctex=1 -no-guess-input-enc -kanji=sjis -sjis-terminal"; } else if ((charset & 0x3F) == 3) { $$latex = "platex -synctex=1 -no-guess-input-enc -kanji=euc -sjis-terminal"; } else if ((charset & 0x3F) == 4) { $$latex = "platex -synctex=1 -no-guess-input-enc -kanji=jis -sjis-terminal"; } $$latex = $$latex + " " + "-jobname=" + "\"" + $$b + "\"" + " " + "\"" + $$b + "\""; $$dvipdfm = "dvipdfmx" + " " + "\"" + $$b + "\""; $$cmd = "cmd /c " + $$cd + " && " + $$latex + " && " + $$dvipdfm; question $$cmd; if (result == yes) { save; runex $$cmd, 0, 0, "", 7, "", 1, "", 1, "", 0, 0, 0; } ---- **TeXworks.mac [#r100b824] [[TeXworks#組み込みの PDF ビューアに日本語を表示させる>TeXworks#t5313ebc]] を参照してフォントの埋め込みの設定を行います.~ ---- call main; endmacro; main: ##fso = createobject("Scripting.FileSystemObject"); ##re = createobject("VBScript.RegExp"); $$currentTeXFile = filename2; setpropstr ##re, "Pattern", "\.[^.]*$"; $$pdfFile = callmethod_returnstr(##re, "Replace", $$currentTeXFile, ".pdf"); $$texworks = "texworks"; if (!existfile($$pdfFile)) { $$mainTeXFile = input("Input the path to main TeX file.", callmethod_returnstr(##re, "Replace", $$pdfFile, ".tex")); if ($$mainTeXFile != "") { $$pdfFile = callmethod_returnstr(##re, "Replace", $$mainTeXFile, ".pdf"); } } $$mainTeXDir = callmethod_returnstr(##fso, "GetParentFolderName", $$pdfFile); releaseobject ##re; releaseobject ##fso; $$cd = "cd /d " + "\"" + $$mainTeXDir + "\""; $$pdfFile = "\"" + $$pdfFile + "\""; $$args = $$texworks + " " + $$pdfFile; $$cmd = "cmd /c " + $$cd + " && echo " + $$args + " | cmd"; runex $$cmd, 0, 0, "", 7, "", 1, "", 1, "", 0, 0, 0; ---- *SumatraPDF との連携 [#r1840cf4] [[祝鳥]]は SumatraPDF の forward and inverse search に対応しています. **forward and inverse search (SumatraPDF を前面に表示したい場合) [#k083ca2e] ***SumatraPDF.mac [#y16d42fd] ---- call main; endmacro; main: ##fso = createobject("Scripting.FileSystemObject"); ##re = createobject("VBScript.RegExp"); $$hidemaru = hidemarudir + "\\Hidemaru.exe"; $$currentTeXFile = filename2; setpropstr ##re, "Pattern", "\.[^.]*$"; $$pdfFile = callmethod_returnstr(##re, "Replace", $$currentTeXFile, ".pdf"); $$line = str(lineno); $$sumatraPDF = "C:\\Program Files\\SumatraPDF\\SumatraPDF.exe"; if (!existfile($$sumatraPDF)) { $$sumatraPDF = "C:\\Program Files (x86)\\SumatraPDF\\SumatraPDF.exe"; if (!existfile($$sumatraPDF)) { $$sumatraPDF = input("Input the path to SumatraPDF.exe.", "SumatraPDF.exe"); if (!existfile($$sumatraPDF)) { $$sumatraPDF = "SumatraPDF.exe"; } } } $$sumatraPDF = "\"" + $$sumatraPDF + "\""; if (!existfile($$pdfFile)) { $$mainTeXFile = input("Input the path to main TeX file.", callmethod_returnstr(##re, "Replace", $$pdfFile, ".tex")); if ($$mainTeXFile != "") { $$pdfFile = callmethod_returnstr(##re, "Replace", $$mainTeXFile, ".pdf"); } } $$mainTeXDir = callmethod_returnstr(##fso, "GetParentFolderName", $$pdfFile); releaseobject ##re; releaseobject ##fso; $$cd = "cd /d " + "\"" + $$mainTeXDir + "\""; $$currentTeXFile = "\"" + $$currentTeXFile + "\""; $$pdfFile = "\"" + $$pdfFile + "\""; $$args = $$sumatraPDF + " -reuse-instance " + $$pdfFile + " -inverse-search \"\\\"" + $$hidemaru + "\\\" /m3 /j%%l \\\"%%f\\\"\"" + " -forward-search " + $$currentTeXFile + " " + $$line; $$cmd = "cmd /c " + $$cd + " && echo " + $$args + " | cmd"; runex $$cmd, 0, 0, "", 7, "", 1, "", 1, "", 0, 0, 0; ---- **inverse search [#zd12c371] -32bit版 Windows で 32bit版の秀丸エディタを使用する場合 -64bit版 Windows で 64bit版の秀丸エディタを使用する場合 "C:\Program Files\Hidemaru\Hidemaru.exe" /m3 /j%l "%f" -64bit版 Windows で 32bit版の秀丸エディタを使用する場合 "C:\Program Files (x86)\Hidemaru\Hidemaru.exe" /m3 /j%l "%f" *Adobe Reader との連携 [#z5e51515] [[祝鳥]]は Adobe Reader の DDE, Adobe Acrobat の DDE, OLE に対応しています. **pdfpLaTeXA.mac [#q37b5bf9] ---- call main; endmacro; main: ##fso = createobject("Scripting.FileSystemObject"); $$c = callmethod_returnstr(##fso, "GetParentFolderName", filename2); $$b = callmethod_returnstr(##fso, "GetBaseName", filename2); releaseobject ##fso; $$cd = "cd /d " + "\"" + $$c + "\""; $$latex = "platex -guess-input-enc -sjis-terminal"; if ((charset & 0x3F) == 6) { $$latex = "platex -no-guess-input-enc -kanji=utf8 -sjis-terminal"; } else if ((charset & 0x3F) == 1) { $$latex = "platex -no-guess-input-enc -kanji=sjis -sjis-terminal"; } else if ((charset & 0x3F) == 3) { $$latex = "platex -no-guess-input-enc -kanji=euc -sjis-terminal"; } else if ((charset & 0x3F) == 4) { $$latex = "platex -no-guess-input-enc -kanji=jis -sjis-terminal"; } $$latex = $$latex + " " + "-jobname=" + "\"" + $$b + "\"" + " " + "\"" + $$b + "\""; $$dvipdfm = "dvipdfmx" + " " + "\"" + $$b + "\""; $$pdf = "\"" + $$b + ".pdf" + "\""; $$pdfopen = "powershell -Command \"& {$pdf = \"\"" + $$pdf + "\"\"; $pages = (pdfinfo $pdf | Select-String \"^Pages:\"); $page = (-split $pages)[1]; pdfopen --rxi --file $pdf --page $page}\""; $$pdfclose = "tasklist /fi \"IMAGENAME eq AcroRd32.exe\" /nh | findstr \"AcroRd32.exe\" > nul && pdfopen --rxi --file " + $$pdf + " && pdfclose --rxi --file " + $$pdf; $$cmd = "cmd /c " + $$cd + " && " + $$pdfclose + " & " + $$latex + " && " + $$dvipdfm + " && " + $$pdfopen; question $$cmd; if (result == yes) { save; runex $$cmd, 0, 0, "", 7, "", 1, "", 1, "", 0, 0, 0; } ----