Thomas Churchman
Forum Replies Created
-
Forum: Plugins
In reply to: [KaTeX] The way derivatives are displayedI developed a fix for both shortcodes and blocks, but before I release it as stable, I was hoping for you to test it.
You can download the Development Version here: https://www.ads-software.com/plugins/katex/advanced/
Please (as always) make a back-up of your posts first.
This is part of a bigger release, with the release notes so far being:
* Prevent WordPress from texturizing KaTeX (prior to this change, WordPress would sometimes change e.g. apostrophes to quotation marks).
* Fix issue where custom class names on the KaTeX block sometimes broke editor rendering.
* Add some keywords to allow searching for the KaTeX block in the editor’s block list.
* Update KaTeX resources to v0.12.0.Forum: Plugins
In reply to: [KaTeX] The way derivatives are displayedHi!
I’ve looked at the page you linked a few times over the past days, but it keeps redirecting me to the site’s homepage.
However, I think I see what you mean! It appears WordPress is changing
'
to’
. (And it might also change it here on these forums, so who knows, perhaps this post doesn’t come across correctly either).I will have a look to see if I can disable this behavior for KaTeX blocks. It will probably be difficult to disable it for the shortcodes, though.
Forum: Plugins
In reply to: [KaTeX] Plugin setupHi,
I’m sorry to hear about your troubles.
There seem to be three issues here, one of which is causing the immediate error you’re seeing.
1. The theme used on the page you linked is not including the KaTeX resources. The resources are enqueued by the plugin using normal WordPress hooks, so this seems to be an issue with this specific theme. This causes the error you’re seeing.
Once you have fixed that, there’d be two other issues:
2. The text given to KaTeX for rendering is a LaTeX document. KaTeX only supports TeX equations, not full LaTeX.
3.eqnarray
is not available in KaTeX. The equation could be rendered as desired with e.g. the following\begin{aligned} \sum_{m = 1}^{^{\infty} _{} } & \sum_{m = n}^{^{m = \infty}} \frac{1}{m^2} \end{aligned}
Hope this helps!
Forum: Plugins
In reply to: [KaTeX] How to increase space in fractionsThis is not something the plugin can support: typesetting is handled by the underlying KaTeX library. Perhaps you can look into how to increase the fraction spacing with LaTeX (or KaTeX specifically).
Forum: Plugins
In reply to: [KaTeX] How to change font familyThe font family cannot be changed.
The font size can be changed by styling the
katex-eq
class, e.g.:.katex-eq { font-size: 1.2em; }
The plugin only supports inline or block equations. Alignment in general is handled by the KaTeX typesetter, but if necessary a block’s alignment as a whole can be changed by changing
text-align
on.katex-display
.Forum: Plugins
In reply to: [KaTeX] An error occurs when user is not logged inThis is likely an issue with the WordPress theme. Which theme are you using?
Forum: Plugins
In reply to: [KaTeX] katex is not definedHey, where does this error occur?
It’s possible it’s an issue with the theme.
Forum: Plugins
In reply to: [KaTeX] Rendering issue with big bracketsDear Jürgen,
Thank you for your kind words.
I’m seeing the same issue. The problem is upstream: it’s also present when inputting the expression on https://katex.org/
I found there is already an issue report (https://github.com/KaTeX/KaTeX/issues/2198), and a potential fix (https://github.com/KaTeX/KaTeX/pull/2234).
We’ll have to wait for a new KaTeX release, which unfortunately might take a few months still. I’ll mark this issue as resolved as there isn’t much this plugin can do about it at this moment, but do keep an eye on new releases.
In general a plugin like WP QuickLaTeX would have better rendering as it uses actual LaTeX, but it has its own cons (it’s slower and relies on remote servers or a local LaTeX install).
Take care, and I’m wishing you good luck with the distance education!
P.S.
.katex svg { max-width: none;}
should not be necessary, so something in the CSS is probably globally stylingsvg
.Forum: Plugins
In reply to: [KaTeX] additonal CSS class, againThank you for the confirmation!
I have not found out why it broke specifically for Bedrock. Bedrock uses the exact same WordPress 5.4 code as a “normal” install, so it probably has something to do with the WordPress configuration.
I was able to ascertain the issue was caused by a Bedrock installation requiring
className
to be explicitly mentioned as an attribute on the KaTeX block, whereas in a “normal” install it was not required (and, I believed, that was how it was intended).I’ve not been able to tell what the specific difference between Bedrock and a normal install is that made this issue crop up, though.
Forum: Plugins
In reply to: [KaTeX] additonal CSS class, againHi RG Factory,
I made a mistake with the previous development version. Could you download the new development version and try again?
- This reply was modified 4 years, 7 months ago by Thomas Churchman.
Forum: Plugins
In reply to: [KaTeX] additonal CSS class, againI was able to reproduce the issue on Bedrock. I am not sure why the issue occurs on Bedrock and not on a “normal” WordPress install.
Regardless, I believe I’ve fixed the issue. The fix is available in the development version: https://www.ads-software.com/plugins/katex/advanced/
Please test it and let me know whether it works for you.
Forum: Plugins
In reply to: [KaTeX] additonal CSS class, againI unfortunately am still not able to reproduce this issue with the same versions of WordPress, this plugin, and the theme Twenty Eleven. The additional class is added as expected.
However, the code your shared is immediately changed by WordPress to:
<!-- wp:paragraph --> <p>this is a test </p> <!-- /wp:paragraph --> <!-- wp:katex/display-block {"className":"rgf-test"} --> <div class="wp-block-katex-display-block katex-eq rgf-test" data-katex-display="true">\overrightarrow{OB} \begin{cases} x = v_0.\cos(\alpha).t \\ y = -\dfrac{1}{2}.g.t^2 + v_0.\sin(\alpha).t + h \end{cases}</div> <!-- /wp:katex/display-block -->
Note the addition of
{"className":"rgf-test"}
. Could you try whether this code does render inside the block editor?Forum: Plugins
In reply to: [KaTeX] additonal CSS class, againHi RG Factory,
I’ve not been able to reproduce this issue.
Does this (also) occur when creating a completely new post?
Could you share the post’s code? In the editor, press the three vertical dots in the top right, and select “code editor”.
Forum: Plugins
In reply to: [KaTeX] Incompatible with Prismatic@pandascience I have release version 2.0.2, which should solve your issue.
Please report back if you are still encountering issues.
Forum: Plugins
In reply to: [KaTeX] Incompatible with Prismatic@specialk Both this KaTeX plugin and Prismatic put some variables in global scope. In this case, it clashes on
registerBlockType
(which KaTeX’s code declares asconst
inassets/block-editor.js
and Prismatic’s code declares asvar
in e.g.js/blocks-prism.js
). Declaring variables globally like these plugins do is bad practice, and causes the reported bug.The WordPress Block Handbook now recommends to scope these variables in a function: https://developer.www.ads-software.com/block-editor/tutorials/block-tutorial/writing-your-first-block-type/#registering-the-block