#11775: Make pretty_print take multiple arguments
--------------------------------------+-------------------------------------
Reporter: ppurka | Owner: jason
Type: enhancement | Status: needs_review
Priority: major | Milestone: sage-5.0
Component: misc | Resolution:
Keywords: pretty print | Work_issues:
Upstream: N/A | Reviewer: Keshav Kini
Author: Punarbasu Purkayastha | Merged:
Dependencies: |
--------------------------------------+-------------------------------------
Old description:
> The pretty_print function currently takes only one argument. This somehow
> makes it difficult to print multiple things in one line, for instance the
> following is currently not possible:
> {{{
> A = identity_matrix(2); pretty_print("A = ", A)
> }}}
> with the output being "A = <the matrix A on the same line>"
>
> I am attaching a patch which allows pretty_print to take in multiple
> arguments. It is based on some code by _leif @ #sagemath (See
> http://sagenb.org/home/pub/3111/ ). Also kini @ #sagemath helped in
> passing the doctests.
>
> The modifications are to 1) the function pretty_print 2) the doctests in
> pretty_print 3) the doctest in pretty_print_default (whitespace issues)
>
> -----
>
> Apply only [attachment:trac_11775-pretty_print_multiple_args.4.patch] to
> `SAGE_ROOT/devel/sage`.
New description:
The pretty_print function currently takes only one argument. This somehow
makes it difficult to print multiple things in one line, for instance the
following is currently not possible:
{{{
A = identity_matrix(2); pretty_print("A = ", A)
}}}
with the output being "A = <the matrix A on the same line>"
I am attaching a patch which allows pretty_print to take in multiple
arguments. It is based on some code by _leif @ #sagemath (See
http://sagenb.org/home/pub/3111/ ). Also kini @ #sagemath helped in
passing the doctests.
The modifications are to 1) the function pretty_print 2) the doctests in
pretty_print 3) the doctest in pretty_print_default (whitespace issues)
-----
Either
1. Apply only [attachment:trac_11775-pretty_print_multiple_args.4.patch]
to `SAGE_ROOT/devel/sage` for `jsmath`-based sage{nb}.
2. Apply only
[attachment:trac_11775-pretty_print_multiple_args_mathjax.patch] to
`SAGE_ROOT/devel/sage` for `mathjax`-based sage{nb}.
--
Comment(by ppurka):
Updated patch to mathjax based sagenb. Apply
[attachment:trac_11775-pretty_print_multiple_args_mathjax.patch new patch]
only after applying patches from #9774.
Otherwise the old patch should apply just fine.
It passes doctests in `sage/misc` except for the
[http://trac.sagemath.org/sage_trac/ticket/9774#comment:64 two (unrelated)
failures] stemming from the mathjax patch in #9774 and also these
(unrelated) ones:
{{{
sage -t "devel/sage-main-backup/sage/misc/latex_macros.py"
**********************************************************************
File "/home/punarbasu/Installations/sage-5.0.beta2/devel/sage-main-
backup/sage/misc/latex_macros.py", line 121:
sage: convert_latex_macro_to_mathjax('\\newcommand{\\ZZ}{\\Bold{Z}}')
Expected:
'ZZ: "\\Bold{Z}"'
Got:
'ZZ: "\\\\Bold{Z}"'
**********************************************************************
File "/home/punarbasu/Installations/sage-5.0.beta2/devel/sage-main-
backup/sage/misc/latex_macros.py", line 123:
sage:
convert_latex_macro_to_mathjax('\\newcommand{\\GF}[1]{\\Bold{F}_{#1}}')
Expected:
'GF: ["\\Bold{F}_{#1}",1]'
Got:
'GF: ["\\\\Bold{F}_{#1}",1]'
**********************************************************************
1 items had failures:
2 of 6 in __main__.example_2
***Test Failed*** 2 failures.
For whitespace errors, see the file
/home/punarbasu/.sage//tmp/latex_macros_8554.py
sage -t "devel/sage-main-backup/sage/misc/hg.py"
changeset: 16520:7c0237f6509d
tag: qtip
tag: tip
tag: trac_11775-pretty_print_multiple_args_mathjax.patch
user: Punarbasu Purkayastha <[email protected]>
date: Sun Feb 26 00:58:06 2012 +0800
summary: make pretty_print accept multiple arguments
trac_11078.patch
trac-11503-jmol-commandline.patch
trac-12229-sagenb-developer-doc.2.patch
trac-12229-manifest.patch
trac-11080-notebook-docs.patch
trac_9774-mathjax-try4.patch
trac_11775-pretty_print_multiple_args_mathjax.patch
trac_11078.patch
trac-11503-jmol-commandline.patch
trac-12229-sagenb-developer-doc.2.patch
trac-12229-manifest.patch
trac-11080-notebook-docs.patch
trac_9774-mathjax-try4.patch
trac_11775-pretty_print_multiple_args_mathjax.patch
**********************************************************************
File "/home/punarbasu/Installations/sage-5.0.beta2/devel/sage-main-
backup/sage/misc/hg.py", line 262:
sage: 'main' in hg_sage.list_branches(print_flag=False)
Expected:
True
Got:
False
**********************************************************************
1 items had failures:
1 of 5 in __main__.example_8
***Test Failed*** 1 failures.
For whitespace errors, see the file /home/punarbasu/.sage//tmp/hg_9014.py
[3.5 s]
}}}
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11775#comment:35>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.