Matthias Blaicher <blaicher <at> googlemail.com> writes:

> There is the sweave LaTeX command \Sexpr{ foo } which allows you to
> directly insert the content of foo into the document. Let's say there
> is a variable foo_bar then I can access foo_bar by inserting an ERT
> \Sexpr{foo_bar}. This works fine in text but NOT in math mode. It
> always wants to escape the underscore to \Sexpr{foo_{b}ar} .
> 
> So how can I insert true raw ERT commands in math mode or is this
> perhaps even not possible?

I don't know that there is any way to use an underscore as part of a variable
name and have it survive math mode.  Here's a workaround:

In ERT: \def\temp{\Sexpr{foo_bar}}
In math inset:  $blah blah \temp blah blah$

/Paul



Reply via email to