1.首先安装mactex http://blog.csdn.net/wdkirchhoff/article/details/41704027,俩个多G,下个迅雷 for mac慢慢载吧
2.下个auctex的安装包 http://www.gnu.org/software/auctex/
然后用终端进入其解压后的文件夹
运行
C++
./configure --with-emacs=/Applications/Emacs.app/Contents/MacOS/Emacs --with-lispdir=/Applications/Emacs.app/Contents/Resources/site-lisp --with-texmf-dir=/usr/local/texlive/texmf-local
1
./configure--with-emacs=/Applications/Emacs.app/Contents/MacOS/Emacs--with-lispdir=/Applications/Emacs.app/Contents/Resources/site-lisp--with-texmf-dir=/usr/local/texlive/texmf-local
运行
make; sudo make install
1
make;sudomakeinstall
将以下内容加入.emacs
(setenv "PATH" (concat "/usr/texbin:/usr/local/bin:" (getenv "PATH")))
(setq exec-path (append '("/usr/texbin" "/usr/local/bin") exec-path))
(load "auctex.el" nil t t)
(load "preview-latex.el" nil t t)
1
2
3
4
(setenv"PATH"(concat"/usr/texbin:/usr/local/bin:"(getenv"PATH")))
(setqexec-path(append'("/usr/texbin""/usr/local/bin")exec-path))
(load"auctex.el"niltt)
(load"preview-latex.el"niltt)
然后就完成了。。。
噢对了要说下中文的问题
建议进入TeXShop -> Preferences -> Source,找到Encoding下拉菜单栏,将编码格式选为Unicode(UTF-8)。
虽然后面在LaTeX源码中会有专门命令指定这个编码,但那里是设置编译时使用的格式,而“偏好设置”中的Encoding好像是设置保存时的编码格式。这有益于各平台间良好的通用性。
下面提供一种方法
(原作者:成彦)
此法是在TeXShop中指定使用XeLaTeX来做TypeSet。XeLaTeX似乎是集成在了TeXShop中的,至少我测试时并没有另外安装XeLaTeX。
源码示例:
C++
%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode
\documentclass[12pt]{article}
\usepackage{geometry}
\geometry{letterpaper}
\usepackage{fontspec,xltxtra,xunicode}
\defaultfontfeatures{Mapping=tex-text}
\setromanfont{SimSun} %设置中文字体
\XeTeXlinebreaklocale “zh”
\XeTeXlinebreakskip = 0pt plus 1pt minus 0.1pt %文章内中文自动换行
\newfontfamily{\H}{SimHei}
\newfontfamily{\E}{Arial} %设定新的字体快捷命令
\title{\H 算法设计}
\author{Donald}
\date{\E\today}
\begin{document}
\maketitle
这个段落中,夹杂着一个{\E word}。
\end{document}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
%!TEXTS-program=xelatex
%!TEXencoding=UTF-8Unicode
\documentclass[12pt]{article}
\usepackage{geometry}
\geometry{letterpaper}
\usepackage{fontspec,xltxtra,xunicode}
\defaultfontfeatures{Mapping=tex-text}
\setromanfont{SimSun}%设置中文字体
\XeTeXlinebreaklocale“zh”
\XeTeXlinebreakskip=0ptplus1ptminus0.1pt%文章内中文自动换行
\newfontfamily{\H}{SimHei}
\newfontfamily{\E}{Arial}%设定新的字体快捷命令
\title{\H算法设计}
\author{Donald}
\date{\E\today}
\begin{document}
\maketitle
这个段落中,夹杂着一个{\Eword}。
\end{document}
使用XeLaTeX的一个不足就是,如果使用的中文和英文字体不同,则在中英文夹杂的段落中,需要不停地来指定字体,才能保证使用的是同一种英文字体。原文作者使用的方法是命名一个新的字体命令:
\newfontfamily{\E}{Arial}
后面要使用该字体时,只需如:
{\E word}
顺便提一下
wordpress上加个latex for wordpress就能显示数学公式了
唉可惜wordpress不能完全支持latex,百度盘传pdf又麻烦。。。
其实感觉直接调用.mathjax比较好。。。
本站footer.php加入了
C++
MathJax.Hub.Config({
TeX: {
extensions: ["autobold.js"],
} ,
displayAlign: "left"
});
.MathJax_Display { text-align: left !important; margin: 0em 0em;}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
MathJax.Hub.Config({
TeX:{
extensions:["autobold.js"],
},
displayAlign:"left"
});
.MathJax_Display{text-align:left!important;margin:0em0em;}