when doing in notebook
sage: show('x^2')
or
sage: show(type(factor))
I get error Unknown control sequence '\texttt'
When I try
sage:'x^2'
with checked "Typeset" button I get
\newcommand{\Bold}[1]{\mathbf{#1}}\hbox{x^2}
which is not valid LaTeX expression (supperscript outside math mode)
I think that this is a bug in Sage, Any idea where to fix it?
Thanks
Robert
John
2010/1/10 ma...@mendelu.cz <ma...@mendelu.cz>:
> --
> To post to this group, send an email to sage-...@googlegroups.com
> To unsubscribe from this group, send an email to sage-devel+...@googlegroups.com
> For more options, visit this group at http://groups.google.com/group/sage-devel
> URL: http://www.sagemath.org
>
>
Simple example (4.3.1):
show('$a = x^2$')
Unknown control sequence '\texttt'
> Any idea where to fix it?
Seconded.
On Jan 10, 2:44 pm, John Cremona <john.crem...@gmail.com> wrote:
> I had exactly the same thing happen (with sage-4.3.1.alpha1, firefox).
>
> John
>
> 2010/1/10 ma...@mendelu.cz <ma...@mendelu.cz>:
>
> > Dear sage-devel
>
> > when doing in notebook
>
> > sage: show('x^2')
>
> > or
>
> > sage: show(type(factor))
>
> > I get errorUnknowncontrolsequence'\texttt'
I think that the show command doesn't work very well with strings, and
this is a bug. The relevant files are sage/misc/functional.py (!) and
sage/misc/latex.py. Note that all of
sage: show(x^2)
sage: view('x^2')
sage: view('$x^2$')
work just fine, as does clicking the "typeset" button and executing
sage: x^2
Using the "typeset" button is better behaved than "show": with the
button checked,
sage: 'x^2'
sage: type(factor)
both work fine.
Maybe use "view" instead of "show"? I'm not sure why we have both
commands anyway. I think "show" should be fixed so it just uses "view"
in this situation.
--
John
On 25 led, 21:40, John H Palmieri <jhpalmier...@gmail.com> wrote:
> sage: 'x^2'
> sage: type(factor)
>
> both work fine.
A similar problem:
sage:'x_2' (with checked Typeset button)
and
sage: view('x_2')
produce unwanted backslash (but the TeX code "\hbox{x\_2}" is O.K. and
jsmath should not include the backslash)
Robert
Try the patch at <http://trac.sagemath.org/sage_trac/ticket/8084>.
The underscore issue is still present to some degree, mainly because
'x_2' is not valid LaTeX (as opposed to '$x_2$'). I think it looks
okay in the notebook now, but view('x_2') looks bad from the command
line. But this is to be expected, I think: from the command line,
"view" creates a file containing the string and runs LaTeX on it, so
if you pass it bad LaTeX, it will produce bad output.
Things to test before and after the patch, from the command-line and
from the notebook:
sage: view(type(factor))
sage: view(type(Sq(3))) # to make sure types with underscores in
their name look okay
sage: view('x^2') # invalid LaTeX, looks bad from the command line
sage: view('$x^2$')
sage: view('x_2') # invalide LaTeX
sage: view('$x_2$')
and the same things with "show" instead of "view". Also, probably the
same kinds of things but just evaluating the strings with the Typeset
button checked. What else should be tested?
--
John
A good solution until text and graphics are mixed, then it fails (by
requiring what 'show' has to offer). As I said elsewhere, this problem
is worse in 4.3.1 than it was in 4.2.
Give some examples, please. By the way, have you tried the patch I
mentioned in my other message today?
--
John
var("y R")
a(y,R) = pi * (2*R - y) * y
lbl = text("$\int \ " + latex(a(y,R)) + "$",(3,20))
view(lbl)
... Graphics object consisting of 1 graphics primitive (not
displayed)
show(lbl)
... Unknown control sequence '\texttt'
No graphics shown.
> By the way, have you tried the patch I mentioned in my other message today?
I initially dealt with Sage problems that way, but the patches keep
changing with each new version while the problem remains unsolved. I
eventually concluded it was simpler not to upgrade. The present
problem is less severe in earlier versions.
When I evaluate "lbl", I don't get a picture; something is broken in
the "text" command. Because there is no picture, "show" defaults to
trying to print a text description, leading to this message. The
patch fixes it so the text description prints correctly. I don't know
why "text" is broken, but I bet someone can help.
By the way, if I run
var("y R")
a(y,R) = pi * (2*R - y) * y
lbl = text("$\int \ " + r"{\left(2 R - y\right)} \pi y" + "$",
(3,20))
then executing "lbl" or "show(lbl)" produce a picture. If I change
the last line to
lbl = text("$\int \ " + r"{\left(2 \, R - y\right)} \pi y" + "$",
(3,20)) # insert \, between 2 and R
I get an error.
> No graphics shown.
>
> > By the way, have you tried the patch I mentioned in my other message today?
>
> I initially dealt with Sage problems that way, but the patches keep
> changing with each new version while the problem remains unsolved. I
> eventually concluded it was simpler not to upgrade. The present
> problem is less severe in earlier versions.
Then why do you bother posting things that look like requests for
help?
--
John
On Jan 29, 2:09 am, lutusp <lut...@gmail.com> wrote:
> > Give some examples, please.
>
> var("y R")
>
> a(y,R) = pi * (2*R - y) * y
>
> lbl = text("$\int \ " + latex(a(y,R)) + "$",(3,20))
>
> view(lbl)
> ... Graphics object consisting of 1 graphics primitive (not
> displayed)
> show(lbl)
> ... Unknown control sequence '\texttt'
>
> No graphics shown.
This is a bug with matplotlib. For Sage, it's being tracked on this
ticket:
<http://trac.sagemath.org/sage_trac/ticket/8125>
Meanwhile, you could try:
sage: s = latex(a(y,R)).replace('\\,', '') # remove \,
sage: lbl = text(r"$\int \ " + s + "$", (3, 20))
sage: show(lbl)
--
John
In the hope that someone will fix the source, rather than offer new
patches? It's not as though it hasn't been reported yet, or discussed
yet, and several new releases have gone by without resolution.
Meanwhile I'll get around the problem any way I can. The reason? Sage
is terrific.
This is contradictory: the way the source gets fixed is that people
post patches, and then other people test them and review them.
--
John