Latex syntax correct, but it not always work.
-
I started to use WP to write blogs with lots of math formula. I use the syntax $latex my_own_latex_code$. Sometime it works fine. But lots of times it does not work correctly. The same simple code like ” $latex frac{ABC}{CDEF}$ ” may work fine in one blog but not work in others. Sometime it gives “not parse error”, sometime return the original code, not parse it at all. Some code even copy to different lines, and one will work, and other line will not work. All the codes are syntax correctly. Spent too much time on debugging this error.
Please help this.
The blog I need help with is: (visible only to logged in users)
-
-
Hi there,
Please take a look at this support page:
As mentioned there, the “Formula does not parse” error comes up if your Latex syntax is broken. This is not an issue with the Latex support in WordPress.com but with the Latex syntax itself. The support staff here at WordPress.com is not able to support Latex syntax errors.
If you’re running into trouble where the same code will work on one blog but not on another, please send me links to the code on both blogs so we can take a look at what’s going on there.
-
Again, the latex syntax is correct. In the example below, the latex syntax is very simple one.
Test Math Formula: Whey this can't parse: $latex h(theta, X) = frac{1}{1+ e^X}$ and $latex frac{ABC}{CDEF}$ Try this: $latex frac{ABC}{CDEF}$ again.href=”http://lukelushu.wordpress.com/2014/08/15/test-4/”>Please look at this example.
-
Thank you for showing me that example. In the first example, there are two spaces after $latex in the code:
$latex h(theta, X) = frac{1}{1+ e^X}$If you remove the second space, the code will parse:
$latex h(theta, X) = frac{1}{1+ e^X}$In the last example, it has a non-breaking space between $latex and the latex code. If you replace the non-breaking space with a regular space, it will work:
$latex frac{ABC}{CDEF}$Please let me know if I can do anything more to help with that.
-
Thank you for your help. However, I am wondering
1. Why the Latex code cares about extra spaces. Latex syntax usually ignores all the extra spaces.
2. How do you find the invisible non-breaking space? Which editor tool do you use?
-
1. Why the Latex code cares about extra spaces. Latex syntax usually ignores all the extra spaces.
That is part of the WordPress.com Latex feature, not the Latex syntax itself. The code has to follow this format, with one space between $latex and your Latex code:
$latex your-latex-code-here$
2. How do you find the invisible non-breaking space? Which editor tool do you use?
I looked at the source code of your test post and saw that the second example used a non-breaking space instead of a regular space. If you’re ever unsure about whether there’s a non-breaking space, you can delete the space after $latex and insert a regular space with your spacebar to fix it.
Please let me know if you have any other questions about that. :)
-
Rachelmcr,
Thanks very much for your help. Good to know that WordPress latex does not take extra spaces!
-
Rachelmcr,
Anthony question you might be able to help me. How to insert a code snippet into the wordpress.com blog?
In this forum, we can use the “code-/code” tag to insert code snippet, like this:
$latex frac{ABC}{CDEF}$The latex code in the code snippet will not be parsed. and the contents shown in different background color. That is what effect I want in the WordPress.com blog. I tried it in the WordPress.com blog by using the “Text” editor:
$latex frac{ABC}{CDEF}$
It does not work at all.
What is the best way to snippet into the wordpress.com blog?
-
Because of how Latex is displayed at WordPress.com, the usual source code shortcode doesn’t work with it. (However, you can use that to display other kinds of code on your blog.)
One option is to display the Latex code by itself, without the WordPress.com code around it:
frac{ABC}{CDEF}
You can display that as preformatted text to make it stand out, if you’d like: http://en.support.wordpress.com/advanced-html/#preformatted-text
Another option is to use a non-breaking space between $latex and your Latex code. This page has more details about non-breaking spaces and how to enter them: http://en.wikipedia.org/wiki/Non-breaking_space
-
@lukelushu your LaTex code – $latex frac{ABC}{CDEF}$ is parsing just fine when I tried to put it in my page.
However, if you are trying to parse something like (double $ sign) –
$latex frac{10}{100} times $100 = $10$this would not get parsed in WP as the have only limited flexibility with Latex typesetting.
- The topic ‘Latex syntax correct, but it not always work.’ is closed to new replies.