[sage-devel] Re: Can LaTeX of strings be improved?

2010-05-25 Thread John H Palmieri
On May 24, 9:11 pm, ablondin alexandre.blondin.ma...@gmail.com wrote: You're right ! It doesn't work with the view() function. On the other hand, when I select latex instead of sage and I enter the command \sage{A()} it displays 123 on the first line and 23 on the second line, with the 2's

Re: [sage-devel] Re: Can LaTeX of strings be improved?

2010-05-25 Thread ross kyprianou
I couldnt see a solution to this in this thread so heres a related question The following produces the exact output Id like to produce (to assign to the _repr_ property of a class) %latex N(\mu,\sigma^2) How can I set things up to do this in a (_repr_) function (as a sage statement/function

[sage-devel] Re: Can LaTeX of strings be improved?

2010-05-24 Thread ablondin
What about using the verbatim environment of Latex ? class A(SageObject): def _latex_(self): from sage.misc.latex import LatexExpr return '\\begin{verbatim}\n123\n 23\n\\end{verbatim}' sage: attach latex.sage sage: latex(A()) \begin{verbatim} 123 23 \end{verbatim} In the

[sage-devel] Re: Can LaTeX of strings be improved?

2010-05-24 Thread John H Palmieri
On May 24, 2:17 pm, ablondin alexandre.blondin.ma...@gmail.com wrote: What about using the verbatim environment of Latex ? class A(SageObject):     def _latex_(self):         from sage.misc.latex import LatexExpr         return '\\begin{verbatim}\n123\n 23\n\\end{verbatim}' sage: attach

[sage-devel] Re: Can LaTeX of strings be improved?

2010-05-24 Thread ablondin
You're right ! It doesn't work with the view() function. On the other hand, when I select latex instead of sage and I enter the command \sage{A()} it displays 123 on the first line and 23 on the second line, with the 2's aligned properly, i.e. it handles the newlines and indentation as desired.

[sage-devel] Re: Can LaTeX of strings be improved?

2010-05-23 Thread Rob Beezer
On May 22, 10:22 pm, John H Palmieri jhpalmier...@gmail.com wrote: On May 22, 9:57 pm, Rob Beezer goo...@beezer.cotse.net wrote: So as Robert suggests, it might be easy to just modify str_function()  to replace \n by \newline and get what I think That doesn't seem to work for me. Based on

[sage-devel] Re: Can LaTeX of strings be improved?

2010-05-23 Thread Nathan O'Treally
On 23 Mai, 08:15, Rob Beezer goo...@beezer.cotse.net wrote: Based on some limited testing - just editing the text version of a worksheet - would indicate that jsMath does not want to deal with \newline or \\ to break lines.  With no better idea, I was able to use HTML paragraph tags to get two

[sage-devel] Re: Can LaTeX of strings be improved?

2010-05-22 Thread Andrey Novoseltsev
Hi Minh, I probably was not very clear. I know how to change printed and typeset version of a particular object that I create. What I don't like is how just plain strings are typeset: if I put 123\n 23 in a notebook cell in typeset mode and hit Shift-Enter, I will see 123 23 in a pretty font, but

[sage-devel] Re: Can LaTeX of strings be improved?

2010-05-22 Thread Andrey Novoseltsev
On May 22, 10:17 pm, Robert Bradshaw rober...@math.washington.edu wrote: Though in Sage we use _repr_, which is used by __str__, __repr__ and   _latex_. I think this is a question about the default _latex_ which   does some postprocessing of _repr_. sage: class A(SageObject): :     def

[sage-devel] Re: Can LaTeX of strings be improved?

2010-05-22 Thread Rob Beezer
1. In the notebook (or at the command line) latex('thing-one\nthing-two') produces \texttt{thing-one thing-two} which would be useful if a string is encountered in tex's math-mode ($..$). But the newline would not be recognized as such by tex. 2. In the notebook,

[sage-devel] Re: Can LaTeX of strings be improved?

2010-05-22 Thread John H Palmieri
On May 22, 9:57 pm, Rob Beezer goo...@beezer.cotse.net wrote: So as Robert suggests, it might be easy to just modify str_function()  to replace \n by \newline and get what I think That doesn't seem to work for me. Andrey is after.  All this is processing is contained in sag/misc/ latex.py.