This is a little discussion about a method that might get you at least 
closer to where you want.

The problem with the implementation of Katex on TW5 is the choice of $$ to 
indicate latex is about to begin. This causes all sorts of havoc with the 
TW macros, because TW macros use $ and $( to indicate the start of a 
parameter. But, if you make a couple very tiny changes to the Katex plugin, 
you could use, for instance, %% to indicate the start of latex formatting.

Once you make this change, you can then write a macro like this:

\define latex(text:"",pi:"\pi",xi:"\xi",infty:"\infty",int:"\int",hat:"\hat"
)
%%
$text$
%%
\endEnter code here...

In this example, I've only applied definitions for 5 latex symbols. I don't 
know if there is an upper limit to symbol parameters that can be created in 
this way. I guess this would be an interesting way to find out ;-)

You then invoke this using the $symbol$ syntax of TW, like:

<<latex """f(x) = $int$_{-$infty$}^$infty$$hat$ f($xi$)\,e^{2 $pi$ i $xi$ 
x}\,d$xi$"""  >>

This produces:



Now let's say you want to change the definition of pie on the fly. You can 
do it like this:


<<latex """f(x) = $int$_{-$infty$}^$infty$$hat$ f($xi$)\,e^{2 $pi$ i $xi$ 
x}\,d$xi$""" pi:"YUM" >>

which produces (I hope these images show up) :



You can also change the default definition everywhere just by changing the 
latex macro default parameter for PI.

So, that's my idea. Something to think about.

Mark

On Saturday, July 15, 2017 at 5:44:45 AM UTC-7, Tom wrote:
>
> Hi,
> I'm relatively new to tiddlywiki, but I find it extremely useful and have 
> moved my research notes to TW. 
>
> There is one thing that would make my life much easier: I would like to 
> define global LaTeX macros, say \elasticity to correspond to \varepsilon, 
> so that every time I use it in a formula, it would get replace before KaTeX 
> displays it. Looking at the forums, I see that other people have had a 
> similar question, but no solution yet. Since it seems that TW has a 
> built-in macro support, it should not be that difficult to extend it just a 
> bit. A simple text substitution (whenever I write TW replace it with 
> tiddlywiki) should do the trick.
>
> Just to clarify the importance: in research it is often very useful to use 
> macros for variable names, because if the notation changes in the later 
> stages, there is no need to go through everything and change say 
> \varepsilon to e. It would be also useful to define macros as shortcuts, of 
> course.
> Best regards,
> Tom
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/7fabb4ed-3adf-4f7a-a885-40c3cfd0dd23%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to