Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

latex printing with piecewise function : reversed expr and cond #5200

Closed
sympy-issue-migrator opened this issue Nov 13, 2010 · 6 comments
Closed

Comments

@sympy-issue-migrator
Copy link

>>x=Symbol('x')
>>p = Piecewise((x,x<0),(0,x>=0))
>>latex(p)

'\\begin{cases} x & \\text{for}\\: x < 0 \\\\0 \\leq x & \\text{for}\\: 0 \\end{cases}'

second expr and cond are reversed.

with the attached patch to sympy/printing/latex.py :

'\\begin{cases} x & \\text{for}\\: x < 0 \\\\0 & \\text{for}\\: 0 \\leq x \\end{cases}'

Original issue for #5200: http://code.google.com/p/sympy/issues/detail?id=2101
Original author: https://code.google.com/u/104102615266264925881/
Original owner: https://code.google.com/u/102137482174297837682/

@asmeurer
Copy link
Member

If I try compiling \\begin{cases} x & \\text{for}\\: x < 0 \\\\0 & \\text{for}\\: 0 \\leq x \\end{cases}, I get "Misaligned alignment tab character &".  

Also, can you add a test?

**Status:** Accepted  
**Labels:** NeedsBetterPatch Maurice.Bremond Printing  

Original comment: http://code.google.com/p/sympy/issues/detail?id=2101#c1
Original author: https://code.google.com/u/asmeurer@gmail.com/

@sympy-issue-migrator
Copy link
Author

>If I try compiling \\begin{cases} x & \\text{for}\\: x < 0 \\\\0 &
>\\text{for}\\: 0 \\leq x \\end{cases}, I get "Misaligned alignment tab character &".

I do not have this (My laptop is ubuntu 10.4 with std latex packages).

Here is what I do : 

from sympy import *
import sympy.galgebra.latex_ex as tex

tex.Format()
print "\\begin{cases} x & \\text{for}\\: x < 0 \\\\0 & \\text{for}\\: 0 \\leq x \\end{cases}" 
tex.xdvi(filename='Piecewise.tex')

>Also, can you add a test?
Yes I will do that

Maurice

Original comment: http://code.google.com/p/sympy/issues/detail?id=2101#c2
Original author: https://code.google.com/u/104102615266264925881/

@flacjacket
Copy link
Member

See https://github.com/sympy/sympy/pull/1009 Aaron, what was posted here should have been right, I think you need to include the amsmath package.

Original comment: http://code.google.com/p/sympy/issues/detail?id=2101#c3
Original author: https://code.google.com/u/113046012287564521760/

@asmeurer
Copy link
Member

Right.  I may have actually forgotten to convert the \\ into \.

Original comment: http://code.google.com/p/sympy/issues/detail?id=2101#c4
Original author: https://code.google.com/u/asmeurer@gmail.com/

@asmeurer
Copy link
Member

**Status:** Valid  

Original comment: http://code.google.com/p/sympy/issues/detail?id=2101#c5
Original author: https://code.google.com/u/asmeurer@gmail.com/

@ness01
Copy link
Contributor

ness01 commented Apr 2, 2012

Fixed: https://github.com/sympy/sympy/pull/1174

**Status:** Fixed  

Original comment: http://code.google.com/p/sympy/issues/detail?id=2101#c6
Original author: https://code.google.com/u/104531927090589914088/

@jrioux
Copy link
Member

jrioux commented Aug 13, 2012

**Owner:** julien.r...@gmail.com  
**Labels:** -NeedsBetterPatch  

Original comment: http://code.google.com/p/sympy/issues/detail?id=2101#c7
Original author: https://code.google.com/u/102137482174297837682/

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants