Mathematica 9 is now available
Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: ExportString[exp, "MathML"]

  • To: mathgroup at
  • Subject: [mg61906] Re: [mg61881] ExportString[exp, "MathML"]
  • From: Chris Hill <chill at>
  • Date: Fri, 4 Nov 2005 05:11:26 -0500 (EST)
  • References: <>
  • Sender: owner-wri-mathgroup at

At 03:58 AM 11/3/2005, Steven T. Hatton wrote:

>So, 1) how do I convert the expression to MathML, without having it evaluate
>to 0? There is a small caveat. In Mathematica terminology, that is really
>trying to do an assignment, so it doesn't make sense as a Mathematica
>expression to have the '='. A '==' would make more sense for an expression.
>In this case, however, I want to present the expression in traditional
>mathematical notation. 2) How do I prevent Mathematica from tacking on its
>own annotations?  As I say, I neither need nor want them.

1) Use HoldForm around the first argument to ExportString.  In 
addition, make sure the expression isn't evaluated before it gets to 
ExportString by using the standard evaluation inhibitors like 
Unevaluated or make your export function HoldFirst.
2) Use the "IncludeMarkupAnnotations" -> False conversion option.

Here is an updated version of your function and your example input/output:

MMLString[exp_, id_String] :=
   ExportString[HoldForm[exp], "MathML",
     ConversionOptions -> {"MathAttributes" -> {"id" -> id},
         "UseUnicodePlane1Characters" -> False, "Entities" -> {"MathML",
             "\[Implies]" -> "&Implies;",
             "\[SuchThat]" -> "&SuchThat;"
         "NamespacePrefixes" -> {""; ->
               "mml"}, "Formats" -> {"PresentationMathML"},
         "Annotations" -> {}, "IncludeMarkupAnnotations" -> False

     Unevaluated[\[NotExists] \[Alpha] \[Element] \[DoubleStruckCapitalN] \
\[SuchThat] \[Alpha]\^\[Prime] = 0], "\<peano-2\>"]\)

<mml:math xmlns:mml=''
      <mml:mi mathvariant='double-struck'>N</mml:mi>

Chris Hill
Wolfram Research 

  • Prev by Date: Re: Error: Prime::intpp: Positive integer argument expected in Prime[16.`]
  • Next by Date: Re: Re: How was this typed?
  • Previous by thread: Re: ExportString[exp, "MathML"]
  • Next by thread: Re: ExportString[exp, "MathML"]