HTML/CSS/JavaScript LaTeX algorithm for word spacing - javascript

I would like to know if there is a way to integrate the LaTeX word spacing algorithm in a website? I'm not talking about equations.
To better illustrate what I mean, look at thr picture. Above is a normal justify and below is a valuable word spacing with LaTeX.
justify vs. LaTeX
Any ideas?

Yes, there is, using JavaScript: https://github.com/bramstein/typeset
Whether you want to use it in production is a different question.

Related

Animated mathematics formulae in JavaScript

so basically I want to show mathematical formulae etc. dynamically as an explanation tool on a little static website.
For example: have a matrix and a slider and animate the content of that matrix to contain the slider value plus the resulting determinant. (Basically I want to do stuff like 3b1b, but in a browser;)
I have already tinkered with the idea and tried to do first tests with MathJax, but its dynamic rendering capabilities are (as of my experience) severely limited.
Also I've failed to find a library specifically designed for this (most Maths libraries are focused on showing graphs and stuff, not maths text).
If anyone has an idea on how to (easily, I'm not a huge JS expert, sadly) implement this, I would be happy to hear it ;)

Is there a javascript library for displaying formulas

Are there any javascript libraries for displaying formulas that allow javascript events and styling to be added to parts of the formula?
If is mathematical formulas what you are asking for you might want to take a look at: https://www.mathjax.org/

Is there any way to re-use CSS3 created word hyphenation?

I'm trying to split words into syllables on a website that helps kids learn to read. This turns out to be hard.
JavaScript Hyphenation libraries are large. Chrome browser can already auto-hyphenate using the hyphens: auto; CSS3 tag. I'd like to say to my line of text in the browser "Hi there! Please tell me all possible ways you would consider splitting these words, thanks!"
Which means I would need to somehow "read" the results of hyphenated words packed into very narrow divs. AFAIK you can't grab the text - hyphenation is only a display thing. Is there any way to figure out where the words were hyphenated?
https://jsfiddle.net/8v5xxuh1/
Short answer: no, there is no easy way to piggyback on the browser's hyphen generator.

Is it possible to use web development tools and create an actual working WYSIWYM math editor, like desktop Applications such as MathType?

Before I started to try and make this thing, I wanted to know if it is possible, under the following circumstances:
The code to script up that math must be able to be taken, submitted and stored in a database
The code for two pieces of math which look exactly the same must have the exact same code
According to the requirements, wherever the user clicks his or her mouse, the caret must move to that specific element or part of the math
So, is it possible? I'm looking forward to using technologies such as HTML, JavaScript, jQuery, and even Flash as a last resort.
MathQuill lets you type maths in a WYSIWYG fashion, source here.
There is a demo on the homepage.
I think you want something like MathML. Take a look here. http://www.w3.org/Math/
or maybe http://code.google.com/p/mathmleditor/
I found this a while ago http://www.codecogs.com/latex/eqneditor.php pretty useful implementation of LaTeX with a live preview, I've used it a few times. Probably doesn't fit the bill for your point 3 either but just in case it is useful.

Chinese characters encoding

I'm working on a multi-language website. I have a problem with the color of the Chinese characters. My text color is #333333 but the Chinese characters appear darker than the occidental chars. My content comes from a database.
I thought to do it with Javascript / jQuery. The script detects the Unicode from the paragraph with the .fromCharCode() function. But what I read was that function expects an integer and the Unicode for Chinese chars are not integers. And that should be the reason my function is not working.
EDIT
Here's an image from what I got:
My function to check for the Unicode:
if($('#container p').fromCharCode(4E00)){
alert('Chinese');
}
Any help?
The screenshot suggests that different characters have been taken from different fonts. This often happens when the primary font does not contain all the relevant characters. So the odds are that you are trying to solve the wrong problem. Perhaps you should just consider making a font suggestion that is suitable for all the characters that will appear in the content.
The code snippet is in error in several ways. For example, 4E00 should be 0x4E00. And even that way, you would check for a single character only.
You need to post the full code, or a URL, or both, to get more constructive help.
Your problem is that you are displaying Simplified Chinese in a font that was designed for Traditional Chinese. So when the display engine hits a character that's Simplified (and thus not in the Traditional font), it takes the default simplified font and uses that instead. Then it reverses back to the Traditional font. Hence the unseemly look.
You need to look into what would be the most common Simplified Chinese font (or font family) and use that specifically for Simplified Chinese texts. Something like Heiti TC and Heiti SC.

Categories

Resources