Closed PhyX-Meow closed 3 years ago
Thanks Everyone!
I'm not set up with the Jupyter+Wolfram kernel to test this right now, but in Wolfram Language, one would typically solve line-wrapping problems like this by doing:
SetOptions["stdout",PageWidth->Infinity]
It certainly works to stop the WL language from imposing line-wrapping onto TeXForm
output on the command-line, and I suspect it'll work similarly in Jupyter, unless the WL plugin overrides your change (which it might in some circumstances).
You might be interested to know that you can also set the default FormatType
to TeXForm
by doing something similar:
SetOptions["stdout",FormatType->TeXForm]
But I don't think most people would appreciate this as a default. This would, for example, deeply break default graphics output.
@jfultz Thanks, it works, but in a strange way. I tried pagewidth infinity but nothing changed. Then I tried a small pagewidth and get more '>' in the expression Finally I tried a large pagewidth but not infinity (such as 200), and get the right output. It looks really strange, seems the infinity pagewidth is not processed correctly?
By the way, in shell, pagewidth->infinity does as expected.
Note that the Wolfram Language is case-sensitive.
So pagewidth->infinity
is meaningless. It should be PageWidth->Infinity
.
@arnoudbuzing Thanks, but I know it. I just use the lowercase in the comment for convenience, or I would not get the expected behavior when I set pagewidth 200. And here's the case PageWidth ->Infinity, just the same as default, in which PageWidth is 89.
@PhyX-Meow, sorry, this is a bug. WolframLanguageForJupyter
should not be inserting line breaks in text/html
results that contain TeX source, and WolframLanguageForJupyter
should not be rejecting Infinity
as a page width. #84 should resolve both of these issues.
With #84, line breaks in text/html
results that contain TeX source are now disallowed, and you should not have to run SetOptions["stdout", PageWidth -> Infinity]
for this purpose.
One more problem: ToExpression[" \\frac{1}{2} ", TeXForm]
does not work. According to the source of ipynb, it shows:
"source": [ "ToExpression[\" \\\\frac{1}{2} \", TeXForm]" ]
One more problem:
ToExpression[" \\frac{1}{2} ", TeXForm]
does not work. According to the source of ipynb, it shows:"source": [ "ToExpression[\" \\\\frac{1}{2} \", TeXForm]" ]
@glennhanks, this is a separate issue that the pull request #102 attempts to address.
A general request for comments on the pull request #84 (which addresses @PhyX-Meow's issue) and the pull request #102 (which should address @glennhanks' issue) is at #103.
Hello, I am using Jupyterlab, and I found that if use TeXForm[] for the cell output, it looks just great.
I guess it's because jupyter lab automatically renders the tex expressions.
However there's still some ploblem with this method. If the output expression is too long, something bad happens. Here's a short code in my homework:
f[z_] := (z + I)/(I*z + 1);x = Re@f@a; y = Im@f@a;xi = f@Exp[I theta]; FullSimplify[y / ((x - xi)^2 + y^2) * f'@Exp[I theta]]
it should output someting like this But actually it looks like this An unexpected '>' in the expression I turn to the source file of this notebook and found It seems the '>' occurs when the output wrap to a new line. I tried in my shell and get the same wrap.
My question is, is there any method to get the right result or simplily disable the line warpping