| Seth Mueller's blog | |
|---|---|
|
Home Projects Find Me Portfolio All Posts:
|
MathMl: Easy Embedded Math in HTML (No extra libraries, browser supported!)2024-3-31Earlier today I started working on an HTML reference table for common equations used in circuits (maybe a future blog post?), but I needed a good way to format the math expressions. My first thought was to use LaTeX, but I didn't really want to put the time in to learn it. After a bit of googling, I found out about the The MathML standard has been (kind of) supported since the 1990s and, although being a bit annoying to write, it can work in a pinch without adding any new dependencies. The syntax is pretty simple: everything in your equation is in a For example, the equation could be written as:
Although not too useful for simple equations like that, it becomes helpful when working with subscripts, exponents, fractions, square roots, and other strange-looking math things. Here is the capacitive reactance formula written with MathML:
Here, As I quickly learned, MathML can get very tedious to read and write even such short equations. This problem is very common with larger HTML projects of any kind, so it might be a good choice to use something like LaTeX for writing your equations, but MathML has the advantage of not needing to do anything else other than adding to the HTML code which makes it alright for quick and small equations. Side note: One thing I do like about HTML is the character entities. These allow you to write symbols not on your keyboard with the format A complete reference of MathML can be found here. Anyway, I will end this article off with the MathML code for the Quadratic Formula, which took me 4 and a half minutes to write (including googling time).
Comments
Anonymous on 2024-04-07
Oh yeah seth muy intelligente
Post a comment:Please don't spam the comments, I get a notification every time. Also please be mature (Nolan) Message limit: 1500 characters, name limit: 100 characters |