Sage: Ticket #11428: Customizable latex for functions
https://trac.sagemath.org/ticket/11428
<p>
There should be a way to customize how a function is printed and how it is translated into Latex, as requested on <a class="ext-link" href="http://ask.sagemath.org/question/579/how-to-change-_latex_-of-log-to-ln"><span class="icon"></span>ask-sage</a>.
</p>
<p>
I suggest, as a first step, to add methods <code>set_name()</code> and <code>set_latex_name()</code> that change the value of the cdefined attributes <code>_name</code> used for printing and <code>_latex_name</code> used for translation to latex. Then, the following would work:
</p>
<pre class="wiki">sage: tan.set_name('tg')
sage: tan
tg
sage: tan.set_latex_name(r'\tg')
sage: latex(tan)
\tg
</pre><p>
However, that can really only be the first step. Because, when I did so, I still got
</p>
<pre class="wiki">sage: tan(x)
tan(x)
sage: latex(tan(x))
\tan\left(x\right)
</pre><p>
Hence, in addition to that, the given latex name should be propagated to expressions.
</p>
en-usSagehttps://trac.sagemath.org/chrome/site/logo_sagemath_trac.png
https://trac.sagemath.org/ticket/11428
Trac 1.1.6kcrismanSun, 05 Jun 2011 03:21:29 GMT
https://trac.sagemath.org/ticket/11428#comment:1
https://trac.sagemath.org/ticket/11428#comment:1
<p>
Please upload that preliminary patch so others can work with it!
</p>
<p>
The SR stuff does come from Ginac, as I thought I remembered. Maybe Burcin will have a brief comment to put us on the right track for that; I don't quite understand how it works, though I think I once nearly figured it out :)
</p>
TicketSimonKingSun, 05 Jun 2011 06:32:54 GMTattachment set
https://trac.sagemath.org/ticket/11428
https://trac.sagemath.org/ticket/11428
<ul>
<li><strong>attachment</strong>
set to <em>trac11428_customize_latex_for_functions.patch</em>
</li>
</ul>
<p>
Preliminary patch: Change latex/repr of a function. But the custom names are not propagated.
</p>
TicketSimonKingSun, 05 Jun 2011 06:36:29 GMT
https://trac.sagemath.org/ticket/11428#comment:2
https://trac.sagemath.org/ticket/11428#comment:2
<p>
Patch's up.
</p>
<p>
With it, this works
</p>
<pre class="wiki">sage: tan.set_latex_name(r'\tg')
sage: latex(tan)
\tg
sage: tan.set_name('tg')
sage: tan
tg
</pre><p>
but this doesn't
</p>
<pre class="wiki">sage: tan(x)
tan(x)
sage: latex(tan(x))
\tan\left(x\right)
</pre>
TicketkcrismanTue, 27 Nov 2012 15:02:36 GMT
https://trac.sagemath.org/ticket/11428#comment:3
https://trac.sagemath.org/ticket/11428#comment:3
<p>
For reference for anyone implementing this correctly, in <a class="ext-link" href="https://groups.google.com/forum/?fromgroups=#!topic/sage-support/wkzIydg95k8"><span class="icon"></span>this thread on sage-support</a>, Burcin recommends
</p>
<pre class="wiki">It needs to go through the
registry of functions stored in Pynac and update the name or the
printing functions there.
</pre>
TicketjdemeyerTue, 13 Aug 2013 15:35:53 GMTmilestone changed
https://trac.sagemath.org/ticket/11428#comment:4
https://trac.sagemath.org/ticket/11428#comment:4
<ul>
<li><strong>milestone</strong>
changed from <em>sage-5.11</em> to <em>sage-5.12</em>
</li>
</ul>
Ticketvbraun_spamThu, 30 Jan 2014 21:20:52 GMTmilestone changed
https://trac.sagemath.org/ticket/11428#comment:5
https://trac.sagemath.org/ticket/11428#comment:5
<ul>
<li><strong>milestone</strong>
changed from <em>sage-6.1</em> to <em>sage-6.2</em>
</li>
</ul>
Ticketvbraun_spamTue, 06 May 2014 15:20:58 GMTmilestone changed
https://trac.sagemath.org/ticket/11428#comment:6
https://trac.sagemath.org/ticket/11428#comment:6
<ul>
<li><strong>milestone</strong>
changed from <em>sage-6.2</em> to <em>sage-6.3</em>
</li>
</ul>
Ticketvbraun_spamSun, 10 Aug 2014 16:51:03 GMTmilestone changed
https://trac.sagemath.org/ticket/11428#comment:7
https://trac.sagemath.org/ticket/11428#comment:7
<ul>
<li><strong>milestone</strong>
changed from <em>sage-6.3</em> to <em>sage-6.4</em>
</li>
</ul>
TicketrwsMon, 27 Jun 2016 08:17:51 GMT
https://trac.sagemath.org/ticket/11428#comment:8
https://trac.sagemath.org/ticket/11428#comment:8
<p>
See also <a class="closed ticket" href="https://trac.sagemath.org/ticket/20888" title="enhancement: Support GinacFunction._print_latex_() customization (closed: wontfix)">#20888</a>
</p>
Ticket