TeX implementation on Windows: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
| Line 10: | Line 10: | ||
=== 將<math></math>標籤內的Tex語法, 轉成 .tex檔案 === | === 將<math></math>標籤內的Tex語法, 轉成 .tex檔案 === | ||
需要Math. | 需要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],儲存於{MediaWiki} (與LocalSettings.php所在的相同目錄) | |||
=== 將 .tex檔 轉成 .dvi檔 === | === 將 .tex檔 轉成 .dvi檔 === | ||
| Line 74: | Line 75: | ||
<pre> | <pre> | ||
$wgUseTeX = true; | $wgUseTeX = true; | ||
$wgTexvc = " | $wgTexvc = "texvc"; | ||
$wgUploadPath = "{$wgScriptPath}/images"; | $wgUploadPath = "{$wgScriptPath}/images"; | ||
Revision as of 19:35, 29 July 2007
如何啟用數學表示
可以辨識 <math></math>標籤內的Tex語法
在LocalSettings.php啟用Tex
$wgUseTeX = true;
將<math></math>標籤內的Tex語法, 轉成 .tex檔案
需要Math.php與texvc
- 將{MediaWiki}/includes/Math.php 替換成這個Math.php,否則會出現「解析失敗 (未知錯誤) 」訊息
- 下載texvc.exe,儲存於{MediaWiki} (與LocalSettings.php所在的相同目錄)
將 .tex檔 轉成 .dvi檔
需要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;
- LocalSettings.php的$wgLaTexCommand可以改成
$wgLaTexCommand = 'latex';
將 .dvi檔 轉成 .ps檔
需要dvips
- 安裝MiKTeX (C:/Program Files/MiKTeX 2.6/miktex/bin/dvips.exe)
- LocalSettings.php加上
$wgDvipsCommand = 'dvips';
將 .ps檔 轉成 .png檔
需要ImageMagick與Ghostscript
ImageMagick
- 安裝ImageMagick(直接下載ImageMagick-6.3.4-5-Q16-windows-dll.exe) 安裝在c\usr\bin
- 取得convert, identify兩支程式
- LocalSettings.php加上
$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
安裝Ghostscript(直接下載gs856w32.exe)
- C:\Program Files\gs\gs8.56\bin\gswin32c.exe 更名為gs.exe
- 檢查系統變數PATH有無加上 C:\Program Files\gs\gs8.56\bin\;
測試已經安裝的程式
- 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語法
<math>(\frac{x^5}{y^7})</math>
- 我的LocalSettings.php設定
$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';
