Open delip opened 8 years ago
Hi,
This is happening because you have line breaks within the shortcode. WordPress automatically converts line breaks into <br />
's, so you will need to make sure your equation is on one line.
I will add code to handle these situations in a future release.
That was the problem. Removing the linebreaks removed the <br/>
s, for longer equations such as this, it would be nice to write the latex out on a seperate line.
[latex display="true"]\int_S \bigl| f(x)g(x)\bigr| \,\mathrm{d}x \le\biggl(\int_S |f(x)|^p\,\mathrm{d}x\biggr)^{\frac{1}{p}} \biggl(\int_S |g(x)|^q\,\mathrm{d}x\biggr)^{\frac{1}{q}}.[/latex]
Agree this is now an enhancement. Thanks!
Is a solution maybe (my WordPress plugin development skills are somewhat rusty) to create a handler and strip out the changed line breaks (the HTML?). Or is WordPress the last one changing those snippets?
@fdeitelhoff There are a number of possible solutions (stripping the tags in the shortcode processor, this thing, this thing, and this thing), but they all look like ugly hacks to me.
@as-com Okay, I see. Then we need to decide if the hack is worth preventing the problem?
I think it is an important feature to have multi-line LaTeX short-codes. Especially because LaTeX needs them in some scenarios.
A workaround for this is removing htmlspecialchars
from
$enc = htmlspecialchars( html_entity_decode( $content ) );
in the file frontend.php
.
But I don't know what are the possible bad consequences of this.
I have a simple expression:
This renders with spurious line break tags as:
If I look at the generated code I see:
Why is this happening? I'm using Version 1.5.1 (installed today on a fresh WP instance and I have not enabled the default wp latex).