pprint a Symbol as merged greek letters (ie variation of theta)

415 views
Skip to first unread message

Scott

unread,
Nov 25, 2008, 9:44:28 AM11/25/08
to sympy, sas...@afit.edu
How can i create one symbol such that the pprint and/or latex output
will be merged special characters?

What is the X such that:

x= symbol('X')
pprint(x) produce standard output equivilent that looks like$ \delta
\theta_1 $ in tex

aka the variation of theta subscript 1

Thanks

Scott

Ondrej Certik

unread,
Nov 25, 2008, 12:29:16 PM11/25/08
to sy...@googlegroups.com, sas...@afit.edu

Do you mean this:

In [3]: Symbol("delta_1")
Out[3]: δ₁


Or do you want to get something else?

Ondrej

Scott

unread,
Nov 25, 2008, 3:34:31 PM11/25/08
to sympy
I meant deltatheta_1

or like \delta\theta_1 in latex
and also omega_theta , omege subscript theta .

Thanks

Scott

On Nov 25, 12:29 pm, "Ondrej Certik" <ond...@certik.cz> wrote:

Ondrej Certik

unread,
Nov 25, 2008, 6:17:22 PM11/25/08
to sy...@googlegroups.com
2008/11/25 Scott <scott...@yahoo.com>:

>
> I meant deltatheta_1
>
> or like \delta\theta_1 in latex

I see. Is it just one Symbol? If so, then sympy currently cannot do
that, but it can certainly be implemented quite easily by providing a
custom Printer.

> and also omega_theta , omege subscript theta .

Do you know the UTF-8 code form _theta (subscript) ? If so, then it
can be implemented. The problem is that unicode is not well suited for
subscripts and superscripts -- one should be using other means to
achieve that, e.g. escape sequences in terminals and patching all
major terminals to support sub/superscripts.

Ondra

Alan Bromborsky

unread,
Nov 25, 2008, 6:54:10 PM11/25/08
to sy...@googlegroups.com
My extended latex printer does it, but I am not done documenting it
yet. If you would like to try it out let me know.

Scott

unread,
Nov 25, 2008, 8:07:58 PM11/25/08
to sympy
I did not realize that the subscript characters come from a pool than
the primary characters.

pprint uses a limited subset of unicode and subscripts available in
utf-8 format are limited compared to the tex markup language.
My solution will be to choose from the list of available subscripts.
http://en.wikipedia.org/wiki/Phonetic_Extensions perhaps.

As for merging 2 greek symbols in the absence of an LaTeX type
wizardry, I will do without. I will look at the pprint cod to try to
glean the mark characters sucha as _ .

Thanks

Scott


On Nov 25, 6:17 pm, "Ondrej Certik" <ond...@certik.cz> wrote:
> 2008/11/25 Scott <scotta_2...@yahoo.com>:

Scott

unread,
Nov 25, 2008, 8:11:15 PM11/25/08
to sympy
I'll give your extended latex printer a go. My goal is in the theme
of making pprint prettier and being able to have my script output
match the conventions of the people I work with.

Thanks

On Nov 25, 6:54 pm, Alan Bromborsky <abro...@verizon.net> wrote:
> Ondrej Certik wrote:
> > 2008/11/25 Scott <scotta_2...@yahoo.com>:

Ondrej Certik

unread,
Nov 26, 2008, 3:58:19 AM11/26/08
to sy...@googlegroups.com
On Wed, Nov 26, 2008 at 2:11 AM, Scott <scott...@yahoo.com> wrote:
>
> I'll give your extended latex printer a go. My goal is in the theme
> of making pprint prettier and being able to have my script output
> match the conventions of the people I work with.

Yes, exactly. Please send us the code of your Printer, we'll see how
it can be integrated. I think we can have a lot of different Printers
in sympy.

Ondrej

Reply all
Reply to author
Forward
0 new messages