Opened 8 years ago
Closed 2 weeks ago
#14256 closed enhancement (duplicate)
Nicer latex output for strings using \text
Reported by: | nthiery | Owned by: | was |
---|---|---|---|
Priority: | major | Milestone: | sage-duplicate/invalid/wontfix |
Component: | user interface | Keywords: | |
Cc: | Merged in: | ||
Authors: | Reviewers: | ||
Report Upstream: | N/A | Work issues: | Update doctests, cleanup |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description (last modified by )
The current latex output for simple strings is a bit overkill:
sage: latex("hello world") \verb|hello|\phantom{\verb!x!}\verb|world|
There is a rationale behind it: namely this allows for a nicer rendering of multi-line ascii art by emulating a fixed-width font. However, for a simple one line string, the following would be more readable:
sage: latex("hello world") \text{hello world}
The attached preliminary patch does this. However more work would need to be done, as this requires changing quite a few doctests. In fact some code seem to assume that the output use \verb
before stripping this away, so maybe some cleanup is in order there.
I for myself won't work any further on this patch; feel free to take over!
Attachments (1)
Change History (14)
Changed 8 years ago by
comment:1 Changed 8 years ago by
- Status changed from new to needs_review
comment:2 Changed 8 years ago by
- Status changed from needs_review to needs_work
comment:3 Changed 8 years ago by
- Work issues set to Update doctests, cleanup
comment:4 Changed 8 years ago by
comment:5 Changed 8 years ago by
With #14382:
sage: latex("hello world") \text{\tt hello{ }world}
Will this be better than verb? Middle { } are for dealing with multiple spaces, I guess we can avoid inserting them for a single space, but it will complicate the code...
comment:6 Changed 7 years ago by
- Milestone changed from sage-5.11 to sage-5.12
comment:7 Changed 7 years ago by
- Milestone changed from sage-6.1 to sage-6.2
comment:8 Changed 7 years ago by
- Milestone changed from sage-6.2 to sage-6.3
comment:9 Changed 6 years ago by
- Status changed from needs_work to needs_info
Nicolas - can we close this?
comment:10 Changed 6 years ago by
- Milestone changed from sage-6.3 to sage-6.4
comment:11 Changed 2 weeks ago by
- Description modified (diff)
- Milestone changed from sage-6.4 to sage-duplicate/invalid/wontfix
- Status changed from needs_info to needs_review
Suggest to close this as duplicate, as it has long been solved.
comment:12 Changed 2 weeks ago by
- Status changed from needs_review to positive_review
Yes, we can close this as a duplicate of #14382 (merged in 5.12.beta3).
comment:13 Changed 2 weeks ago by
- Resolution set to duplicate
- Status changed from positive_review to closed
Thanks for tracking down which ticket solved this and providing a link!
And what if several such strings will be output in sequence and fixed width font will somehow matter to them? Plus if something may be a single string or several, it means that the output format will change. I think that the best way for strings is uniform handling of all cases and verb seems like a sensible choice. If a particular application requires different treatment, it is better to insert appropriate latex code there.