OpenersNotesSection(Spacer1)Details

OpenersPrimaryExamplesSection(Spacer1)Examples  (6)

OpenersExampleSection0(Spacer1)Basic Examples  (6)

Interpret TeX inputs without evaluating them:

Interpreter["HeldTeXExpression"]["2+2"]

Interpreter["HeldTeXExpression"]["\\sin(\\pi)"]

No evaluation is attempted when matching the choices:

Interpreter[Restricted["HeldTeXExpression",{{True, False}}]]["1=2"]

Interpreter[Restricted["HeldTeXExpression",{{True, HoldComplete[Equal[1,2]]}}]]["1=2"]

By default, all symbols are allowed. Restrict to a list of allowed symbols:

Interpreter[Restricted["HeldTeXExpression",{Greater}]]["x>2"]

Interpreter[Restricted["HeldTeXExpression",{Greater}]]["\\sin(x)>2"]

By default, new symbols are created in (RefLink[$Context, paclet:ref/$Context]), but a custom context can be specified:

var=Interpreter[Restricted["HeldTeXExpression",Automatic,Automatic,Automatic]]["x"]
Context[x]

var=Interpreter[Restricted["HeldTeXExpression",Automatic,Automatic,"mycontext`"]]["y"]
Context[x]

Specify contexts for the allowed and output symbols:

Global`k = 10;
Interpreter[Restricted["HeldTeXExpression",Automatic,{"Global`","System`"},"Global`"]]["\\sin(k)"]

Prevent the creation of any new symbol:

Interpreter[Restricted["HeldTeXExpression",Automatic,Automatic,None]]["\\sin(0)>0"]

Interpreter[Restricted["HeldTeXExpression",Automatic,Automatic,None]]["\\sin(z)>0"]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[TeXForm, paclet:ref/TeXForm])  ▪  (RefLink[Interpreter, paclet:ref/Interpreter])  ▪  (RefLink[Restricted, paclet:ref/Restricted])  ▪  (RefLink[Failure, paclet:ref/Failure])  ▪  (RefLink[HoldComplete, paclet:ref/HoldComplete])}, {Related Interpreter Types:  (RefLink[TeXExpression, paclet:ref/interpreter/TeXExpression])  ▪  (RefLink[InactiveTeXExpression, paclet:ref/interpreter/InactiveTeXExpression])  ▪  (RefLink[MathMLExpression, paclet:ref/interpreter/MathMLExpression])  ▪  (RefLink[HeldMathMLExpression, paclet:ref/interpreter/HeldMathMLExpression])  ▪  (RefLink[InactiveMathMLExpression, paclet:ref/interpreter/InactiveMathMLExpression])}, {Related Formats:  (RefLink[LaTeX, paclet:ref/format/LaTeX])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Setting Up Input Interpreters, paclet:guide/InterpretingStrings])}})}})