Opened 7 years ago

Closed 6 years ago

#17206 closed defect (fixed)

var and latex_name

Reported by: was Owned by:
Priority: minor Milestone: sage-6.4
Component: symbolics Keywords: beginner
Cc: Merged in:
Authors: Sergey Bykov Reviewers: Luran Li
Report Upstream: N/A Work issues:
Branch: 1998b8d (Commits, GitHub, GitLab) Commit: 1998b8d84ffec0cd9ad5f4876f8947109deacaef
Dependencies: Stopgaps:

Status badges

Description

This is an easy beginner ticket. This should work but doesn't

var1 = var('var1', latex_name=r'\sigma^2_1')  # braces shouldn't be needed, but are
show(e^(var1**2))

This does work

var1 = var('var1', latex_name=r'{\sigma^2_1}')  # braces shouldn't be needed, but are
show(e^(var1**2))

The fix is to wrap the input of latex_name in braces always. In SageMathCloud? I just made that fix already.

Change History (11)

comment:1 Changed 7 years ago by captaintrunky

  • Branch set to u/captaintrunky/var_and_latex_name

comment:2 Changed 7 years ago by captaintrunky

  • Authors set to Sergey Bykov
  • Commit set to e18094ab5b9ab65724d68df99352559e0f63eb83
  • Status changed from new to needs_review

New commits:

e18094aFixed Latex representation for user-provided variables

comment:3 Changed 7 years ago by was

I'd give this a positive review, assuming it pasts tests.

comment:4 Changed 6 years ago by luran

  • Status changed from needs_review to needs_work

The change breaks 2 doctests in sage.calculus.var.var. One doctest complains

File "src/sage/calculus/var.pyx", line 73, in sage.calculus.var.var
Failed example:
    x = var('sui', latex_name="s_{u,i}"); x._latex_()
Expected:
    's_{u,i}'
Got:
    '{s_{u,i}}'

and similarly does the other.

comment:5 Changed 6 years ago by luran

It also seems that the sage: prompt should be included in the test added for this ticket.

comment:6 Changed 6 years ago by git

  • Commit changed from e18094ab5b9ab65724d68df99352559e0f63eb83 to 1998b8d84ffec0cd9ad5f4876f8947109deacaef

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

1998b8dFixed tests in calculus module

comment:7 Changed 6 years ago by captaintrunky

  • Status changed from needs_work to needs_review

comment:8 Changed 6 years ago by luran

  • Status changed from needs_review to positive_review

Passed all tests. Looks good.

comment:9 Changed 6 years ago by vbraun

  • Status changed from positive_review to needs_work

Reviewer name is missing

comment:10 Changed 6 years ago by luran

  • Reviewers set to Luran Li
  • Status changed from needs_work to positive_review

Add the missing reviewer name.

comment:11 Changed 6 years ago by vbraun

  • Branch changed from u/captaintrunky/var_and_latex_name to 1998b8d84ffec0cd9ad5f4876f8947109deacaef
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.