| Vendor | MindTouch |
| Type | Native |
| Categories | Misc |
| Requires | MindTouch 1.8.2 or later |
| OS Restriction | None |
| Status | Prototype |
| License | Free/Open Source |
| SID (service id) | sid://mindtouch.com/2007/06/math |
| Assembly | mindtouch.deki.services |
Install Extension
This extension contains functions for rendering and computing mathematical expressions.
See also How to add an extension, Using the Extension Dialog, Learn about DekiScript, Extensions Directory.
Configuration:
| Config Key | Description |
| latex-path | Path to latex application |
| dvips-path | Path to dvips application |
| imagemagick-path | Path to convert application |
If you want an alternative to getting LaTeX to work, see: MathML
Fedora / Red Hat / CentOS
Install the following before using the Math service under Debian Linux
yum install tetex-latex
mkdir /var/www/.texmf-var chown dekiwiki:apache /var/www/.texmf-var
An alternative for this functionality on these environments can be achieved by invoking the ASCIIMathML JavaScript via the template here.
Microsoft Windows Setup
Install the following applications before using the Math service under Microsoft Windows XP and Windows Server 2003/2008.
Debian Setup
Install the following before using the Math service under Debian Linux
apt-get install tetex-extra gs-gpl imagemagick
*if any 404 errors are received in step 1., please run 'apt-get update'
Gentoo Setup
Install the following before using the Math service under Gentoo Linux
emerge -a tetex ghostscript imagemagick
Functions:
Render math formula.
Parameters:
| Name | Type | Description |
| formula | str | Formula in Latex-AMS notation |
Remarks: Refer here for a math guide for Latex.
Samples:
Embed an InstaCalc sheet.
Parameters:
| Name | Type | Description |
| sheet | uri | URI to InstaCalc sheet. |
| width | num | Optional. Width of sheet (default: 425) |
| height | num | Optional. Height of sheet (default: 300) |
Remarks: Refer here for more information on InstaCalc.
Samples:
| Output | ||
|
| File | Version | Size | Modified | |
|---|---|---|---|---|
| ||||
| ||||
| ||||
| ||||
Copyright © 2011 MindTouch, Inc. Powered by
unlike other wikis that have Latex rendering, the deki syntax forces you to escape the \ operator each time, so a simple equation which in dokuwiki and normal latex would look like:
\alpha = \beta + \gamma
in dekiwiki you'd have to write:
\\alpha = \\beta + \\gamma
this is a major disadvantage since it's no longer possible to simply cut and paste formulas between latex documents and dekiwiki!
Is here a way that you could could fix the syntax to allow for "normal" latex to render properly without having to manually escape the \ characters?
Thanks,
YJ
You can already do what you desire. Instead of using the {{ math.formula() }} syntax, use the "transformations" approach as shown in http://wiki.developer.mindtouch.com/MindTouch_Deki/FAQ/Page_Management/How_do_I...Use_the_Transformations%2f%2fTransform_Content_menu_item%3f:
1) Enter your raw latex markup (with no extra backslashes.)
2) Select the text, change the style to "formatted"
3) Open the transformations menu (the small gear button in the editor toolbar) and select "math.formula" edited 05:32, 3 Jul 2008
MindTouch.Deki.Script.DekiScriptInvokeException: function 'Formula' failed
<?xml-stylesheet type='text/xsl' href='/@api/host/resources/error.xslt'?>
<error>
<status>400</status>
<title>Bad Request</title>
<message>latex misconfigured or missing</message>
<uri>https://aetdwiki.gsfc.nasa.gov/@api/deki/services/default/51/Formula</uri>
</error>
<?xml-stylesheet type='text/xsl' href='/@api/host/resources/error.xslt'?>
<error>
<status>400</status>
<title>Bad Request</title>
<message>latex misconfigured or missing</message>
<uri>https://aetdwiki.gsfc.nasa.gov/@api/deki/services/default/51/Formula</uri>
</error>
at MindTouch.Deki.Script.DekiScriptRuntime.<Invoke>d__0.MoveNext()
at MindTouch.Dream.Coroutine.Iterate(IEnumerator`1 coroutine, TaskEnv env, Action`1 completion)
at System.SysUtil.Rethrow(Exception exception)
at MindTouch.Dream.ResultBase.Confirm()
at MindTouch.Dream.Result`1.Wait()
at MindTouch.Deki.Script.DekiScriptCall.Evaluate(DekiScriptEnv env)
at MindTouch.Deki.Script.Dom.DekiScriptDomExpr.Evaluate(DekiScriptEvalContext context, XmlNode parent, DekiScriptEnv env)
Just download the .js file to your wiki and point the Template:ASCIIMathML to that, works great!
MindTouch.Deki.Script.DekiScriptInvokeException: function 'Formula' failed ---> System.IO.FileNotFoundException: Could not find file "/tmp/a34cfa4d-f915-0463-3319-4551474ea7bb.png".
at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean anonymous, FileOptions options) [0x00000]
at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share) [0x00000]
at (wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor (string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare)
at System.IO.File.Open (System.String path, FileMode mode, FileAccess access, FileShare share) [0x00000]
at System.IO.File.ReadAllBytes (System.String path) [0x00000]
at MindTouch.Deki.Services.MathService.Formula (System.String formula) [0x00000]
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[])
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000]
--- End of exception stack trace ---
at MindTouch.Deki.Script.DekiScriptRuntime.Invoke(XUri uri, DekiScriptLiteral args, DekiScriptEnv env, Result`1 result)
at MindTouch.Deki.DekiWikiService.GetPageContents(DreamContext context, DreamMessage request, Result`1 response)
--- End of coroutine stack trace ---
--- End of inner exception stack trace ---
at MindTouch.Deki.Script.DekiScriptRuntime+<Invoke>d__0.MoveNext () [0x00000]
at MindTouch.Tasking.Coroutine.Invoke (System.Func`1 invocation) [0x00000]
--- End of exception stack trace ---
at MindTouch.Deki.Script.DekiScriptRuntime.Invoke(XUri uri, DekiScriptLiteral args, DekiScriptEnv env, Result`1 result)
at MindTouch.Deki.DekiWikiService.GetPageContents(DreamContext context, DreamMessage request, Result`1 response)
--- End of coroutine stack trace ---
The permissions on /tmp
drwxrwxrwt 7 root root 4096 Apr 4 17:05 tmp
(SE is disabled btw)
# cat /etc/sysconfig/selinux
SELINUX=disabled
SELINUXTYPE=targeted
It adds a Transformation to the editor (mathjax.formula). Optionally the Extension {{ mathjax.equation(equation: "your_equation") }} can be used. MathML an TeX is supported; the math expressions are rendered in JavaScript and can be Cut&Paste to MathML or TeX compliant aplications such as word, openoffice. FireMath on Firefox can be used to WYSIWYG edition.
MathJax must be installed. Eventually you'll need to change the MathJax path on the script accordingly.
Cheers.
<extension>
<title>MathJax</title>
<namespace>mathjax</namespace>
<function>
<name>equation</name>
<description>This will add a MathJax equation</description>
<param name="equation" type="str">MathML or TeX equation</param>
<return>
<html xmlns:eval="http://mindtouch.com/2007/dekiscript">
<head></head>
<body>
<script type="text/javascript" src="/var/www/dekiwiki/skins/common/mathjax/MathJax.js?config=TeX-AMS-MML_HTMLorMML"> </script>
<script type="text/javascript"> document.write(<eval:js>args.equation</eval:js>); </script>
</body>
<tail></tail>
</html>
</return>
</function>
<function transform="pre">
<name>formula</name>
<description>Format a MathML or Tex equation</description>
<param name="formula" type="str">MathML or TeX equation text</param>
<return>
<html xmlns:eval="http://mindtouch.com/2007/dekiscript">
<head></head>
<body>
<script type="text/javascript" src="/var/www/dekiwiki/skins/common/mathjax/MathJax.js?config=TeX-AMS-MML_HTMLorMML"> </script>
<script type="text/javascript"> document.write(<eval:js>$formula</eval:js>); </script>
</body>
<tail></tail>
</html>
</return>
</function>
</extension>