TeX implementation on Windows: Difference between revisions
Jump to navigation
Jump to search
m (Text replacement - "http://planetoid.info/images/" to "https://planetoid.info/images/") |
|||
| (9 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
{{Template:MediaWiki Installation}} | {{Template:MediaWiki Installation}} | ||
[[MediaWiki]]的數學套件,經由Tex語法顯示數學式。 (替代方案: 使用線上服務產生數學式圖形 [http://www.mediawiki.org/wiki/LaTeX_on_a_shared_host LaTeX on a shared host]) | |||
== 如何啟用數學表示 == | == 如何啟用數學表示 == | ||
| Line 7: | Line 9: | ||
* MySQL: 5.0.41-community-nt | * MySQL: 5.0.41-community-nt | ||
* OS: MS Windows XP}} | * OS: MS Windows XP}} | ||
=== 可以辨識 <math></math>標籤內的Tex語法 === | === 可以辨識 <math></math>標籤內的Tex語法 === | ||
在LocalSettings.php啟用Tex | 在LocalSettings.php啟用Tex | ||
| Line 17: | Line 20: | ||
需要Math.php與texvc | 需要Math.php與texvc | ||
* 將{MediaWiki}/includes/Math.php 替換成這個[http://www.mediawiki.org/wiki/Manual:Running_MediaWiki_on_Windows/math.php Math.php],否則會出現「解析失敗 (未知錯誤) 」訊息 | * 將{MediaWiki}/includes/Math.php 替換成這個[http://www.mediawiki.org/wiki/Manual:Running_MediaWiki_on_Windows/math.php Math.php],否則會出現「解析失敗 (未知錯誤) 」訊息 | ||
* 下載[https://wfs.gc.cuny.edu/MCarlisle/www/texvc_win32bin_20050202.zip texvc.exe]([http:// | * 下載[https://wfs.gc.cuny.edu/MCarlisle/www/texvc_win32bin_20050202.zip texvc.exe]([http://www.box.net/shared/rxoijj92cl mirrors]),儲存於{MediaWiki} (與LocalSettings.php所在的相同目錄) | ||
=== 將 .tex檔 轉成 .dvi檔 === | === 將 .tex檔 轉成 .dvi檔 === | ||
| Line 41: | Line 44: | ||
$wgImageMagickConvertCommand = "/usr/bin/convert"; | $wgImageMagickConvertCommand = "/usr/bin/convert"; | ||
$wgImageMagickIdentifyCommand = '/usr/bin/identify'; </pre> | $wgImageMagickIdentifyCommand = '/usr/bin/identify'; </pre> | ||
* 如果要將c\usr\bin加在系統變數PATH, 需將convert.exe更名成imageconvert.exe, 避免與Windows內建的convert.exe (fat32 轉成 ntfs; 位於C:\WINDOWS\system32\convert.exe)衝突。 | * ''(選擇性)'' 如果要將c\usr\bin加在系統變數PATH, 需將convert.exe更名成imageconvert.exe, 避免與Windows內建的convert.exe (fat32 轉成 ntfs; 位於C:\WINDOWS\system32\convert.exe)衝突。 | ||
==== Ghostscript ==== | ==== Ghostscript ==== | ||
| Line 77: | Line 80: | ||
<math>(\frac{x^5}{y^7})</math> | <math>(\frac{x^5}{y^7})</math> | ||
</pre> | </pre> | ||
: | : https://planetoid.info/images/mediawiki_math.gif | ||
| Line 100: | Line 103: | ||
== 參考資料 == | == 參考資料 == | ||
* [http://www.mediawiki.org/wiki/Manual:Running_MediaWiki_on_Windows#Mathematics_Support Manual:Running MediaWiki on Windows - MediaWiki] | * [http://www.mediawiki.org/wiki/Manual:Running_MediaWiki_on_Windows#Mathematics_Support Manual:Running MediaWiki on Windows / Mathematics Support - MediaWiki] | ||
* [http://www.votapedia.com/index.php?title=Supporting_math_in_MediaWiki1.7_on_Windows_2003_and_IIS6 Supporting math in MediaWiki1.7 on Windows 2003 and IIS6] | * [http://www.votapedia.com/index.php?title=Supporting_math_in_MediaWiki1.7_on_Windows_2003_and_IIS6 Supporting math in MediaWiki1.7 on Windows 2003 and IIS6] | ||
* [http://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/math/README?view=markup (mediawiki) View of /trunk/phase3/math/README] | * [http://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/math/README?view=markup (mediawiki) View of /trunk/phase3/math/README] | ||
* [http://www.google.com.tw/search?q=%5B%E5%95%8F%E9%A1%8C%5D+MediaWiki+%E4%B8%8B%E7%9A%84+Latex&sourceid=navclient-ff&ie=UTF-8&rls=GGGL,GGGL:2006-27,GGGL:zh-TW&aq=t (問題) MediaWiki 下的 Latex - Google 搜尋] (Thanks, kornelius!) | * [http://www.google.com.tw/search?q=%5B%E5%95%8F%E9%A1%8C%5D+MediaWiki+%E4%B8%8B%E7%9A%84+Latex&sourceid=navclient-ff&ie=UTF-8&rls=GGGL,GGGL:2006-27,GGGL:zh-TW&aq=t (問題) MediaWiki 下的 Latex - Google 搜尋] (Thanks, kornelius!) | ||
* [http://wiki.hoebus.idv.tw/index.php/%E6%95%B8%E5%AD%B8%E5%85%AC%E5%BC%8F 數學公式 - HoebusWiki] for Gentoo Linux http://favico.collection.googlepages.com/gentoo.org.favicon.png (Thanks, Hoebus!) | |||
* [http://en.wikibooks.org/wiki/LaTeX LaTeX - Wikibooks, collection of open-content textbooks] | * [http://en.wikibooks.org/wiki/LaTeX LaTeX - Wikibooks, collection of open-content textbooks] | ||
* [http://wuyy.idv.tw/dokuwiki/doku.php?id=research:latex LaTex 相關網路資源] | * [http://wuyy.idv.tw/dokuwiki/doku.php?id=research:latex LaTex 相關網路資源] | ||
* [http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Editing_mathematical_formulae Help:Displaying a formula - Meta] {{access | date = 2011-02-22}} | |||
[[Category:MediaWiki]] | [[Category:MediaWiki]] | ||
Latest revision as of 19:31, 26 February 2022
MediaWiki的數學套件,經由Tex語法顯示數學式。 (替代方案: 使用線上服務產生數學式圖形 LaTeX on a shared host)
如何啟用數學表示[edit]
|
可以辨識 <math></math>標籤內的Tex語法[edit]
在LocalSettings.php啟用Tex
$wgUseTeX = true;
將<math></math>標籤內的Tex語法, 轉成 .tex檔案[edit]
需要Math.php與texvc
- 將{MediaWiki}/includes/Math.php 替換成這個Math.php,否則會出現「解析失敗 (未知錯誤) 」訊息
- 下載texvc.exe(mirrors),儲存於{MediaWiki} (與LocalSettings.php所在的相同目錄)
將 .tex檔 轉成 .dvi檔[edit]
需要latex
- 需要安裝MiKTeX (直接下載Basic MiKTeX 2.6 Installer)
- 安裝後, LocalSettings.php 加上
$wgLaTexCommand = 'C:/Program Files/MiKTeX 2.6/miktex/bin/latex.exe';
- 安裝完系統變數PATH會自動加上 C:\Program Files\MiKTeX 2.6\miktex\bin; (如何設定系統PATH)
- LocalSettings.php的$wgLaTexCommand可以改成
$wgLaTexCommand = 'latex';
將 .dvi檔 轉成 .ps檔[edit]
需要dvips
- 安裝MiKTeX (C:/Program Files/MiKTeX 2.6/miktex/bin/dvips.exe)
- LocalSettings.php加上
$wgDvipsCommand = 'dvips';
將 .ps檔 轉成 .png檔[edit]
需要ImageMagick與Ghostscript
ImageMagick[edit]
安裝ImageMagick(直接下載ImageMagick-6.3.4-5-Q16-windows-dll.exe) 安裝在c\usr\bin
$wgUseImageMagick = true; $wgImageMagickConvertCommand = "/usr/bin/convert"; $wgImageMagickIdentifyCommand = '/usr/bin/identify';
- (選擇性) 如果要將c\usr\bin加在系統變數PATH, 需將convert.exe更名成imageconvert.exe, 避免與Windows內建的convert.exe (fat32 轉成 ntfs; 位於C:\WINDOWS\system32\convert.exe)衝突。
Ghostscript[edit]
安裝Ghostscript(直接下載gs856w32.exe)
- C:\Program Files\gs\gs8.56\bin\gswin32c.exe 更名為gs.exe
- 檢查系統變數PATH有無加上 C:\Program Files\gs\gs8.56\bin\;
重新開機[edit]
安裝完程式, 還需要重開機, 啟用系統變數PATH
測試已經安裝的程式[edit]
- test.bat修改成
latex test.tex dvips test.dvi -o test.ps c:\usr\bin\convert -density 120 -trim -transparent #FFFFFF test.ps test.png
- 從Testing latex, dvips and convert取得test.tex
\documentclass{article}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\pagestyle{empty}
\begin{document}
2 + 2 * 2 = 6
\end{document}
- 然後執行test.bat,檢查是否有順利產生圖檔
在wiki頁面輸入tex語法[edit]
<math>(\frac{x^5}{y^7})</math>
LocalSettings.php設定[edit]
$wgUseTeX = true;
$wgTexvc = "texvc";
$wgUploadPath = "{$wgScriptPath}/images";
#Where is your ImageMagick
$wgUseImageMagick = true;
$wgImageMagickConvertCommand = "/usr/bin/convert";
$wgImageMagickIdentifyCommand = '/usr/bin/identify';
#Where is your Tex
$wgLaTexCommand = "latex";
$wgDvipsCommand = "dvips";
參考資料[edit]
- Manual:Running MediaWiki on Windows / Mathematics Support - MediaWiki
- Supporting math in MediaWiki1.7 on Windows 2003 and IIS6
- (mediawiki) View of /trunk/phase3/math/README
- (問題) MediaWiki 下的 Latex - Google 搜尋 (Thanks, kornelius!)
- 數學公式 - HoebusWiki for Gentoo Linux
(Thanks, Hoebus!) - LaTeX - Wikibooks, collection of open-content textbooks
- LaTex 相關網路資源
- Help:Displaying a formula - Meta [Last visited: 2011-02-22]
