*[[RJ TextEd:http://www.rj-texted.se/]] [#ec487c4b]

//#ref(http://www.rj-texted.se/bilder/rjteheader.png,right,around,nolink,RJ TextEd)

&color(White,#5F2F2F){  ''◆目次◆''  };&br;

#contents

*RJ TextEd とは [#r9769625]

RJ TextEd は Unicode をサポートしたテキストエディタです.~

-[[RJ TextEd:http://www.rj-texted.se/]]

**動作環境 [#c77f0dbf]

Windows 8.1, 8, 7, Vista, XP

*メニューの日本語化 [#mb8b01ee]

[Env%%%i%%%ronment]-[Languages]-[[jpn] - Japanese (日本語)] を選択するとメニューが日本語になります.

*TeX ファイルの色分け [#j03604b9]

デフォルトでは TeX ファイルの色分けは無効になっています.~

[環境(%%%N%%%)]-[アドオン(%%%A%%%)...]

強調設定タブから LaTeX を選択してファイル拡張子に .tex を追加して有効化します.~

*フォント [#s44cec9e]

[環境(%%%N%%%)]-[オプション(%%%O%%%)...]

フォントとタブからフォント設定ができます.~
設定を変更する場合は項目の右側の☐にチェック(☑)を入れれば設定が変更できるようになります.~

*スクリプト [#ee04f0fa]

[ツール(%%%T%%%)]-[ツール設定...]

ツールメニューのツールから [追加] をクリックしてスクリプトを追加します.~
追加したスクリプトはメニューの [ツール(%%%T%%%)] に表示されます.~

**FastScript [#n85cf31b]

-[[Fast Script — scripting library - FastReports Inc.:http://www.fast-report.com/en/product/fast-script/]]

RJ TextEd のスクリプトは FastScript で記述します.~
FastScript は

-C++Script
-PascalScript
-BasicScript
-JScript

の中からプログラミング言語を選択して記述することができます.~

**pdfpLaTeX.js [#g293b7d1]

----
 {
     var fso = CreateOleObject("Scripting.FileSystemObject");
     var wshShell = CreateOleObject("WScript.Shell");
     var c = fso.GetParentFolderName(Document.FileName);
     var b = fso.GetBaseName(Document.FileName);
     var cd = "cd /d " + "\"" + c + "\"";
     var ptex2pdf = "ptex2pdf -l -ot \"-synctex=1 -kanji=utf8 -guess-input-enc -sjis-terminal\"" + " " + "\"" + b + "\"";
     var cmd = "cmd /c " + cd + " && " + ptex2pdf;
     var ok = wshShell.Popup(cmd, 0, "RJ TextEd", 1 + 64);
     if (ok == 1) {
         Document.Save();
         MainApp.RunApp("C:\\Windows\\System32\\cmd.exe", cmd, true, true);
     }
 }
----

**pdfupLaTeX.js [#y2fd8be4]

----
 {
     var fso = CreateOleObject("Scripting.FileSystemObject");
     var wshShell = CreateOleObject("WScript.Shell");
     var c = fso.GetParentFolderName(Document.FileName);
     var b = fso.GetBaseName(Document.FileName);
     var cd = "cd /d " + "\"" + c + "\"";
     var ptex2pdf = "ptex2pdf -l -u -ot \"-synctex=1 -kanji=utf8 -no-guess-input-enc -sjis-terminal\"" + " " + "\"" + b + "\"";
     var cmd = "cmd /c " + cd + " && " + ptex2pdf;
     var ok = wshShell.Popup(cmd, 0, "RJ TextEd", 1 + 64);
     if (ok == 1) {
         Document.Save();
         MainApp.RunApp("C:\\Windows\\System32\\cmd.exe", cmd, true, true);
     }
 }
----

**TeXworks.js [#g8325174]

----
 {
     var fso = CreateOleObject("Scripting.FileSystemObject");
     var wshShell = CreateOleObject("WScript.Shell");
     var re = CreateOleObject("VBScript.RegExp");
     re.Pattern = "\.[^.]*$";
     var currentTeXFile = Document.FileName;
     var pdfFile = re.Replace(currentTeXFile, ".pdf");
     var texworks = "texworks";
 
     if (!fso.FileExists(pdfFile)) {
         var mainTeXFile = MainApp.InputBox("RJ TextEd", "Input the path to main TeX file.");
         if (mainTeXFile != "") {
             pdfFile = re.Replace(mainTeXFile, ".pdf");
         }
     }
 
     var mainTeXDir = fso.GetParentFolderName(pdfFile);
     var cd = "cd /d " + "\"" + mainTeXDir + "\"";
     pdfFile = "\"" + pdfFile + "\"";
 
     var args = texworks + " " + pdfFile;
     var cmd = "cmd /c " + cd + " && echo " + args + " | cmd";
     MainApp.RunApp("C:\\Windows\\System32\\cmd.exe", cmd, false, true);
 }
----

*SumatraPDF との連携 [#xf1a2ee6]

**forward search (SumatraPDF を前面に表示したい場合) [#k6635ec1]
**forward and inverse search (SumatraPDF を前面に表示したい場合) [#k6635ec1]

***SumatraPDF.js [#ffc3045d]

----
 {
     var fso = CreateOleObject("Scripting.FileSystemObject");
     var wshShell = CreateOleObject("WScript.Shell");
     var re = CreateOleObject("VBScript.RegExp");
     re.Pattern = "\.[^.]*$";
     var taskkill = "cmd /c tasklist /fi \\\"IMAGENAME eq TextEd.exe\\\" /nh | findstr \\\"TextEd.exe\\\" > nul && taskkill /F /IM TextEd.exe /T"
     var textEd =  "\\\"" + MainApp.ExeName + "\\\""
     var currentTeXFile = Document.FileName;
     var pdfFile = re.Replace(currentTeXFile, ".pdf");
     var line = IntToStr(Document.CursorY() + 1)
     var sumatraPDF = wshShell.RegRead("HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\SumatraPDF.exe\\");
     var existSumatraPDF = true;
 
     if (!fso.FileExists(sumatraPDF)) {
         sumatraPDF = MainApp.InputBox("RJ TextEd", "Input the path to SumatraPDF.exe.");
         if (!fso.FileExists(sumatraPDF)) {
             sumatraPDF = "rundll32 shell32,ShellExec_RunDLL SumatraPDF";
             existSumatraPDF = false;
         }
     }
 
     if (existSumatraPDF) {
         sumatraPDF = "\"" + sumatraPDF + "\"";
     }
 
     if (!fso.FileExists(pdfFile)) {
         if (!fso.FileExists(pdfFile)) {
             var mainTeXFile = MainApp.InputBox("RJ TextEd", "Input the path to main TeX file.");
             if (mainTeXFile != "") {
                 pdfFile = re.Replace(mainTeXFile, ".pdf");
             }
         }
     }
 
     var mainTeXDir = fso.GetParentFolderName(pdfFile);
     var cd = "cd /d " + "\"" + mainTeXDir + "\"";
     pdfFile = "\"" + pdfFile + "\"";
 
     var args = sumatraPDF + " -reuse-instance " + pdfFile + " -forward-search " + currentTeXFile + " " + line;
     var args = sumatraPDF + " -reuse-instance " + pdfFile + " -inverse-search " + "\"" + taskkill + " & " + textEd + " /L:%l \\\"%f\\\"\"" + " -forward-search \"" + currentTeXFile + "\" " + line;
     var cmd = "cmd /c " + cd + " && echo " + args + " | cmd";
     MainApp.RunApp("C:\\Windows\\System32\\cmd.exe", cmd, false, true);
 }
----

**inverse search [#qc9d43a3]

 cmd /c tasklist /fi "IMAGENAME eq TextEd.exe" /nh | findstr "TextEd.exe" > nul && taskkill /F /IM TextEd.exe /T & "C:\Program Files\RJ TextEd\TextEd.exe" /L:%l "%f"
 cmd /c tasklist /fi "IMAGENAME eq TextEd.exe" /nh | findstr "TextEd.exe" > nul && taskkill /F /IM TextEd.exe /T & "C:\Program Files (x86)\RJ TextEd\TextEd.exe" /L:%l "%f"