Sage: Ticket #5711: [with patch, positive review] Enhanced Typesetting of Symbolic Functions
https://trac.sagemath.org/ticket/5711
<p>
Here is a patch that enhances current typesetting capability
of symbolic functions within sage.
</p>
<p>
This issue has been under a long discussion in the thread
</p>
<p>
<a class="ext-link" href="http://groups.google.com/group/sage-devel/browse_thread/thread/a51f269f057d8223/536b4ef2493bb20c"><span class="icon"></span>http://groups.google.com/group/sage-devel/browse_thread/thread/a51f269f057d8223/536b4ef2493bb20c</a>
</p>
<p>
<strong>Note: Switch to new symbolics has caused some functions to be changed</strong>
</p>
<p>
Main enhancements are:
</p>
<p>
(1) Symbolics functions with name in Greek letters (with possible
suffixes), are typeset nicely in LaTeX.
</p>
<p>
Ex: psi(x) => \psi(x)
</p>
<blockquote>
<p>
f0(x) => f_0(x)
</p>
</blockquote>
<p>
(2) Functions such as "diff", "integrate", "limit", "conjugate",
"laplace", "inverse_laplace" are now typeset within Sage itself.
</p>
<p>
Ex: integrate(f(x),x) => \int f(x) dx
</p>
<p>
(3) Default (fall-back) typesetting for unknown functions (as
in Maxima).
</p>
<p>
Ex: myfn(x) => {\it myfn}(x)
</p>
<p>
(4) <strong>[ This is diasbled in new symbolics. However, equivalent feature will be available in new symbolics ]</strong>
Allows users to define their own/custom LaTeX expression
for any symbolic functions via a new method "set_latex()" for
the class <a class="missing wiki">SymbolicFunctionEvaluation?</a>.
</p>
<p>
Ex:
</p>
<pre class="wiki">var('t');
hubble(t) = function('hubble',t)
hubble(t).set_latex('\\mathcal{H}')
#To reset custom LaTeX expression
hubble(t).set_latex()
</pre><p>
(5) <strong>[ This has been disabled in new Symbolics as <a class="missing wiki">SymbolicVariable?</a> class has changed ]</strong>
If the arguments of a symbolic function are all symbolic
variables then typesetting will avoid using \left(, \right).
</p>
<p>
Ex: Phi(x,y) => \Phi(x, y) (if x,y are symbolic vars)
</p>
<p>
(6) <strong>[New in the rebased patch]</strong> New symbolics uses "D"
format for derivatives instead of old "diff" format.
The rebased patch typesets symbolic derivatives in old "diff" format by default as in this format typeset version looks similar to those found in text books, journals.
</p>
<p>
However see this thread for known limitations of current conversion between these two formats
</p>
<blockquote>
<p>
<a class="ext-link" href="http://groups.google.com/group/sage-devel/browse_thread/thread/7479c3eeb96348a2"><span class="icon"></span>http://groups.google.com/group/sage-devel/browse_thread/thread/7479c3eeb96348a2</a>
</p>
</blockquote>
<p>
One can switch between two typesetting format as follows
</p>
<pre class="wiki">f(x) = function('f',x)
g = diff(f(x),x)
latex(g)
\frac{d f\left(x\right)}{d x}
# Switch to D format
sage.symbolic.pynac.typeset_d_as_diff=False
latex(g)
D[0]f\left(x\right)
</pre><p>
(7) <strong>[New in the rebased patch]</strong> The rebased patch resolves
the issue
</p>
<p>
<a class="ext-link" href="http://trac.sagemath.org/sage_trac/ticket/6268"><span class="icon"></span>http://trac.sagemath.org/sage_trac/ticket/6268</a>
</p>
<p>
<strong>[Update: in v3 (4.0.2) ]</strong>
</p>
<p>
As suggested by Burcin in his referee report, following changes are made in the patch:
</p>
<p>
<strong>(1)</strong> Typesetting of "diff" is moved to a new ticket <a class="closed ticket" href="https://trac.sagemath.org/ticket/6344" title="enhancement: Typesetting partial derivatives in new symbolics (closed: wontfix)">#6344</a>
</p>
<p>
<strong>(2)</strong> Four helper functions _limit_latex_(), _integrate_latex_(), _laplace_latex_() and _inverse_laplace_latex_() have been moved to calculus/calculus.py. Then they are hooked to the instances of SFunction class by using dummy functions for better integration with the new symbolics.
</p>
<p>
<strong>(3)</strong> Four earlier functions latex_symbolic_function(), _symbolic_function_default_latex_(), _args_latex_(), _conjugate_latex() are removed.
</p>
<p>
<strong>(4)</strong> latex_function_name() is also replaced as the updated latex_variable_name() is augmented to take a new flag "is_fname". This will ensure that same typesetting convention is followed for both known functions such as \sin (:= {\rm sin}), \cos (:= {\rm cos}) and user defined function names such as "mysin" (=> {\rm mysin}).
</p>
en-usSagehttps://trac.sagemath.org/chrome/site/logo_sagemath_trac.png
https://trac.sagemath.org/ticket/5711
Trac 1.1.6gmhossainWed, 08 Apr 2009 11:55:50 GMTattachment set
https://trac.sagemath.org/ticket/5711
https://trac.sagemath.org/ticket/5711
<ul>
<li><strong>attachment</strong>
set to <em>enhanced-typesetting-of-symbolic-functions.patch</em>
</li>
</ul>
TicketburcinWed, 08 Apr 2009 13:51:54 GMTcc set
https://trac.sagemath.org/ticket/5711#comment:1
https://trac.sagemath.org/ticket/5711#comment:1
<ul>
<li><strong>cc</strong>
<em>burcin</em> added
</li>
</ul>
TicketjasonSat, 30 May 2009 05:02:30 GMTcc changed
https://trac.sagemath.org/ticket/5711#comment:2
https://trac.sagemath.org/ticket/5711#comment:2
<ul>
<li><strong>cc</strong>
<em>jason</em> added
</li>
</ul>
TicketjasonSat, 30 May 2009 05:40:05 GMT
https://trac.sagemath.org/ticket/5711#comment:3
https://trac.sagemath.org/ticket/5711#comment:3
<p>
burcin: do you want to review this? Does the move to the new symbolics affect this patch?
</p>
TicketjhpalmieriTue, 09 Jun 2009 21:59:42 GMTsummary changed
https://trac.sagemath.org/ticket/5711#comment:4
https://trac.sagemath.org/ticket/5711#comment:4
<ul>
<li><strong>summary</strong>
changed from <em>[with patch, needs review] Enhanced Typesetting of Symbolic Functions</em> to <em>[with patch, needs rebase] Enhanced Typesetting of Symbolic Functions</em>
</li>
</ul>
<p>
Patch doesn't apply cleanly against 4.0.1.
</p>
TicketgmhossainTue, 09 Jun 2009 22:20:49 GMTcc changed
https://trac.sagemath.org/ticket/5711#comment:5
https://trac.sagemath.org/ticket/5711#comment:5
<ul>
<li><strong>cc</strong>
<em>jhpalmieri</em> added
</li>
</ul>
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/5711#comment:4" title="Comment 4">jhpalmieri</a>:
</p>
<blockquote class="citation">
<p>
Patch doesn't apply cleanly against 4.0.1.
</p>
</blockquote>
<p>
Yes, recent switch to new symbolics has affected this patch quite a bit.
In fact, the class "<a class="missing wiki">SymbolicFunctionEvaluation?</a>" (whose enhancement was aimed
through this patch) doesn't exist anymore. I am now looking into the
new symbolics code to properly rebase the patch.
</p>
TicketgmhossainFri, 12 Jun 2009 16:01:00 GMTdescription, summary changed
https://trac.sagemath.org/ticket/5711#comment:6
https://trac.sagemath.org/ticket/5711#comment:6
<ul>
<li><strong>description</strong>
modified (<a href="/ticket/5711?action=diff&version=6">diff</a>)
</li>
<li><strong>summary</strong>
changed from <em>[with patch, needs rebase] Enhanced Typesetting of Symbolic Functions</em> to <em>[with patch, needs review] Enhanced Typesetting of Symbolic Functions</em>
</li>
</ul>
TicketkcrismanFri, 12 Jun 2009 19:46:58 GMTcc, summary changed
https://trac.sagemath.org/ticket/5711#comment:7
https://trac.sagemath.org/ticket/5711#comment:7
<ul>
<li><strong>cc</strong>
<em>schymans</em> added
</li>
<li><strong>summary</strong>
changed from <em>[with patch, needs review] Enhanced Typesetting of Symbolic Functions</em> to <em>[with patch, partial positive review, needs review] Enhanced Typesetting of Symbolic Functions</em>
</li>
</ul>
<p>
This is really impressive. I assume that stan s and the others will want to review this more since they would use it more intensely and understand LaTeX better than I do, but I threw it a lot of stuff and the only "problems" I found were additional cases one might want, which could easily be a separate ticket after this is merged. The integrals, limits, Laplace, derivatives work out nice now, as does the option for D.
</p>
<ol><li>Only some underscore things do subscripts, and double subscripts don't work. That's fine, but might as well search for them if possible, e.g. HH_sigma or WWW_xy_z or something could also typeset.
</li><li>The weird cases mentioned in various threads such as D[0](f)(sin(x)*cos(x)) look nice but have e.g. dcos(x)*sin(x) in the denominator, not giving Jason's suggestion of -(sin(x)<sup>2-cos(x)</sup>2)*\frac{df}{dx}(sin(x)*cos(x)). I assume that's okay but wanted to check.
</li><li>There is still the same typesetting for e.g. variables mu and mu_. I think that sort of makes sense, since mu_1 and mu1 give the same thing, but it does seem strange.
</li><li>Some stuff still doesn't work, but I don't know if it did before. For instance, sqrt(mu) is okay, but e<sup>(sqrt(mu)) is not, or even e</sup>(sqrt(x)). So <a class="closed ticket" href="https://trac.sagemath.org/ticket/6211" title="defect: [with patch, positive review] typesetting exp sometimes broken (closed: fixed)">#6211</a> can't be closed, not that you claimed it could - but it would fit naturally here. Check out show(e<sup>function(f_mu,x)) for a real kick.
</sup></li><li>Limit and integral syntax don't (yet) allow multiple things for multiple variables, but since they are nested by parentheses it would be nice for those to show up, which they currently don't (however, they do calculate properly). This definitely is not within the purview of this ticket.
</li></ol><p>
Great work from my view! Except I almost always declare my function f(x)=x<sup>2, not symbolic, so I will probably not use it much. But it will be good for subscripts for sure!
</sup></p>
TicketjhpalmieriFri, 12 Jun 2009 23:10:40 GMTsummary changed
https://trac.sagemath.org/ticket/5711#comment:8
https://trac.sagemath.org/ticket/5711#comment:8
<ul>
<li><strong>summary</strong>
changed from <em>[with patch, partial positive review, needs review] Enhanced Typesetting of Symbolic Functions</em> to <em>[with patch, needs work] Enhanced Typesetting of Symbolic Functions</em>
</li>
</ul>
<p>
This patch does not pass doctests on sage.math:
</p>
<pre class="wiki">sage -t "devel/sage/sage/symbolic/function.pyx"
**********************************************************************
File "/scratch/palmieri/sage-4.0.1/devel/sage/sage/symbolic/function.pyx", line 121:
sage: latex(foo(x,y^z))
Expected:
\mbox{t}\left(x, y^{z}\right)
Got:
t\left(x, y^{z}\right)
**********************************************************************
File "/scratch/palmieri/sage-4.0.1/devel/sage/sage/symbolic/function.pyx", line 129:
sage: latex(foo(x,y^z))
Expected:
\mbox{foo}\left(x, y^{z}\right)
Got:
foo\left(x, y^{z}\right)
**********************************************************************
1 items had failures:
2 of 45 in __main__.example_2
***Test Failed*** 2 failures.
For whitespace errors, see the file /scratch/palmieri/sage-4.0.1/tmp/.doctest_function.py
[1.2 s]
exit code: 1024
</pre><p>
Should be easy enough to fix.
</p>
TicketgmhossainSat, 13 Jun 2009 00:14:49 GMTattachment set
https://trac.sagemath.org/ticket/5711
https://trac.sagemath.org/ticket/5711
<ul>
<li><strong>attachment</strong>
set to <em>enhanced-symbolic-typesetting-rebased_to_4.0.1.patch</em>
</li>
</ul>
TicketgmhossainSat, 13 Jun 2009 00:21:15 GMTsummary changed
https://trac.sagemath.org/ticket/5711#comment:9
https://trac.sagemath.org/ticket/5711#comment:9
<ul>
<li><strong>summary</strong>
changed from <em>[with patch, needs work] Enhanced Typesetting of Symbolic Functions</em> to <em>[with patch, needs review] Enhanced Typesetting of Symbolic Functions</em>
</li>
</ul>
<p>
Thanks! I have fixed these two doctest failure and updated the rebased patch.
</p>
TicketgmhossainSat, 13 Jun 2009 12:17:20 GMT
https://trac.sagemath.org/ticket/5711#comment:10
https://trac.sagemath.org/ticket/5711#comment:10
<p>
Thanks kcrisman! As you have suggested, I would also prefer to fix only the blockers
in this patch and leave other enhancements for follow-up patches.
</p>
<blockquote class="citation">
<ol><li>Some stuff still doesn't work, but I don't know if it did before. For instance, sqrt(mu) is okay, but e<sup>(sqrt(mu)) is not, or even e</sup>(sqrt(x)). So <a class="closed ticket" href="https://trac.sagemath.org/ticket/6211" title="defect: [with patch, positive review] typesetting exp sometimes broken (closed: fixed)">#6211</a> can't be closed, not that you claimed it could - but it would fit naturally here. Check out show(e<sup>function(f_mu,x)) for a real kick.
</sup></li></ol></blockquote>
<p>
This seems to be a bug for "exp" function. Other functions such as "abs", "sin" etc work fine. I have posted
my comments there with a easy fix. It would be better to have a separate patch for that bug.
</p>
TicketburcinSun, 14 Jun 2009 14:40:14 GMTcomponent, summary changed
https://trac.sagemath.org/ticket/5711#comment:11
https://trac.sagemath.org/ticket/5711#comment:11
<ul>
<li><strong>component</strong>
changed from <em>misc</em> to <em>symbolics</em>
</li>
<li><strong>summary</strong>
changed from <em>[with patch, needs review] Enhanced Typesetting of Symbolic Functions</em> to <em>[with patch, needs work] Enhanced Typesetting of Symbolic Functions</em>
</li>
</ul>
<p>
Hi Golam,
</p>
<p>
Thanks for your continued work on this. I see that your patch improves the typesetting of symbolic functions dramatically. I believe with a few improvements it would fit better in the new symbolics framework.
</p>
<p>
Here is my referee report:
</p>
<p>
Quotes from the description:
</p>
<blockquote class="citation">
<p>
(2) Functions such as "diff", "integrate", "limit", "conjugate",
"laplace", "inverse_laplace" are now typeset within Sage itself.
</p>
<p>
Ex: integrate(f(x),x) => \int f(x) dx
</p>
</blockquote>
<p>
These should be handled using the custom printing facilities of <code>sage.symbolic.function.SFunction</code>. Special casing them in the new <code>latex_symbolic_function()</code> function is not scalable. This approach would also make the checks for the number of arguments as well as the calls to <code>_symbolic_function_default_latex_()</code> in each of these functions redundant.
</p>
<p>
I see that there is already a <code>_limit</code> function defined in <code>sage/calculus/calculus.py</code>. I think the best solution for the short term would be to put these printing functions there, and give them as an argument to the <code>SFunction</code> constructor.
</p>
<p>
Conjugates are already printed as:
</p>
<pre class="wiki">sage: latex(x.conjugate())
\bar{x}
</pre><p>
Why is <code>\overline</code> better?
</p>
<blockquote class="citation">
<p>
(6) <strong>[New in the rebased patch]</strong> New symbolics uses "D"
format for derivatives instead of old "diff" format.
The rebased patch typesets symbolic derivatives in old "diff" format by default as in this format typeset version looks similar to those found in text books, journals.
</p>
<p>
However see this thread for known limitations of current conversion between these two formats
</p>
<blockquote>
<p>
<a class="ext-link" href="http://groups.google.com/group/sage-devel/browse_thread/thread/7479c3eeb96348a2"><span class="icon"></span>http://groups.google.com/group/sage-devel/browse_thread/thread/7479c3eeb96348a2</a>
</p>
</blockquote>
<p>
One can switch between two typesetting format as follows
</p>
<pre class="wiki">f(x) = function('f',x)
g = diff(f(x),x)
latex(g)
\frac{d f\left(x\right)}{d x}
# Switch to D format
sage.symbolic.pynac.typeset_d_as_diff=False
latex(g)
D[0]f\left(x\right)
</pre></blockquote>
<p>
I believe this issue needs more debate, preferably with examples of how Maple and MMA handle this problem. I will post a new message about this to sage-devel soon. For now, I suggest we split this to a different ticket.
</p>
<blockquote class="citation">
<p>
(1) Symbolics functions with name in Greek letters (with possible
suffixes), are typeset nicely in LaTeX.
</p>
<p>
Ex: psi(x) => \psi(x)
</p>
<blockquote>
<p>
f0(x) => f_0(x)
</p>
</blockquote>
</blockquote>
<p>
Can't this be handled by a call to the new <code>latex_function_name()</code> from <code>sage.symbolic.pynac.py_latex_function_pystring()</code>?
</p>
<blockquote class="citation">
<p>
(3) Default (fall-back) typesetting for unknown functions (as
in Maxima).
</p>
<p>
Ex: myfn(x) => {\it myfn}(x)
</p>
</blockquote>
<p>
We have the GiNaC convention of falling back to <code>\mbox</code> at the moment. Previously, maxima didn't do anything for function names with one variable, and added an <code>\it</code>:
</p>
<pre class="wiki">sage: version()
'Sage Version 3.4.2, Release Date: 2009-05-05'
sage: var('a')
a
sage: f = function('f')
sage: latex(f(a))
f\left(a\right)
</pre><p>
As you mention in the docstring for <code>latex_function_name()</code>, there is considerable code duplication between this function and <code>latex_variable_name()</code>. Your previous response to my question about the differences between these two functions is here:
</p>
<p>
<a class="ext-link" href="http://groups.google.com/group/sage-devel/msg/071207efa39c5356"><span class="icon"></span>http://groups.google.com/group/sage-devel/msg/071207efa39c5356</a>
</p>
<p>
It seems that your goal of returning a different response as default behavior can be achieved by passing a parameter to the <code>latex_varify()</code> calls at the end of <code>latex_variable_name()</code>. Is there a reason why the further recursions performed by <code>latex_variable_name()</code> are not relevant for function names? In any case, the string processing code in <code>latex_variable_name()</code> shouldn't be duplicated.
</p>
<blockquote class="citation">
<p>
(7) <strong>[New in the rebased patch]</strong> The rebased patch resolves
the issue
</p>
<p>
<a class="ext-link" href="http://trac.sagemath.org/sage_trac/ticket/6268"><span class="icon"></span>http://trac.sagemath.org/sage_trac/ticket/6268</a>
</p>
</blockquote>
<p>
This seems to be caused by a thinko on my part. It can be fixed by modifying lines 416-149 in <code>sage/symbolic/pynac.pyx</code>. You seem to do something similar at the end of <code>latex_symbolic_function()</code> and <code>_symbolic_function_default_latex_()</code> functions.
</p>
<p>
Overall I think the patch looks very crowded and confusing. With the changes suggested above,
</p>
<ul><li>the new functions <code>latex_symbolic_function()</code>, <code>_symbolic_function_default_latex_()</code>, <code>_args_latex_()</code>, can be eliminated.
</li><li>derivative related functions <code>latex_d_derivative()</code> and <code>_derivative_latex_()</code> should be split to a new ticket.
</li><li>specialized printing functions <code>_integrate_latex_()</code>, <code>_inverse_laplace_latex_()</code>, <code>_laplace_latex_()</code>, <code>_limit_latex_()</code> should be moved to <code>sage/calculus/calculus.py</code> and hooked up to the right <code>sage.symbolic.function.SFunction</code> instance.
</li><li><code>_conjugate_latex_()</code> doesn't seem necessary.
</li></ul>
TicketgmhossainMon, 15 Jun 2009 01:30:40 GMT
https://trac.sagemath.org/ticket/5711#comment:12
https://trac.sagemath.org/ticket/5711#comment:12
<p>
Thanks Burcin for your detailed review. See below for my responses. I would be happy to
hear you back before I start making some of the changes, you have suggested.
</p>
<blockquote class="citation">
<blockquote class="citation">
<p>
(2) Functions such as "diff", "integrate", "limit", "conjugate",
"laplace", "inverse_laplace" are now typeset within Sage itself.
</p>
</blockquote>
<p>
These should be handled using the custom printing facilities of <code>sage.symbolic.function.SFunction</code>.
</p>
</blockquote>
<p>
I fully agree! However, does new symbolics has such framework ready for the mentioned functions?
</p>
<blockquote class="citation">
<p>
I see that there is already a <code>_limit</code> function defined in <code>sage/calculus/calculus.py</code>.
I think the best solution for the short term would be to put these printing functions
there, and give them as an argument to the <code>SFunction</code> constructor.
</p>
</blockquote>
<p>
Could you please give an short example for such construction (my current understanding
of new symbolics is limited)?
</p>
<p>
What is your "long-term" solution?
</p>
<p>
Why is it better to put these functions in calculus/calculus.py
even as a "short term" solution? (I gather from William's note <a class="ext-link" href="http://480.sagenb.org/home/pub/45/"><span class="icon"></span>http://480.sagenb.org/home/pub/45/</a> that
"calculus" direcotory is to be deleted. This conflicts with your suggestion.)
</p>
<blockquote class="citation">
<pre class="wiki">sage: latex(x.conjugate())
\bar{x}
</pre><p>
Why is <code>\overline</code> better?
</p>
</blockquote>
<p>
"\bar" is ok for variable but is insufficient for symbolic functions. Please try the
followings in the notebook:
</p>
<pre class="wiki">jsmath('\\bar{\\psi\\left(x, y\\right)}')
jsmath('\\overline{\\psi\\left(x, y\\right)}')
</pre><p>
then you will see the reason yourself.
</p>
<p>
</p>
<blockquote class="citation">
<blockquote class="citation">
<p>
(6) <strong>[New in the rebased patch]</strong> New symbolics uses "D" format
</p>
</blockquote>
<p>
I believe this issue needs more debate,
I suggest we split this to a different ticket.
</p>
</blockquote>
<p>
Sure, I will open a new ticket for this.
</p>
<blockquote class="citation">
<blockquote class="citation">
<p>
(1) Symbolics functions with name in Greek letters (with possible
suffixes), are typeset nicely in LaTeX.
</p>
<p>
Ex: psi(x) => \psi(x)
</p>
<blockquote>
<p>
f0(x) => f_0(x)
</p>
</blockquote>
</blockquote>
<p>
Can't this be handled by a call to the new <code>latex_function_name()</code> from <code>sage.symbolic.pynac.py_latex_function_pystring()</code>?
</p>
</blockquote>
<p>
Provided all other symbolic "functions" ("integrate",...) have been typeset
somewhere else which is not the case at present.
</p>
<blockquote class="citation">
<blockquote class="citation">
<p>
(3) Default (fall-back) typesetting for unknown functions (as
in Maxima).
</p>
<p>
Ex: myfn(x) => {\it myfn}(x)
</p>
</blockquote>
<p>
We have the GiNaC convention of falling back to <code>\mbox</code> at the moment.
</p>
</blockquote>
<p>
Frankly, it is disappointing to see another inconsistent typesetting.
Why should a function named "sin" should be typseset as "\sin" (=>"\rm sin")
where as another function named "mysin" is typeset as "\mbox{mysin}"? Please compare
them side-by-side to see the contrast.
</p>
<blockquote class="citation">
<p>
Previously, maxima didn't do anything for function names with one variable, and added an <code>\it</code>:
</p>
</blockquote>
<p>
So as in this patch! Though, I wanted to use "\rm" as {\rm myfunc} but decided to
stick to maxima usage.
</p>
<blockquote class="citation">
<p>
As you mention in the docstring for <code>latex_function_name()</code>, there is
considerable code duplication between this function and <code>latex_variable_name()</code>.
</p>
</blockquote>
<p>
I agree that we should avoid duplication of code.
</p>
<blockquote class="citation">
<p>
Is there a reason why the further recursions performed by <code>latex_variable_name()</code>
are not relevant for function names?
</p>
</blockquote>
<p>
In physics, we often use functions such as "f_{\alpha\beta}". In sage, if I use
current latex_variable_name() to typeset "f_alpha_beta" then it would typeset
as f_{{\alpha}_{\beta}} which is completely different.
</p>
<p>
However I guees, thats my own preference and I shouldn't argue anymore on this.
I guess <a class="closed ticket" href="https://trac.sagemath.org/ticket/6290" title="enhancement: [with patch, positive review] Allow keywords such as latex_name=LaTeX ... (closed: fixed)">#6290</a> will solve my problem altogether.
</p>
<p>
I will remove latex_function_name() and use latex_variable_name() instead.
</p>
TicketgmhossainTue, 23 Jun 2009 11:33:05 GMTattachment set
https://trac.sagemath.org/ticket/5711
https://trac.sagemath.org/ticket/5711
<ul>
<li><strong>attachment</strong>
set to <em>trac_5711-enhanced-symbolic-typesetting-rebased_to_4.0.2.patch</em>
</li>
</ul>
TicketgmhossainTue, 23 Jun 2009 11:59:50 GMTdescription, summary changed
https://trac.sagemath.org/ticket/5711#comment:13
https://trac.sagemath.org/ticket/5711#comment:13
<ul>
<li><strong>description</strong>
modified (<a href="/ticket/5711?action=diff&version=13">diff</a>)
</li>
<li><strong>summary</strong>
changed from <em>[with patch, needs work] Enhanced Typesetting of Symbolic Functions</em> to <em>[with patch, needs review] Enhanced Typesetting of Symbolic Functions</em>
</li>
</ul>
<p>
Burcin: I have updated the patch as you suggested. List of changes is given in the description.
</p>
TicketburcinTue, 23 Jun 2009 13:28:06 GMTattachment set
https://trac.sagemath.org/ticket/5711
https://trac.sagemath.org/ticket/5711
<ul>
<li><strong>attachment</strong>
set to <em>trac_5711-doctest_fixes.patch</em>
</li>
</ul>
<p>
doctest fixes
</p>
TicketburcinTue, 23 Jun 2009 13:35:30 GMTsummary changed
https://trac.sagemath.org/ticket/5711#comment:14
https://trac.sagemath.org/ticket/5711#comment:14
<ul>
<li><strong>summary</strong>
changed from <em>[with patch, needs review] Enhanced Typesetting of Symbolic Functions</em> to <em>[with patch, positive review] Enhanced Typesetting of Symbolic Functions</em>
</li>
</ul>
<p>
Thanks Golam. The patch looks good to me. I added a small patch that fixes doctests in two places.
</p>
<p>
Only apply
</p>
<ul><li>trac_5711-enhanced-symbolic-typesetting-rebased_to_4.0.2.patch
</li><li>trac_5711-doctest_fixes.patch
</li></ul>
TicketrlmWed, 24 Jun 2009 09:52:03 GMTstatus changed; reviewer, resolution, merged, author set
https://trac.sagemath.org/ticket/5711#comment:15
https://trac.sagemath.org/ticket/5711#comment:15
<ul>
<li><strong>status</strong>
changed from <em>new</em> to <em>closed</em>
</li>
<li><strong>reviewer</strong>
set to <em>Burcin Erocal</em>
</li>
<li><strong>resolution</strong>
set to <em>fixed</em>
</li>
<li><strong>merged</strong>
set to <em>sage-4.1.alpha0</em>
</li>
<li><strong>author</strong>
set to <em>Golam Mortuza Hossain</em>
</li>
</ul>
TicketschymansWed, 24 Jun 2009 10:47:59 GMT
https://trac.sagemath.org/ticket/5711#comment:16
https://trac.sagemath.org/ticket/5711#comment:16
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/5711#comment:7" title="Comment 7">kcrisman</a>:
</p>
<blockquote class="citation">
<p>
This is really impressive. I assume that stan s and the others will want to review this more since they would use it more intensely and understand LaTeX better than I do, but I threw it a lot of stuff and the only "problems" I found were additional cases one might want, which could easily be a separate ticket after this is merged. The integrals, limits, Laplace, derivatives work out nice now, as does the option for D.
</p>
<ol><li>Only some underscore things do subscripts, and double subscripts don't work. That's fine, but might as well search for them if possible, e.g. HH_sigma or WWW_xy_z or something could also typeset.
</li></ol></blockquote>
<p>
[Snip]
I am very fond of the set_latex() method for defining custom latex representations, which would allow for multiple subscripts etc. Unfortunately, it has been disabled with the new symbolics. Is there a plan to re-enable it again? In general, I think that it would be nice to give as much control to the user as possible, rather than hard-coding certain latex representations. Sorry I haven't been of any help with reviewing/patching, but I only now got back to the typesetting issues and found that my previous ad-hoc latex definitions don't work in Sage 4.x any more. :(
</p>
<p>
Great work, anyway, and many thanks to those that invested time and effort into improving the typesetting in Sage!
</p>
TicketgmhossainWed, 24 Jun 2009 10:56:09 GMT
https://trac.sagemath.org/ticket/5711#comment:17
https://trac.sagemath.org/ticket/5711#comment:17
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/5711#comment:16" title="Comment 16">schymans</a>:
</p>
<blockquote class="citation">
<p>
I am very fond of the set_latex() method for defining custom latex representations,
which would allow for multiple subscripts etc. Unfortunately, it has been disabled
with the new symbolics. Is there a plan to re-enable it again?
</p>
</blockquote>
<p>
Yes but in a new avatar! The new method would be more powerful. The patch is
here
</p>
<p>
<a class="ext-link" href="http://trac.sagemath.org/sage_trac/ticket/6290"><span class="icon"></span>http://trac.sagemath.org/sage_trac/ticket/6290</a>
</p>
Ticket