[TW5] KaTeX display style equations not as expected

201 views
Skip to first unread message

Bob Flandard

unread,
Oct 3, 2015, 1:43:16 PM10/3/15
to TiddlyWiki
Hello,

The KaTeX plugin is rather excellent and seems like magic, but I was expecting the \displaystyle mode to place the equation on a line of its own and centre-align it on the page (that's how they behave in LaTeX).
I've tested this in TW5.1.9 and 5.1.10-prerelease with Firefox 41.0.1 on Windows 7.

Here's some sample code that demonstrates the issue.


This default "inline" equation works as expected
$$f
(x) = \int_{-\infty}^\infty\hat f(\xi)\,e^{2 \pi i \xi x}\,d\xi$$. Which is nice.

---
But this "displaystyle" equation is not...
$$
\displaystyle f(x) = \int_{-\infty}^\infty\hat f(\xi)\,e^{2 \pi i \xi x}\,d\xi$$
...on a line of its own...

---
...and this "displaystyle" equation is not centre-aligned on the page.


$$
\displaystyle f(x) = \int_{-\infty}^\infty\hat f(\xi)\,e^{2 \pi i \xi x}\,d\xi$$


Any workarounds?

Thanks, Bob




 

Jeremy Ruston

unread,
Oct 3, 2015, 2:07:42 PM10/3/15
to tiddl...@googlegroups.com
Hi Bob

One of the examples at http://tiddlywiki.com/plugins/tiddlywiki/katex/index.html shows one way of doing what you want:

<div class="katex-display">
$$\displaystyle \left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right)$$
</div>

But I agree that one might expect the “displaystyle” directive to do everything necessary to centre the equation. There doesn’t appear to be any CSS class assigned by default to indicate that the equation is in display style, though, so it’s not clear that it could be implemented that way.

Best wishes

Jeremy



--
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+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/cc53e10e-7040-4dd9-af05-6954e878b5fa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Bob Flandard

unread,
Oct 3, 2015, 6:12:30 PM10/3/15
to TiddlyWiki
Hello Jeremy,

Thanks, that's great.

If any other TW5 novice wants to do the same thing repeatedly in a tiddler and save a bit of typing, this macro is marginally useful

\define TeX(TeXstring)
<div class="katex-display">
<$latex text="\displaystyle $TeXstring$">
</div>
\end



macro call with text either side
But this "displaystyle" equation is ...
<<TeX "\left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right)">>
...on a line of its own and centre aligned


All the best, Bob

Reply all
Reply to author
Forward
0 new messages