#6954 closed enhancement (fixed)
[with patch, positive review] latex output for dictionaries
Reported by: | Wilfried Huss | Owned by: | William Stein |
---|---|---|---|
Priority: | major | Milestone: | sage-4.1.2 |
Component: | user interface | Keywords: | latex |
Cc: | Merged in: | Sage 4.1.2.alpha4 | |
Authors: | Wilfried Huss | Reviewers: | John Palmieri, Mike Hansen |
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description
The attached patch implements latex output for dictionaries:
sage: var('x,y') sage: latex({x: y^2, y: 1/2}) \left\{y\rightarrow \frac{1}{2}, x\rightarrow y^{2}\right\}
Attachments (2)
Change History (10)
comment:1 follow-up: 2 Changed 13 years ago by
Summary: | [with patch, needs review] latex output for dictionaries → [with patch, needs work] latex output for dictionaries |
---|
comment:2 Changed 13 years ago by
Replying to jhpalmieri:
Second, I think I would prefer a colon rather than an arrow: I think the typeset version should mimic the string representation, just as we do for lists and tuples. (I don't feel that strongly about this.)
I agree; we should have a colon, since there isn't a completely standard latex notation for dictionaries, and a colon will be less likely to confuse the user who is used to seeing it as text.
comment:3 Changed 13 years ago by
If we insist on having an arrow, it seems to make more sense to do a \mapsto arrow, or a knuth-style \leftarrow.
Changed 13 years ago by
Attachment: | trac_6954-latex_dict.patch added |
---|
comment:4 Changed 13 years ago by
Summary: | [with patch, needs work] latex output for dictionaries → [with patch, needs review] latex output for dictionaries |
---|
I changed the patch to use a colon, and added a seperate doctest for 64bit. Unfortunately I don't have access to a machine with OS X, so I cannot test this myself.
comment:5 Changed 13 years ago by
I like the colon better; thanks. I'm having problems with the same doctest, though, and I don't think it's a 32/64-bit issue; I get one answer with a 32-bit build on a mac, a different answer with a 64-bit build on a mac, and still a different answer on sage.math. So maybe the doctest should be modified so order doesn't matter, say a dictionary with a single entry like
sage: d = {(1,2,3): [y/2, sin(z^2)]} sage: latex(d) ...
I'm attaching a patch which makes this change. I'll give the main patch (trac_6954-latex_dict.patch) a positive review, and if my change is okay, the whole ticket should get a positive review.
comment:6 Changed 13 years ago by
Authors: | whuss → Wilfried Huss |
---|---|
Reviewers: | → John Palmieri, Mike Hansen |
Summary: | [with patch, needs review] latex output for dictionaries → [with patch, positive review] latex output for dictionaries |
Looks good to me. Apply both patches.
comment:7 Changed 13 years ago by
Merged in: | → Sage 4.1.2.alpha3 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Merged both patches.
comment:8 Changed 13 years ago by
Merged in: | Sage 4.1.2.alpha3 → Sage 4.1.2.alpha4 |
---|
There is no 4.1.2.alpha3. Sage 4.1.2.alpha3 was William Stein's release for working on making the notebook a standalone package.
Two comments: first, this doesn't pass doctests, due to ordering issues in dictionaries:
This is on a Mac, OS X 10.5, 32-bit. Doctests pass on 64-bit OS X. Maybe there should be different doctests depending on 32-bit vs. 64-bit, as in the
__hash__
method insage/rings/padics/padic_capped_relative_element.pyx
. (Or maybe it's not a 32/64-bit issue; maybe the doctest should just be modified so order doesn't matter.)Second, I think I would prefer a colon rather than an arrow: I think the typeset version should mimic the string representation, just as we do for lists and tuples. (I don't feel that strongly about this.)