Opened 6 months ago

Closed 5 months ago

#31880 closed enhancement (fixed)

RealSet, InternalRealInterval: Improve _repr_ and add _latex_ method

Reported by: mkoeppe Owned by:
Priority: major Milestone: sage-9.4
Component: manifolds Keywords:
Cc: yzh, gh-mjungmath, tscrim, chapoton Merged in:
Authors: Matthias Koeppe Reviewers: Travis Scrimshaw
Report Upstream: N/A Work issues:
Branch: 011f59a (Commits, GitHub, GitLab) Commit: 011f59a15f0d7f59e92c91655a8855aafa3c2b97
Dependencies: Stopgaps:

Status badges

Description (last modified by mkoeppe)

We implement this TODO item in RealSet._repr_:

# Switch to u'\u222A' (cup sign) with Python 3

We also add _latex_ methods to RealSet and InternalRealInterval, upstreaming and extending the change in https://github.com/mkoeppe/cutgeneratingfunctionology/commit/4c7fb7df9a92cdb2435028c7eb19d186ab4b58ee#diff-b4cd72590a22494dab392e336268a3c94ea5b0adeb6b5864bda0e2ad87c65323

Change History (17)

comment:1 Changed 6 months ago by mkoeppe

  • Branch set to u/mkoeppe/realset__internalrealinterval__add__latex__method

comment:2 Changed 6 months ago by git

  • Commit set to dbdfc068f2d2ac39ae8171ea8737b2b1a535e021

Branch pushed to git repo; I updated commit sha1. New commits:

69ca854RealSet._repr_: Use unicode cup sign instead of +
dbdfc06InternalRealInterval, RealSet: Remove extra whitespace in latex, add documentation

comment:3 Changed 6 months ago by mkoeppe

  • Description modified (diff)
  • Summary changed from RealSet, InternalRealInterval: Add _latex_ method to RealSet, InternalRealInterval: Improve _repr_ and add _latex_ method

comment:4 Changed 6 months ago by mkoeppe

  • Authors set to Matthias Koeppe
  • Status changed from new to needs_review

comment:5 Changed 6 months ago by tscrim

  • Reviewers set to Travis Scrimshaw

Trivial failures due to change in output:

sage -t --long --random-seed=0 src/sage/functions/piecewise.py  # 4 doctests failed

Once fixed, you can set it to a positive review.

comment:6 Changed 6 months ago by git

  • Commit changed from dbdfc068f2d2ac39ae8171ea8737b2b1a535e021 to 7f563381617c2b016a8b849f83d3387ccc25d621

Branch pushed to git repo; I updated commit sha1. New commits:

7f56338PiecewiseFunction: Adjust doctests for changed RealSet repr

comment:7 Changed 6 months ago by mkoeppe

  • Status changed from needs_review to positive_review

Thanks!

comment:8 Changed 6 months ago by git

  • Commit changed from 7f563381617c2b016a8b849f83d3387ccc25d621 to 8abdc8b16f9762041c1c60bcb4672fefea12f4b4
  • Status changed from positive_review to needs_review

Branch pushed to git repo; I updated commit sha1 and set ticket back to needs_review. New commits:

8abdc8bsrc/sage/functions/piecewise.py: Add coding header

comment:9 Changed 6 months ago by mkoeppe

  • Status changed from needs_review to positive_review

Added the header as requested in https://trac.sagemath.org/ticket/31927#comment:8

comment:10 Changed 6 months ago by vbraun

  • Status changed from positive_review to needs_work
[docpdf] ! Package inputenc Error: Unicode character ∪ (U+222A)
[docpdf] (inputenc)                not set up for use with LaTeX.
[docpdf] 
[docpdf] See the inputenc package documentation for explanation.
[docpdf] Type  H <return>  for immediate help.
[docpdf]  ...                                              
[docpdf]                                                   
[docpdf] l.3311 ...YGZhy{}oo, \PYGZhy{}1] ∪ [1, +oo); x)}
[docpdf]                                                   
[docpdf] ? 
[docpdf] ! Emergency stop.
[docpdf]  ...                                              
[docpdf]                                                   
[docpdf] l.3311 ...YGZhy{}oo, \PYGZhy{}1] ∪ [1, +oo); x)}
[docpdf]                                                   
[docpdf] !  ==> Fatal error occurred, no output PDF file produced!

comment:11 follow-up: Changed 6 months ago by vbraun

For the record: Python 8 defaults to UTF-8 source coding, so the #coding header is just cargo cult from when Python2 defaulted to the (in hindsight) wrong encoding. Nowadays the # coding header is superfluous. Pep8 says:

Files using ASCII (in Python 2) or UTF-8 (in Python 3) should not have an encoding declaration.

comment:12 in reply to: ↑ 11 Changed 6 months ago by mkoeppe

  • Cc chapoton added

Replying to vbraun:

For the record: Python 8 defaults to UTF-8 source coding, so the #coding header is just cargo cult from when Python2 defaulted to the (in hindsight) wrong encoding. Nowadays the # coding header is superfluous. Pep8 says:

Files using ASCII (in Python 2) or UTF-8 (in Python 3) should not have an encoding declaration.

Thanks. I have removed the non_ascii patchbot plugin in https://github.com/sagemath/sage-patchbot/commit/af55241865faf2a7f89a2b6cc40caa5ce483ff67

comment:13 Changed 6 months ago by git

  • Commit changed from 8abdc8b16f9762041c1c60bcb4672fefea12f4b4 to 011f59a15f0d7f59e92c91655a8855aafa3c2b97

Branch pushed to git repo; I updated commit sha1. New commits:

011f59asrc/sage/docs/conf.py: Add more \DeclareUnicodeCharacter

comment:14 Changed 6 months ago by mkoeppe

  • Status changed from needs_work to needs_review

comment:15 Changed 6 months ago by tscrim

  • Status changed from needs_review to positive_review

comment:16 Changed 6 months ago by mkoeppe

Thanks!

comment:17 Changed 5 months ago by vbraun

  • Branch changed from u/mkoeppe/realset__internalrealinterval__add__latex__method to 011f59a15f0d7f59e92c91655a8855aafa3c2b97
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.