Formula Macro Shortcut

In our wiki, we’re using formulas extensively. We use the Formula macro for them. This works great, there is just the hassle of including {{formula}} ... {{/formula}} everytime you need . Does someone know if XWiki can be configured so that there is a shortcut for that? Or even better: If LaTeX syntax (using dollar signs: $ … $) is supported?

Thanks for any help.

Or even better: If LaTeX syntax (using dollar signs: $ … $) is supported?

There is a LaTeX serializer (not sure how good it is) right now but no parser AFAIK. I see that Doxia provide one so it should not be too hard to implement a XWiki parser based on it. You can look at xwiki-rendering/xwiki-rendering-syntaxes/xwiki-rendering-syntax-twiki at master · xwiki/xwiki-rendering · GitHub (which is also based on doxia) for inspiration.

Does someone know if XWiki can be configured so that there is a shortcut for that?

Depends how short you want it to be :slight_smile: You could easily implement a {{f}}...{{/f}} macro(1) which redirect to formula macro behind the scene. Anything that don’t involve macro syntax at all will be more complex and will require implementing a new rendering syntax parser(2).

1: http://rendering.xwiki.org/xwiki/bin/view/Main/ExtendingMacro
2: http://rendering.xwiki.org/xwiki/bin/view/Main/Extending#HAddingaParser

You can implement a Transformation too. See http://rendering.xwiki.org/xwiki/bin/view/Main/Transformations (that’s a lot simpler than implementing a new syntax)

Right, you could do a transformation too.

Maybe he’s looking for a keyboard shortcut to insert {{formula}}{{/formula}} in the text area and place the caret in between?

I can easily implement a keyboard shortcut with my browser. The $ … $ notation would be the nicest solution because it would allow me to copy text from LaTeX files.

Thanks for all the suggestions. I’ll look into the transformations.

1 Like