dokuwiki:syntax:math

差異處

這裏顯示兩個版本的差異處。

連向這個比對檢視

下次修改
前次修改
dokuwiki:syntax:math [2016/06/09 17:28]
ghsrobert 建立
dokuwiki:syntax:math [2020/12/28 11:41] (目前版本)
ghsrobert [測試]
行 1: 行 1:
 ====== 撰寫並顯示數學式 ====== ====== 撰寫並顯示數學式 ======
   * ++mathjax|[[doku>plugin:mathjax]]{{url>https://www.dokuwiki.org/plugin:mathjax}}++   * ++mathjax|[[doku>plugin:mathjax]]{{url>https://www.dokuwiki.org/plugin:mathjax}}++
 +    * ''$...$'' 就可以在行內輸入了
 +      * 如果要輸入正常的金錢符號時,可像之前在 TiddlyWiki 時那樣,用 ''\$'' escape 掉
 +    * 自訂巨集
 +      * 可設定 ''plugin»mathjax»configfile'':<WRAP>
 +> (Optional) One or more files containing MathJax configuration commands. Specify paths relative to the dokuwiki installation directory (e.g. conf/mathjax.js or data/pages/mathjaxconf.txt), and separate multiple files with semicolons.
 +</WRAP>然後即可自訂 command?是類似 TiddlyWiki plugin 的 ''\third''、''\quarter'' 這種嗎?
 +        * ++【補充】|<div>
 +> <div>
 +:?: How to define global shortcuts / new commands?
 +
 +Answer Add data/pages/mathjax.txt in the configuration manager under plugin»mathjax»configfile and then create the page mathjax with something simmilar to:
 +<code javascript>
 +MathJax.Hub.Config({
 + TeX: {
 + Macros: {
 + RR: "{\\bf R}",
 + bold: ["{\\bf #1}",1],
 + Msun: "{\\textrm{M}_{\\odot}}"
 + }
 + }
 +});
 +</code></div>
 +<span right>[[https://www.dokuwiki.org/plugin:mathjax|原文連結]]</span></div>++
 +        * 但<todo>如果有 farm 的話,farmer 的設定檔路徑可以順利讓 animal 吃到嗎?</todo>
 +      * /^20160914^/ 且慢,是不是也可以直接在 ''plugin»mathjax»config'' 的 textarea 裡設定就好了呢?
 +        * 如果可以這樣設的話,就可以跨 farmer/animal 了
 +        * 不過我現在還不太確定怎樣把 MathJax macro 寫成 JSON 表示式啊,只有 ++TiddlyWiki 時代的 macro 設定可以參考|<code>
 +\def\half{\frac{1}{2}}
 +\def\third{\frac{1}{3}}
 +\def\quarter{\frac{1}{4}
 +</code>++
 +        * → Okay 寫了這樣的東西<code javascript>
 +MathJax.Hub.Config({
 +    tex2jax: {
 +        inlineMath: [ ["$","$"], ["\\(","\\)"] ],
 +        displayMath: [ ["$$","$$"], ["\\[","\\]"] ],
 +        processEscapes: true
 +    },
 +    TeX: {
 +        Macros: {
 +            half: "{\\frac{1}{2}}",
 +            third: "{\\frac{1}{3}}",
 +            quarter: "{\\frac{1}{4}"
 +        }
 +    }
 +});
 +</code>(切記標點符號那些不能錯漏啊~)→ <span tip>成功了</span>
   * 其他 plugin 大概不用試了,都老了廢了 <<==>>   * 其他 plugin 大概不用試了,都老了廢了 <<==>>
 +  * /^20190327^/ 最近發現有 [[doku>plugin:mathpublish|mathpublish]] 耶,據說完全透過 PHP 執行。這樣會有個好處:不像 MathJax 依賴 CDN,這樣就算裝置離線,只在 localhost 上,也可以直接顯示?
 +    * 先 check 所需 PHP 模組是否有在我的 MAMP 上 ☞ http://localhost/MAMP/index.php?page=phpinfo&language=English\\ 嗯,都有
 +    * 不過數學語法完全不同~
 +      * 哇,蠻簡單的樣子,像分數就只要 ''%%<m>x/y</m>%%''!☞ ++PhpMathPublisher : Help|[[http://www.mylovewill.com/ya/phpmathpublisher/doc/help.html|PhpMathPublisher : Help]] {{url>http://www.mylovewill.com/ya/phpmathpublisher/doc/help.html ,700px}}++
 +    * 而且預設字型大小好像是絕對的,而非相對於行列文字大小
 +    * /-也不知道能否設定巨集!-/← 如果語法簡單、方便輸入分數的話,可能就不需要巨集了
 +
 +===== 測試 =====
 +  * mathjax
 +    *  $ \frac{1}{10} $ 奉獻
 +    *  一般的金錢符號?$1000 元
 +    * %%`1/3`%%
 +    * `1/3`
 +    * \(\third\)
 +    * `sum_(i=1)^n i^3=((n(n+1))/2)^2`
 +$$
 +\frac{1}{10}
 +sum_(i=1)^n i^3=((n(n+1))/2)^2
 +$$
 +  * mathpublish
 +    *  <m>1/3</m> ← 有點醜 XD 不像 MathJax 那麼好看;圖片解析度太差了啦 :s
 +
 +糟糕,上 Hogfather 以後,mathpublish 的數學式變成 404 了,/-mathjax 也不知為何出不來了-/
 +mathjax 還可以,但要使用正確的 config URL
  • 上一次變更: 2016/06/09 17:28
  • ghsrobert