在Mac OS X下搭建Latex編輯環境

在這裏分享一下如何在Mac下搭建Latex編輯環境的方法

首先當然是Google Mac Latex尋找已有的Blog教程,然後發現Mac上常用Sublime Text來編輯,因此搜索Mac sublime Latex,就找到了以下兩個網頁:
這裏寫圖片描述
http://www.readern.com/sublime-text-latex-chinese-under-mac.html

http://economistry.com/2013/01/installing-and-using-latex-for-mac/

那麼搭建方法基本就在這裏面了。

我的環境是 Mac OS X Yosemite 10.10 ,Xcode 6.1

總結一下我的搭建方法:

Step 1:下載MacTex 我最終還是使用了完整的包 http://tug.org/mactex/

Step 2:下載Sublime Text 3 Beta http://www.sublimetext.com/3

Step 3:下載安裝Skim http://skim-app.sourceforge.net

Step 4:在Sublime Text中安裝Package Control https://sublime.wbond.net/installation
這裏寫圖片描述
方法很簡單,打開Sublime Text 3, 按Ctrl+` 打開控制檯,copy上面的python代碼粘貼上去運行,就可以完成安裝

Step 5:在Sublime Text中安裝LatexTools

在Sublime Text裏Command+Shift+P調出命令窗口,輸入Install,之後選擇LaTexTools,完成安裝:
這裏寫圖片描述
Step 6:在Sublime Text 中配置LaTexTools,如上圖爲安裝好的情況,點擊Reconfigure and migrate settings 完成重新配置

Step 7:Skim同步配置

點擊Skim-》選項
這裏寫圖片描述
在命令中輸入:/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl

參數如上輸入:”%file”:%line

Step 8: 修改編譯和中文環境

這一步完全參考上面列的網頁的方法,
這裏寫圖片描述
點擊Browse Package,然後

打開編輯~/Library/Application\ Support/Sublime\ Text/Packages/Users/LaTeX.sublime-settings,將其中”builder”條目改爲:
“builder”: “simple”
接着打開編輯~/Library/Application\ Support/Sublime\ Text/Packages/LaTeXTools/builders/simpleBuilder.py
找到其中大概第41行
pdflatex = [“pdflatex”, “-interaction=nonstopmode”, “-synctex=1″]
修改爲
pdflatex = [“xelatex”, “-interaction=nonstopmode”, “-synctex=1″]
保存後關閉,重新編譯一下,中文正常啦!

OK,經過上面的步驟,整個Latex環境就搭建完畢了,下面做個測試:

在Sublime Text 輸入如下代碼:

\documentclass{article}

\usepackage{fontspec, xunicode, xltxtra}

\setmainfont{Hiragino Sans GB}

\title{Title}

\author{}

\begin{document}

\maketitle{}

\section{Introduction}

This is where you will write your content. 在這裏寫上內容。

\end{document}

保存後按 Command+B 編譯,Skim直接顯示:
這裏寫圖片描述

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章