Dear Sergiu,
The image I sent made the message to large. If you would like to see the rendering I would
be glad to send it to you. Simply put, the code you supplied still doesn't work even
though I copied and pasted your code directly into my wiki 2.0 page.
greetings,
Steven Calkins
E-Mail: steven.calkins(at)crossmediasolutions.de
-----Ursprüngliche Nachricht-----
Von: Steven Calkins
Gesendet: Montag, 16. November 2009 10:50
An: 'XWiki Users'
Betreff: AW: [xwiki-users] Latex {cases} command doesn't work
in default xwiki 2.0 formula macro
Hi Sergiu,
I tried your example after changing the line
"macro.formula.renderer" in the properties file back to
"native"and restarting xwiki. Sadly it still didn't work on
my machine. So what is different on your machine compared to
mine? (Do you perhaps have a developing environment which
automatically finds the proper TeX parts?) I just copied and
pasted your example. The rendered results are seen in the
attached screenshot. I'm not sure that attachments get
through to you, but if you can view it, you can see that the
formulae are rendered, just the cases command is not
executed. I'm still using a SKIN from 1.9. on XWiki
Enterprise 2.0.3.24848, running on postgres but I believe
that should be irrelevant. Here's my code:
================START XWIKI CODE ==================================
=== Continuation and cases===
This example from wikipedia doesn't seem to work:
{{formula fontSize="normal"}}
f(x) = \begin{cases}1 & \mbox{-1 \le x < 0\par} \\
\frac{1}{2} & \mbox{x = 0} \\ 1 - x^2 &
\mbox{otherwise\par}\end{cases} {{/formula}}
Example from Sergiu
{{formula}}
f(x) =
\begin{cases}
1 & -1 \le x \le 0 \\
\frac{1}{2} & x = 0 \\
1 - x^2 & \mbox{otherwise}
\end{cases}
{{/formula}}
Case definitions
Used when a definition has two or more cases. Use the case
statement. Notice that the spaces after the instances of if
were included inside the mbox declarations.
{{formula fontSize="normal"}}f(n) = \begin{cases} n/2, &
\mbox{if } n\mbox{ is even} \\ 3n+1, & \mbox{if } n\mbox{ is
odd} \end{cases}{{/formula}}
Third try
{{formula fontSize="normal"}}f(n) = \left\{ \begin{array}{l l}
n/2 & \quad \text{if $n$ is even}\\
-(n+1)/2 & \quad \text{if $n$ is odd}\\ \end{array}
\right.{{/formula}}
======================END XWIKI CODE==================
Cheers,
Steven Calkins
E-Mail: steven.calkins(at)crossmediasolutions.de (in the
event you want to see my image and can't)
-----Ursprüngliche Nachricht-----
Von: users-bounces(a)xwiki.org [mailto:users-bounces@xwiki.org]
Im Auftrag von Sergiu Dumitriu
Gesendet: Freitag, 13. November 2009 19:16
An: XWiki Users
Betreff: Re: [xwiki-users] Latex {cases} command doesn't work
in default xwiki 2.0 formula macro
On 11/13/2009 02:56 PM, Steven Calkins wrote:
Hi Sergiu,
I tried what you said, adding the line
"macro.formula.renderer =
native" to WEB-INF/xwiki.properties
and saving it. Then I restarted Xwiki but it didn't work. It
still rendered the formula in a single line. Then I tried
"the line "macro.formula.renderer=mathtran", saved it, and
restarted xwiki. It still didn't work. Is there some part of
the the TeX package still missing? I just installed XWiki
Enterprise 2.0.3.24848, it runs on postgres.
OK, it seems that the default renderer is the native one, so
there was no need to change it.
I tried your example, and actually there's a problem with the
formula.
The code from your mail causes the native renderer to fail
because there's a syntax error, specifically the first mbox
contains \le, which is only valid in math mode. This works fine:
{{formula}}
f(x) =
\begin{cases}
1 & -1 \le x \le 0 \\
\frac{1}{2} & x = 0 \\
1 - x^2 & \mbox{otherwise}
\end{cases}
{{/formula}}
I was a little surprised that I had to add a line
in the
WEB-INF/xwiki.properties file and not uncomment a line and
change its value, as you do in most cases. Could it be that I
have an older config file or is the line in
WEB-INF/xwiki.properties not available yet in the newest
version? I used the config from the download, and changed
only those values that pertained to my earlier system settings.
My fault, I forgot to add this setting in the template that
generates xwiki.cfg.
Greetings,
Steven Calkins
-----Ursprüngliche Nachricht-----
Von: users-bounces(a)xwiki.org [mailto:users-bounces@xwiki.org] Im
Auftrag von Sergiu Dumitriu
Gesendet: Freitag, 13. November 2009 12:31
An: XWiki Users
Betreff: Re: [xwiki-users] Latex {cases} command doesn't work in
default xwiki 2.0 formula macro
On 11/13/2009 11:45 AM, Steven Calkins wrote:
> Dear all,
>
> The LaTeX {case} macro doesn't seem to work in Xwiki
2.0 with the
> default LaTeX renderer.
>
> Try these two examples to reproduce it and compare with
>
http://en.wikipedia.org/wiki/Math_markup#Examples_2:
> [XWIKI CODE STARTS HERE]
>
> === Continuation and cases===
> This example from wikipedia doesn't seem to work:
> {{formula fontSize="normal"}}f(x) = \begin{cases}1&
\mbox{-1
\le x<
> 0\par} \\
> \frac{1}{2} \;\;\;& \mbox{x = 0\par} \\ 1 - x^2&
> \mbox{otherwise\par}\end{cases}{{/formula}}
>
> ===Case definitions===
>
> {{formula fontSize="normal"}}f(n) = \begin{cases} n/2,&
\mbox{if }
n\mbox{
is even} \\ 3n+1,& \mbox{if } n\mbox{ is odd}
\end{cases}{{/formula}}
[XWIKI CODE ENDS HERE]
Any suggestions?
The cases environment is not standard TeX, it belongs to
the amsmath
package. This means that it is not supposed to
work using
the default
backend. It should work with the native one,
which uses the amsmath
package, and you could try using the mathtran one. If you decide to
change the backend, you'll find instructions in the last
paragraph on
http://code.xwiki.org/xwiki/bin/view/Macros/FormulaMacro#HTechnicalinf
ormation
--
Sergiu Dumitriu
http://purl.org/net/sergiu/
_______________________________________________
users mailing list
users(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/users