mimetex.html 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <!-- Author Dirk Datzert 2007
  4. Patches and improvements by Juan Carlos Raña Trabado 2008 and Ivan Tcholakov 2009 -->
  5. <head>
  6. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  7. <meta name="robots" content="noindex, nofollow" />
  8. <script src="../../dialog/common/fck_dialog_common.js" type="text/javascript"></script>
  9. <script type="text/javascript" src="jquery.js"></script>
  10. <script type="text/javascript">
  11. var oEditor = window.parent.InnerDialogLoaded() ;
  12. var FCKLang = oEditor.FCKLang ;
  13. var FCK = oEditor.FCK ;
  14. var FCKConfig = oEditor.FCKConfig ;
  15. var FCKTools = oEditor.FCKTools ;
  16. var FCKBrowserInfo = oEditor.FCKBrowserInfo ;
  17. //Set the language direction.
  18. window.document.dir = FCKLang.Dir ;
  19. // Initialization of the URLs to be used.
  20. var mimetex_url = FCKConfig.MimetexUrl ;
  21. var mimetex_cgi = mimetex_url + "? \\Large " ;
  22. var preview_cgi = mimetex_cgi + "\\nocach " ;
  23. var result_cgi = mimetex_cgi ;
  24. var img_tag = true ;
  25. // FCKEditor
  26. // We have to avoid javascript errors if some language variables have not been defined.
  27. FCKLang['DlgMimeTeXSymbols'] = FCKLang['DlgMimeTeXSymbols'] ? FCKLang['DlgMimeTeXSymbols'] : 'Symbols' ;
  28. FCKLang['DlgMimeTeXCalendar'] = FCKLang['DlgMimeTeXCalendar'] ? FCKLang['DlgMimeTeXCalendar'] : 'Calendar' ;
  29. FCKLang['DlgMimeTeXNumeric'] = FCKLang['DlgMimeTeXNumeric'] ? FCKLang['DlgMimeTeXNumeric'] : 'Numeric' ;
  30. FCKLang['DlgMimeTeXLowerGreeks'] = FCKLang['DlgMimeTeXLowerGreeks'] ? FCKLang['DlgMimeTeXLowerGreeks'] : 'Lower Greeks' ;
  31. FCKLang['DlgMimeTeXUpperGreeks'] = FCKLang['DlgMimeTeXUpperGreeks'] ? FCKLang['DlgMimeTeXUpperGreeks'] : 'Upper Greeks' ;
  32. FCKLang['DlgMimeTeXOperators'] = FCKLang['DlgMimeTeXOperators'] ? FCKLang['DlgMimeTeXOperators'] : 'Operators' ;
  33. FCKLang['DlgMimeTeXFunctions'] = FCKLang['DlgMimeTeXFunctions'] ? FCKLang['DlgMimeTeXFunctions'] : 'Functions' ;
  34. FCKLang['DlgMimeTeXTrigonometry'] = FCKLang['DlgMimeTeXTrigonometry'] ? FCKLang['DlgMimeTeXTrigonometry'] : 'Trigonometry' ;
  35. FCKLang['DlgMimeTeXAnalysis'] = FCKLang['DlgMimeTeXAnalysis'] ? FCKLang['DlgMimeTeXAnalysis'] : 'Analysis' ;
  36. FCKLang['DlgMimeTeXMoreSamples'] = FCKLang['DlgMimeTeXMoreSamples'] ? FCKLang['DlgMimeTeXMoreSamples'] : 'More Samples' ;
  37. switch ( oEditor.FCKLanguageManager.DefaultLanguage )
  38. {
  39. case 'es' :
  40. istallation_file_name = 'installation_guide_es_ES.html' ;
  41. break ;
  42. default :
  43. istallation_file_name = 'installation_guide.html' ;
  44. break ;
  45. }
  46. FCKLang['DlgMimeTeXSeeInstallationManual'] = FCKLang['DlgMimeTeXSeeInstallationManual']
  47. ? FCKLang['DlgMimeTeXSeeInstallationManual'] : 'To resolve the problem, see the Chamilo LMS %1installation guide%2.' ;
  48. if ( FCKConfig['UserIsPlatformAdmin'] || FCKConfig['UserIsCourseAdmin'] )
  49. {
  50. FCKLang['DlgMimeTeXSeeInstallationManual'] = FCKLang['DlgMimeTeXSeeInstallationManual'].replace( /%1/g,
  51. '<a href="../../../../../../../documentation/' + istallation_file_name + '#9._Mathematical_formulas" target="_blank">' ).replace( /%2/g, '<\/a>' ) ;
  52. }
  53. else
  54. {
  55. FCKLang['DlgMimeTeXSeeInstallationManual'] = FCKLang['DlgMimeTeXSeeInstallationManual'].replace( /%1/g, '' ).replace( /%2/g, '' ) ;
  56. }
  57. // look for a MATH-tag
  58. var eSelected = FCK.Selection.MoveToAncestorNode( 'MATH' ) ;
  59. // else look for an IMG-tag
  60. if ( !eSelected )
  61. {
  62. eSelected = FCK.Selection.MoveToAncestorNode( 'IMG' ) ;
  63. }
  64. // End FCKEditor
  65. function setSelRange( inputEl, selStart, selEnd )
  66. {
  67. if ( inputEl.setSelectionRange )
  68. {
  69. inputEl.focus() ;
  70. inputEl.setSelectionRange( selStart, selEnd ) ;
  71. }
  72. else if ( inputEl.createTextRange )
  73. {
  74. var range = inputEl.createTextRange() ;
  75. range.collapse(true) ;
  76. range.moveEnd( 'character', selEnd ) ;
  77. range.moveStart( 'character', selStart ) ;
  78. range.select();
  79. }
  80. }
  81. function insertAtCursor( myField, myValue )
  82. {
  83. // IE support
  84. if ( document.selection )
  85. {
  86. myField.focus() ;
  87. sel = document.selection.createRange() ;
  88. sel.text = myValue;
  89. }
  90. // MOZILLA/NETSCAPE support
  91. else if ( myField.selectionStart || myField.selectionStart == '0' )
  92. {
  93. var startPos = myField.selectionStart ;
  94. var endPos = myField.selectionEnd ;
  95. myField.value = myField.value.substring( 0, startPos )
  96. + myValue
  97. + myField.value.substring( endPos, myField.value.length ) ;
  98. setSelRange( myField, startPos + myValue.length, endPos + myValue.length ) ;
  99. }
  100. else
  101. {
  102. myField.value += myValue ;
  103. }
  104. }
  105. function cursorHand( obj )
  106. {
  107. $(obj).css( 'cursor', 'pointer' ) ;
  108. }
  109. function cursorDefault( obj )
  110. {
  111. $(obj).css( 'cursor', 'default' ) ;
  112. }
  113. function formulaPreview()
  114. {
  115. if ( document.pastemath.formula.value.length > 0 )
  116. {
  117. $( "#preview" ).css( 'display', 'block' ) ;
  118. $( "#formula_preview" ).attr( 'src', preview_cgi + document.pastemath.formula.value ) ;
  119. }
  120. else
  121. {
  122. $( "#preview" ).css( 'display', 'none' ) ;
  123. }
  124. }
  125. function addFormula( expr )
  126. {
  127. if ( document.pastemath.formula.value.length > 0 )
  128. {
  129. expr = ' ' + expr ;
  130. }
  131. textField = document.getElementById( "formula" ) ;
  132. insertAtCursor( textField, expr ) ;
  133. formulaPreview() ;
  134. }
  135. // Append a mimetex image to the last DIV of the Helper-DIV
  136. function appendHelper( expr, alt )
  137. {
  138. add_expr = expr.replace( /\\/g, "\\\\" ) ;
  139. src_expr = mimetex_cgi + expr ;
  140. $( "#helpers/div:last/p:last" ).append( "<img class=helper title='" + alt + "' alt='" + alt + "' onMouseOver='javascript: cursorHand(this);' onMouseOut='javascript: cursorDefault(this);' onClick='javascript: addFormula( \"" + add_expr + "\" ) ;' src='" + src_expr + "'>" ) ;
  141. }
  142. function htmlHelper( html )
  143. {
  144. $("#helpers/div:last/p:last").append(html);
  145. }
  146. function addHelper( id, title )
  147. {
  148. $( "#helpers" ).append( "<div id='" + id + "' class=helper>" + title + "<p id='" + id + "_pane' class='off pane' /></div>" ) ;
  149. }
  150. // Init helper on document ready
  151. $(function () {
  152. // FCKEditor
  153. // First of all, translate the dialog box texts
  154. oEditor.FCKLanguageManager.TranslatePage( document ) ;
  155. if ( !FCKConfig.IsMimetexInstalled )
  156. {
  157. ShowE( 'content', false ) ;
  158. ShowE( 'mimetex_error_message', true ) ;
  159. return ;
  160. }
  161. ShowE( 'content', true ) ;
  162. // End FCKEditor
  163. ////jc
  164. addHelper( "symbols1", FCKLang["DlgMimeTeXSymbols"] + " 1" ) ;
  165. //appendHelper( "\\-", "-" ) ; //jc
  166. appendHelper( "\-", "-" ) ;
  167. appendHelper( "\\cdot", "cdot" ) ;
  168. appendHelper( "\\times", "times" ) ;
  169. appendHelper( "\\ast", "ast" ) ;
  170. appendHelper( "\\div", "div" ) ;
  171. appendHelper( "\\diamond", "diamond" ) ;
  172. appendHelper( "\\pm", "pm" ) ;
  173. appendHelper( "\\mp", "mp" ) ;
  174. appendHelper( "\\oplus", "oplus" ) ;
  175. appendHelper( "\\ominus", "ominus" ) ;
  176. appendHelper( "\\otimes", "otimes" ) ;
  177. appendHelper( "\\oslash", "oslash" ) ;
  178. appendHelper( "\\odot", "odot" ) ;
  179. appendHelper( "\\bigcirc", "bigcirc" ) ;
  180. appendHelper( "\\circ", "circ" ) ;
  181. appendHelper( "\\bullet", "bullet" ) ;
  182. appendHelper( "\\asymp", "asymp" ) ;
  183. appendHelper( "\\equiv", "equiv" ) ;
  184. appendHelper( "\\subseteq", "subseteq" ) ;
  185. appendHelper( "\\supseteq", "supseteq" ) ;
  186. appendHelper( "\\leq", "leq" ) ;
  187. appendHelper( "\\geq", "geq" ) ;
  188. appendHelper( "\\preceq", "preceq" ) ;
  189. appendHelper( "\\succeq", "succeq" ) ;
  190. appendHelper( "\\sim", "sim" ) ;
  191. appendHelper( "\\approx", "approx" ) ;
  192. appendHelper( "\\subset", "subset" ) ;
  193. appendHelper( "\\supset", "supset" ) ;
  194. appendHelper( "\\ll", "ll" ) ;
  195. appendHelper( "\\gg", "gg" ) ;
  196. appendHelper( "\\prec", "prec" ) ;
  197. appendHelper( "\\succ", "succ" ) ;
  198. appendHelper( "\\leftar", "leftar" ) ;
  199. appendHelper( "\\rightar", "rightar" ) ;
  200. appendHelper( "\\uparr", "uparr" ) ;
  201. appendHelper( "\\downar", "downar" ) ;
  202. appendHelper( "\\leftrightar", "leftrightar" ) ;
  203. appendHelper( "\\near", "near" ) ;
  204. appendHelper( "\\sear", "sear" ) ;
  205. appendHelper( "\\simeq", "simeq" ) ;
  206. appendHelper( "\\Leftar", "Leftar" ) ;
  207. appendHelper( "\\Rightar", "Rightar" ) ;
  208. appendHelper( "\\Upar", "Upar" ) ;
  209. appendHelper( "\\Downar", "Downar" ) ;
  210. appendHelper( "\\Leftrightar", "Leftrightar" ) ;
  211. appendHelper( "\\nwar", "nwar" ) ;
  212. appendHelper( "\\swar", "swar" ) ;
  213. appendHelper( "\\propto", "propto" ) ;
  214. appendHelper( "\\prime", "prime" ) ;
  215. appendHelper( "\\infty", "infty" ) ;
  216. appendHelper( "\\in", "in" ) ;
  217. appendHelper( "\\ni", "ni" ) ;
  218. appendHelper( "\\triangle", "triangle" ) ;
  219. appendHelper( "\\bigtriangledo", "bigtriangledo" ) ;
  220. appendHelper( "\/", "/" ) ; //no va es la barra normal inclinada a la derecha
  221. appendHelper( "\\forall", "forall" ) ;
  222. appendHelper( "\\exists", "exists" ) ;
  223. appendHelper( "\\neg", "neg" ) ;
  224. appendHelper( "\\emptyset", "emptyset" ) ;
  225. appendHelper( "\\Re", "Re" ) ;
  226. appendHelper( "\\Im", "Im" ) ;
  227. appendHelper( "\\top", "top" ) ;
  228. appendHelper( "\\bot", "bot" ) ;
  229. appendHelper( "\\aleph", "aleph" ) ;
  230. appendHelper( "\\calA", "calA" ) ;
  231. appendHelper( "\\calZ", "calZ" ) ;
  232. appendHelper( "\\cup", "cup" ) ;
  233. appendHelper( "\\cap", "cap" ) ;
  234. appendHelper( "\\uplus", "uplus" ) ;
  235. appendHelper( "\\wedge", "wedge" ) ;
  236. appendHelper( "\\vee", "vee" ) ;
  237. appendHelper( "\\vdash", "vdash" ) ;
  238. appendHelper( "\\dashv", "dshv" ) ;
  239. appendHelper( "\\lfloor", "lfloor" ) ;
  240. appendHelper( "\\rfloor", "rfloor" ) ;
  241. appendHelper( "\\lceil", "lceil" ) ;
  242. appendHelper( "\\rceil", "rceil" ) ;
  243. appendHelper( "\\lbrace", "lbrace" ) ;
  244. appendHelper( "\\rbrace", "rbrace" ) ;
  245. appendHelper( "\\langle", "langle" ) ;
  246. appendHelper( "\\rangle", "rangle" ) ;
  247. appendHelper( "\\mid", "mid" ) ;
  248. appendHelper( "\\parallel", "parallel" ) ;
  249. appendHelper( "\\updownar", "updownar" ) ;
  250. appendHelper( "\\Updownar", "Updownar" ) ;
  251. appendHelper( "\\setminus", "setminus" ) ;
  252. appendHelper( "\\wr", "wr" ) ;
  253. appendHelper( "\\surd", "surd" ) ;
  254. appendHelper( "\\amalg", "amalg" ) ;
  255. appendHelper( "\\nabla", "nabla" ) ;
  256. appendHelper( "\\int", "int" ) ;
  257. appendHelper( "\\sqcup", "sqcup" ) ;
  258. appendHelper( "\\sqcap", "sqcap" ) ;
  259. appendHelper( "\\sqsubseteq", "sqsubseteq" ) ;
  260. appendHelper( "\\sqsupseteq", "sqsupseteq" ) ;
  261. appendHelper( "\\S", "S" ) ;
  262. appendHelper( "\\dag", "dag" ) ;
  263. appendHelper( "\\ddag", "ddag" ) ;
  264. appendHelper( "\\P", "P" ) ;
  265. appendHelper( "\\clubsuit", "clubsuit" ) ;
  266. appendHelper( "\\Diamond", "Diamond" ) ;
  267. appendHelper( "\\Heart", "Heart" ) ;
  268. appendHelper( "\\spadesuit", "spadesuit" ) ;
  269. addHelper( "symbols2", FCKLang["DlgMimeTeXSymbols"] + " 2" ) ;
  270. appendHelper( "\\leftharpoonup", "leftharpoonup" ) ;
  271. appendHelper( "\\leftharpoondo", "leftharpoondo" ) ;
  272. appendHelper( "\\rightharpoonup", "rightharpoonup" ) ;
  273. appendHelper( "\\rightharpoondo", "rightharpoondo" ) ;
  274. appendHelper( "\\triangleright", "triangleright" ) ;
  275. appendHelper( "\\triangleleft", "triangleleft" ) ;
  276. appendHelper( "\\star", "star" ) ;
  277. appendHelper( "\\partial", "partial" ) ;
  278. appendHelper( "\\flat", "flat" ) ;
  279. appendHelper( "\\natural", "natural" ) ;
  280. appendHelper( "\\sharp", "sharp" ) ;
  281. appendHelper( "\\smile", "smile" ) ;
  282. appendHelper( "\\frown", "frown" ) ;
  283. appendHelper( "\\ell", "ell" ) ;
  284. appendHelper( "\\imath", "imath" ) ;
  285. appendHelper( "\\jmath", "jmath" ) ;
  286. //appendHelper( "\\vp", "vp" ) ;
  287. //appendHelper( "\\vec", "vec" ) ;
  288. appendHelper( "\\ss", "ss" ) ;
  289. appendHelper( "\\ae", "ae" ) ;
  290. appendHelper( "\\oe", "oe" ) ;
  291. appendHelper( "\\AE", "AE" ) ;
  292. appendHelper( "\\OE", "OE" ) ;
  293. appendHelper( "\\moo", "moo" ) ;
  294. appendHelper( "\\Lbag", "Lbag" ) ;
  295. appendHelper( "\\Rbag", "Rbag" ) ;
  296. appendHelper( "\\lightning", "lightning" ) ;
  297. appendHelper( "\\llbracket", "llbracket" ) ;
  298. appendHelper( "\\rrbracket", "rrbracket" ) ;
  299. appendHelper( "\\subsetpluseq", "subsetpluseq" ) ;
  300. appendHelper( "\\supsetpluseq", "supsetpluseq" ) ;
  301. appendHelper( "\\Yup", "Yup" ) ;
  302. appendHelper( "\\Ydown", "Ydown" ) ;
  303. //appendHelper( "\\cyr A", "cyr A" ) ;
  304. //appendHelper( "\\cyr a", "cyr a" ) ;
  305. //appendHelper( "\\cyr Dj", "cyr Dj" ) ;
  306. //appendHelper( "\\cyr Zh", "cyr Zh" ) ;
  307. addHelper( "calendar", FCKLang["DlgMimeTeXCalendar"] ) ;
  308. appendHelper( "\\blue\\normalsize\\calendar", "" ) ;
  309. appendHelper( "\\reverse\\opaque\\red\\normalsize\\calendar[2008,9,11]", "" ) ;
  310. appendHelper( "\\today", "" ) ;
  311. appendHelper( "\\green\\today[2]", "" ) ;
  312. appendHelper( "\\red\\today[3]", "" ) ;
  313. ////jc end
  314. addHelper( "numeric", FCKLang["DlgMimeTeXNumeric"] ) ;
  315. var al_l = "abcdefghijklmnopqrstuvwxyz" ;
  316. var al_u = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ;
  317. var num = "0123456789" ;
  318. var alnum = al_u + num ;
  319. for ( var i = 0, n = alnum.length ; i < n ; i++ )
  320. {
  321. appendHelper( "\\mathbb{" + alnum.substr( i, 1 ) + "}", "math bold " + alnum.substr( i, 1 ) ) ;
  322. }
  323. htmlHelper( "<br />" ) ;
  324. for ( var i = 0, n = al_u.length ; i < n ; i++ )
  325. {
  326. appendHelper( "\\mathcal{" + al_u.substr( i, 1 ) + "}", "math cal " + al_u.substr( i, 1 ) ) ;
  327. }
  328. htmlHelper( "<br />" ) ;
  329. for ( var i = 0, n = al_u.length ; i < n ; i++ )
  330. {
  331. appendHelper( "\\mathfrak{" + al_u.substr( i, 1 ) + "}", "math frak " + al_u.substr( i, 1 ) ) ;
  332. }
  333. addHelper( "lowergreek", FCKLang["DlgMimeTeXLowerGreeks"] ) ;
  334. appendHelper( "\\alpha", "lower alpha" ) ;
  335. appendHelper( "\\beta", "lower beta" ) ;
  336. appendHelper( "\\delta", "lower delta" ) ;
  337. appendHelper( "\\epsilon", "lower epsilon" ) ;
  338. appendHelper( "\\varepsilon", "lower varepsilon" ) ;
  339. appendHelper( "\\eta", "lower eta" ) ;
  340. appendHelper( "\\gamma", "lower gamma" ) ;
  341. appendHelper( "\\lambda", "lower lambda" ) ;
  342. appendHelper( "\\mu", "lower mu" ) ;
  343. appendHelper( "\\nu", "lower nu" ) ;
  344. appendHelper( "\\omega", "lower omega" ) ;
  345. appendHelper( "\\rho", "lower rho" ) ;
  346. appendHelper( "\\varrho", "lower varrho" ) ;
  347. appendHelper( "\\sigma", "lower sigma" ) ;
  348. appendHelper( "\\varsigma", "lower varsigma" ) ;
  349. appendHelper( "\\tau", "lower tau" ) ;
  350. appendHelper( "\\phi", "lower phi" ) ;
  351. appendHelper( "\\psi", "lower psi" ) ;
  352. appendHelper( "\\chi", "lower chi" ) ;
  353. appendHelper( "\\theta", "lower theta" ) ;
  354. appendHelper( "\\kappa", "lower kappa" ) ;
  355. appendHelper( "\\xi", "lower xi" ) ;
  356. appendHelper( "\\zeta", "lower zeta" ) ;
  357. addHelper( "uppergreek", FCKLang["DlgMimeTeXUpperGreeks"] ) ;
  358. appendHelper( "\\Delta", "upper delta" ) ;
  359. appendHelper( "\\Gamma", "upper gamma" ) ;
  360. appendHelper( "\\Lambda", "upper lambda" ) ;
  361. appendHelper( "\\Theta", "upper theta" ) ;
  362. appendHelper( "\\Pi", "upper pi" ) ;
  363. appendHelper( "\\Phi", "upper phi" ) ;
  364. appendHelper( "\\Psi", "upper psi" ) ;
  365. appendHelper( "\\Omega", "upper omega" ) ;
  366. appendHelper( "\\Sigma", "upper sigma" ) ;
  367. appendHelper( "\\Xi", "upper xi" ) ;
  368. appendHelper( "\\Upsilon", "upper upsilon" ) ;
  369. addHelper( "operators", FCKLang["DlgMimeTeXOperators"] ) ;
  370. appendHelper( "\\frac{x}{y}", "" ) ;
  371. appendHelper( "x^{n}", "" ) ;
  372. appendHelper( "x_{n}", "" ) ;
  373. appendHelper( "\\sqrt {x}", "" ) ;
  374. appendHelper( "\\sqrt[3]{x}", "" ) ;
  375. appendHelper( "\\sqrt[4]{x}", "" ) ;
  376. appendHelper( "\\vec {x}", "" ) ;
  377. addHelper( "functions", FCKLang["DlgMimeTeXFunctions"] ) ;
  378. appendHelper( "\\ln", "ln" ) ;
  379. appendHelper( "\\log", "log" ) ;
  380. appendHelper( "\\exp", "exp" ) ;
  381. appendHelper( "\\arg", "arg" ) ;
  382. appendHelper( "\\Re", "Re" ) ;
  383. appendHelper( "\\Im", "Im" ) ;
  384. addHelper( "trigonometry", FCKLang["DlgMimeTeXTrigonometry"] ) ;
  385. appendHelper( "\\sin", "sin" ) ;
  386. appendHelper( "\\cos", "cos" ) ;
  387. appendHelper( "\\tan", "tan" ) ;
  388. appendHelper( "\\cot", "cot" ) ;
  389. appendHelper( "\\arcsin", "arcsin" ) ;
  390. appendHelper( "\\arccos", "arccos" ) ;
  391. appendHelper( "\\arctan", "arctan" ) ;
  392. appendHelper( "\\sinh", "sinh" ) ;
  393. appendHelper( "\\cosh", "cosh" ) ;
  394. appendHelper( "\\tanh", "tanh" ) ;
  395. appendHelper( "\\coth", "coth" ) ;
  396. addHelper( "analysis", FCKLang["DlgMimeTeXAnalysis"] ) ;
  397. appendHelper( "\\int _{-\\infty}^{x}\\mathrm{d}t", "integral dt from -infinite to x" ) ;
  398. appendHelper( "\\sum_{k=1}^{+\\infty}", "sum from k=1 to +infinite" ) ;
  399. appendHelper("\\frac{\\mathrm{d} f(x,y)}{\\mathrm{d}x}", "" ) ;
  400. appendHelper( "\\frac{\\partial f(x,y)}{\\partial x}", "" ) ;
  401. appendHelper( "\\lim _{\\small{x\\to +\\infty}}", "" ) ;
  402. ////jc
  403. addHelper( "moresamples", FCKLang["DlgMimeTeXMoreSamples"] ) ;
  404. appendHelper( "\\\large\\begin{array}{c.c|c} a_1&a_2&a_3\\\\\\hdash b_1&b_2&b_3\\\\\\hline c_1&c_2&c_3\\end{array}", "" ) ;
  405. appendHelper( "\\large e^x=\\sum_{n=0}^\\infty\\frac{x^n}{n!}", "" ) ;
  406. appendHelper( "\\large e^x=\\lim_{n\\to\\infty} \\left(1+\\frac xn\\right)^n", "" ) ;
  407. appendHelper( "\\large \\left( \\begin{array}{GC+30} \\cos\\frac\\theta2 & i\\,\\sin\\frac\\theta2\\\ i\\,\\sin\\frac\\theta2 & \\cos\\frac\\theta2 \\end{array} \\right) \\left( \\begin{array} z & x_{\\tiny-} \\\ x_{\\tiny+} & -z \\end{array} \\right) \\hfill{300}\\text{\\normalsize Example 1}", "" ) ;
  408. appendHelper( "\\large x=\\frac{-b\\pm\\sqrt{b^2-4ac}}{2a}", "" ) ;
  409. appendHelper( "\\large f^\\prime(x)\\ = \\lim_{\\Delta x\\to0}\\frac{f(x+\\Delta x)-f(x)}{\\Delta x}", "" ) ;
  410. appendHelper( "\\large\\hspace{5}\\unitlength{1} \\picture(175,100){ (50,50){\\circle(100)} (1,50){\\overbrace{\\line(46)}^{4$\\;\\;a}} (52,50){\\line(125)} (50,52;115;2){\\mid} (52,55){\\longleftar[60]} (130,56){\\longrightar[35]} (116,58){r} (c85,50;80;2){\\bullet} (c85,36){\\large-q} (c165,36){\\large q} (42,29){\\underbrace{\\line(32)}_{\\small a^2/r\\;\\;\\;}} }", "" ) ;
  411. appendHelper( "\\large\\varepsilon=\\sum_{i=1}^{n-1} \\frac1{\\Delta x}\\int_{x_i}^{x_{i+1}}\\left\\{\\frac1{\\Delta x}\\big[ (x_{i+1}-x)y_i^\\ast+(x-x_i)y_{i+1}^\\ast\\big]-f(x)\\right\\}^2dx", "" ) ;
  412. appendHelper( "\\large\\frac{dv^m}{ds}=-\\Gamma^m_{oo}v^{o^2} =-g^{mn}\\Gamma_{noo}v^{o^2}=\\frac12g^{mn}g_{oo,n}v^{o^2}", "" ) ;
  413. appendHelper( "\\large f=b_o+\\frac{a_1}{b_1+ \\frac{a_2}{b_2+\\frac{a_3}{b_3+a_4}}}", "" ) ;
  414. appendHelper( "\\large\\tilde y=\\left\\{ {\\ddot x\\text{ if \\vec x odd}\\atop\\hat{\\,\\bar x+1}\\text{ if even}}\\right.", "" ) ;
  415. appendHelper( "\\large\\overbrace{a,...,a}^{\\text{k a^,s}}, \\underbrace{b,...,b}_{\\text{l b^,s}}\\hspace{10} \\large\\underbrace{\\overbrace{a...a}^{\\text{k a^,s}}, \\overbrace{b...b}^{\\text{l b^,s}}}_{\\text{k+l elements}}", "" ) ;
  416. /*
  417. appendHelper( "\\large\\scr{J}^{i0}=+\\frac i2 \\left[\\begin{array}{cc}\\sigma_i&0\\\0&-\\sigma_i\\end{array}\\right] \\hspace{10}\\scr{J}^{ij}=\\frac12\\varepsilon_{ijk} \\left[\\begin{array}{cc}\\sigma_k&0\\\0&\\sigma_k\\end{array}\\right]", "" ) ;
  418. */
  419. appendHelper( "\\small\\hspace{10}\\unitlength{.75} \\picture(120,220){ (60,200){\\circle(120,40)} (0,20){\\line(0,180)} (5,189;0,-30){\\pict(110,20){(c20,10;70;2){ \\pict(40,20){(20,10){\\circle(40,20)}(c10,10)+(c30,10)-}} } } (119,20){\\line(0,180)} (60,20){\\circle(120,40;34)}}", "" ) ;
  420. appendHelper( "\\normalsize\\unitlength{.6}\\picture(100){ (50,50){\\circle(99)} (20,55;50,0;2){\\fs{+1}\\hat\\bullet} (50,40){\\bullet} (50,35){\\circle(50,25;34)} (50,35){\\circle(50,45;34)}}", "" ) ;
  421. ////jc end
  422. $('#helpers > div').hover(function() {
  423. $(this).find('p').fadeIn('fast' ) ;
  424. }, function() {
  425. $(this).find('p').fadeOut('fast' ) ;
  426. } ) ;
  427. // FCKEditor
  428. LoadSelected() ;
  429. // Show the "Ok" button.
  430. window.parent.SetOkButton( true ) ;
  431. SelectField( 'formula' ) ;
  432. // End FCKEditor
  433. } ) ;
  434. // FCKEditor
  435. function LoadSelected()
  436. {
  437. if ( !eSelected )
  438. {
  439. return ;
  440. }
  441. if ( eSelected.tagName == 'MATH' )
  442. {
  443. img_tag = false ;
  444. document.pastemath.formula.value = eSelected.firstChild.nodeValue ;
  445. formulaPreview() ;
  446. }
  447. else if ( eSelected.tagName == 'IMG' )
  448. {
  449. img_tag = true ;
  450. // We will read the formula from the url, because the back slash is escaped with %5C,
  451. // so the re is no risk the formula to be damaged by the php stripslashes(...) function.
  452. //document.pastemath.formula.value = eSelected.alt ;
  453. var formula = '' ;
  454. var src = eSelected.src.toString() ;
  455. var formula_start = src.indexOf( '?' ) ;
  456. if ( formula_start != -1 )
  457. {
  458. formula = src.substr( formula_start + 1 ).replace(/%5C/gi,'\\').replace(/%20/g,' ') ;
  459. formula = formula.Trim() ;
  460. if ( formula.indexOf( '\\Large' ) == 0 )
  461. {
  462. formula = formula.substr( 6 ) ;
  463. }
  464. formula = formula.Trim() ;
  465. }
  466. document.pastemath.formula.value = formula ;
  467. //
  468. formulaPreview() ;
  469. }
  470. else
  471. {
  472. eSelected == null ;
  473. }
  474. }
  475. function Ok()
  476. {
  477. result = document.pastemath.formula.value ;
  478. if( result.length > 0 ) {
  479. FCK.Focus() ;
  480. if ( eSelected )
  481. {
  482. FCK.Selection.SelectNode( eSelected ) ;
  483. }
  484. if ( img_tag )
  485. {
  486. //solved a problem with stripslashes by Christophe Lefevre
  487. var img_src = result_cgi + result ;
  488. FCK.InsertHtml( '<img src="' + img_src.replace(/\\/g, "%5C") + '" title="' + result + '" alt="' + result + '" />' ) ;
  489. }
  490. else
  491. {
  492. FCK.InsertHtml( '<math>' + result + '</math>' ) ;
  493. }
  494. }
  495. window.close() ;
  496. return true ;
  497. }
  498. // End FCKEditor
  499. </script>
  500. <script type="text/javascript">
  501. document.write( FCKTools.GetStyleHtml( GetCommonDialogCss() ) ) ;
  502. </script>
  503. <style type="text/css">
  504. body, td, input, textarea, select, label { font-family: Arial, Verdana, Geneva, helvetica, sans-serif; font-size: 11px; }
  505. </style>
  506. <!--solved a problem with iexplorer 7 by jc -->
  507. <style type="text/css">
  508. div.helpers
  509. {
  510. position: absolute;
  511. max-width: 360px;
  512. width:expression(document.body.clientWidth > 360? "360px": "auto" );
  513. overflow:auto;
  514. }
  515. li.helpers
  516. {
  517. margin: 3px;
  518. list-style-type: none;
  519. }
  520. .helper
  521. {
  522. margin: 3px;
  523. }
  524. .off
  525. {
  526. display: none;
  527. }
  528. .pane
  529. {
  530. margin: 1px;
  531. border: 1px solid black;
  532. }
  533. .formula
  534. {
  535. position: absolute;
  536. left: 375px;
  537. }
  538. #mimetex_error_message
  539. {
  540. font-size: 13px;
  541. }
  542. </style>
  543. </head>
  544. <body>
  545. <div id="content" style="display: none;">
  546. <div class="helpers">
  547. <b><span fckLang="DlgMimeTeXHelpers">Helpers:</span></b>
  548. <div id="helpers">
  549. </div>
  550. </div>
  551. <div class="formula">
  552. <div style="margin-top: 0px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; padding: 0px;">
  553. <b><span fckLang="DlgMimeTeXFormula">Formula:</span></b>
  554. </div>
  555. <div style="margin: 0px; padding: 0px;">
  556. <form name="pastemath" id="pastemath">
  557. <textarea id="formula" name="formula" cols="60" rows="8" onKeyUp="javascript: formulaPreview();" style="width: 370px;"></textarea>
  558. </form>
  559. </div>
  560. <div align="right"><a href="http://www.forkosh.com/mimetex.html" target="_blank" style="left:auto"><span fckLang="DlgMimeTeXManual">Manual</span></a></div>
  561. <div id="preview" class=off>
  562. <div style="margin-top: 0px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; padding: 0px;">
  563. <b><span fckLang="DlgMimeTeXPreview">Preview:</span></b>
  564. </div>
  565. <div style="margin: 0px; padding: 0px;">
  566. <img src="" alt="Image" name="formula_preview" id="formula_preview" align="middle"/>
  567. </div>
  568. </div>
  569. </div>
  570. </div>
  571. <div id="mimetex_error_message" style="display: none; text-align: center; padding-top: 100px;">
  572. <p><span fckLang="DlgMimeTeXEditorNotAvailable">The math formula editor is not available.</span></p>
  573. <p><span fckLang="DlgMimeTeXNotInstalled">A software service (MimeTeX) has not been installed on your server or it is not accessible.</span></p>
  574. <p><span fckLang="DlgMimeTeXSeeInstallationManual">To resolve the problem, see the Chamilo LMS installation guide.</span></p>
  575. <p><a href="http://www.forkosh.com/mimetex.html" target="_blank"><span fckLang="DlgMimeTeXManual">Manual</span></a></p>
  576. </div>
  577. </body>
  578. </html>