typemill / typemill

Typemill is a lightweight, flat-file CMS designed for simple, fast, and flexible website and eBook creation using Markdown.
https://typemill.net
MIT License
427 stars 60 forks source link

Mathematical content via Mathjax #3

Closed moritzfl closed 4 years ago

moritzfl commented 6 years ago

I think that for some more technical books it would be helpful to enhance the markdown compiler with the ability to handle mathematical expressions via Mathjax

trendschau commented 6 years ago

Thank you, I will have a look into it, but not before september, because I am full of work right now. I think there are some math extensions and libraries for markdown, too.

trendschau commented 6 years ago

I know that it is really late but version 1.1.5 includes a math plugin where you can choose between MathJax or KaTeX. The markdown syntax for math expressions is demonstrated in the documentation and it works pretty similar to codeblocks now:

For inline math use it like this: ``x = \int_{0^1}^1(-b \pm \sqrt{b^2-4ac})/(2a)``

For math blocks use a code block and specify the language as latex:

```latex x = \int_{0^1}^1(-b \pm \sqrt{b^2-4ac})/(2a) ​```

mmtung commented 4 years ago

Hi! I am writing documents externally in Markdown with a high content of math formulas, and then upload to Typemill. For this, I am using the usual $...$ (for inline math) and $$...$$ (for display math). This is also the pandoc standard to include LaTeX into Markdown.

Would it be possible to implement a switch in the math plugin settings to opt for dollar escapes instead? This would avoid additional conversion.

Many thanks! -Mike

trendschau commented 4 years ago

Hi Mike,

thank you for that hint, I will have a look into it. The math plugin was a subject of review anyway, so I will try to change it for the next release that is probably published in the first week of June ...

Cheers Sebastian

mmtung commented 4 years ago

Hi Sebastian, Great news, and thanks for the speedy reply! I'm looking forward to the new release. Best, Mike

trendschau commented 4 years ago

Hi Mike,

Version 1.2.15 is online now, please download and test it. The version supports the following markdown syntax for math:

Inline math:

 Your $inline math$ or \(inline math\) formula 

Display math:

  $$
  your math formula
  $$
  or
  \[
  your math formula
  \]

This is the most widespread syntax I think. The old backtick-syntax is not supported anymore.

Please note that the $inline math$ syntax is only used by pandoc and otherwise deprecated. Typemill converts it in html to \(...\) on the fly so that the katex and mathjax plugins still work without further configuration. I tried to apply the pandoc definition of $syntax$:

The opening $ must have a non-space character immediately to its right, while the closing $ must have a non-space character immediately to its left, and must not be followed immediately by a digit.

Let me know if you find any errors.

Best regards, Sebastian

mmtung commented 4 years ago

Hi Sebastian,

This is awsome! Thank you. I installed the new version and started testing: the new syntax for math works flawlessly! Will do some more thorough testing as I set up my webpage.

It's very good that you maintain the $inline math$ convention used by pandoc. The syntax \(...\) and \[...\] comes from LaTeX. Veteran plain TeXies will appreciate the original $...$ notation for inline math.

BTW, previously I wrote a file e.g. 03-Test.md and put it into the main contents directory. Then it would show up as third item in the menu.---Now one has to create directory 03-Test and add to it index.md (same text as 03-Test.md). In the contents directory files of type 03-Test.md appear to be ignored. Has this changed on purpose?

Keep up the good work! Best, Mike

trendschau commented 4 years ago

Hi Mike,

good to hear!

Regarding the md-files in the root content folder: I had to disable it for now because it caused several bugs in the author-dashboard. I have to refactor it and activate it again, hopefully in the next release...

Best regards Sebastian

mmtung commented 4 years ago

Hi Sebastian,

Thanks for the fast info. There is no hurry, for the time being one can easily use sym-links from the index.md file in the subdir to the previous root md-file.

Best, Mike

trendschau commented 4 years ago

Hi Mike,

I will close this ticket because the math optimiziation is done. The md-files in root-folder is in the roadmap...

Best regards Sebastian

mmtung commented 4 years ago

Dear Sebastian,

Thanks a lot!

Math visualization is working perfectly, and I am using typemill on my departmental (math!) homepage.

Best, Mike

trendschau [notifications@github.com] wrote:

Hi Mike,

I will close this ticket because the math optimiziation is done. The md-files in root-folder is in the roadmap...

Best regards Sebastian

--


Michael M. Tung Email: mtung@mat.upv.es Departamento de Matemática Aplicada
Universidad Politécnica de Valencia Phone: +34 96 38-79557 (IMM) Inst. de Matemática Multidisciplinar +34 96 38-79777 (Teleco) Edificio 8-G, 2º piso IM: ICQ96423950 Camino de Vera, s/n
46022 Valencia (Spain)


PGP PubKey http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x9920E3BA