<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
 <channel>
  <title>无题</title>
  <link>http://cohomo.blogbus.com</link>
  <description><![CDATA[CoHoMo]]></description>
  <generator> by blogbus.com </generator>
  <lastBuildDate>Sat, 07 Apr 2012 10:07:07 +0800</lastBuildDate>
  <image>
									<url>http://public.blogbus.com/profile/2/0/0/1322002/avatar_1322002_96.jpg</url>
									<title>无题</title>
									<link>http://cohomo.blogbus.com</link>
								</image>  <item>
   <title>LaTeX之新版Office的公式排版</title>
   <description><![CDATA[<p>微软的 Office 软件从 2007 版本开始使用新的文档格式（docx，pptx 等），从此 Word 里面对公式的支持摆脱了残废状态，使得在 Word 中不借助 MathType 和 Aurora&nbsp;等插件输入复杂数学公式成为可能。而且，微软还特地为公式的排版定制了一个数学字体 Cambria Math，再加上在公式的输入中可以使用许多 LaTeX 命令，因此用微软 Word 快捷地排版美观的公式不再是天方夜谭。</p>
<p>这里介绍下在新版 Word 中输入公式的方法。使用键盘快捷键&ldquo;Alt+=&rdquo;或者在插入菜单中选择&ldquo;公式&rdquo;项均可插入一个新的数学公式。首先需要说明的就是，新版 Word 中的公式和 LaTeX 中类似，可以有行间公式和独立公式两种，两种公式在显示上有一些区别（比如独立公式一般自动居中）。和 LaTeX 中不同的是，在 Word 中一个公式属于哪种类型的是由该行是否有其它内容自动决定的。也就是说，你在某些文字后面直接按&ldquo;Alt+=&rdquo;将得到行间公式，而新起一行后再按&ldquo;Alt+=&rdquo;则得到自动居中的独立公式。这点还是 Word 更加容易使用一点。</p>
<p>在 Word 公式里面大部分常用 LaTeX 命令均可使用，比如输入 \infty 再按空格就得到个无穷号，输入 \sqrt 再按空格就得到个根号，输入&nbsp;\int_a^b&nbsp;再按空格就会得到个定积分。在 LaTeX 和在 Word 中数学公式的输入方式主要有如下两个区别：一是分式的输入方式不同，在 Word 中用更自然的方式来输入分式；比如在 LaTeX 里面需要输入 \frac{a+b}{c}， 而在 Word 中只需要输入 (a+b)/c 再按空格就出来了。二是命令参数的括号不同，LaTeX 使用花括号｛｝而 Word 使用圆括号（）；比如在 LaTeX 中输入 \sum_{k=0}^{n_1}，而在 Word 中输入 \sum_(k=0)^(n_1)。其它各种命令及用法可以看微软程序员写的这个<a href="http://www.unicode.org/notes/tn28/" target="_blank">说明文档</a>（<a href="http://www.unicode.org/notes/tn28/UTN28-PlainTextMath-v3.pdf" target="_blank">pdf</a>）。</p><!--sp--><br /><br /><div class="sysmsg"><b><a href="http://www.blogbus.com" target="_blank">博客大巴，你的个人传媒早班车</a></b></div><br /><br />]]></description>
   <link>http://cohomo.blogbus.com/logs/65816224.html</link>
   <author>cohomo</author>
   <pubDate>Sat, 12 Jun 2010 10:41:10 +0800</pubDate>
  </item>
  <item>
   <title>LaTeX之在网页中显示数学公式</title>
   <description><![CDATA[<p>要在网页中显示 tex 公式可以使用 <a href="http://www.math.union.edu/~dpvc/jsMath/" target="_blank">jsMath</a>

 或者 <a href="http://www1.chapman.edu/~jipsen/mathml/asciimath.html" target="_blank">ASCIIMathML</a>

。两者都是使用 JavaScript 语言来转换网页中包含的 tex 公式。jsMath 将数学公式用 tex 算法直接显示出来，在几乎所有浏览器中都能直接显示，但是 jsMath 包含了许多文件，在博客中不好添加进来。而 ASCIIMathML 将数学公式转换为 MathML 公式再丢给浏览器显示，在 IE 和 Chrome 中没法显示（IE 安装了 mathplayer 后可以显示 MathML 公式），但在 Firefox 中可以正常显示。估计迟早 IE 和 Chrome 会支持 MathML 公式，因此在这个博客中选择用 ASCIIMathML 来显示公式。</p>
<p>在这个博客中添加 ASCIIMathML 支持很容易，首先到<a href="http://www1.chapman.edu/~jipsen/mathml/asciimath.html" target="_blank">这里</a>

下载  ASCIIMathML.js 文件并上传到博客文件夹中，然后修改博客模板，在 head 代码模块中添加如下语句：</p>
<p><strong>&lt;script src=&quot;http://xxxx.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;</strong>
</p>
<p>其中 http://xxxx.js 指的是 ASCIIMathML.js 文件上传后的实际地址。然后在 Firefox 中打开博客就可以看到所有用 $ 或者 $$ 包含的 tex 公式已经漂亮地显示出来了。</p>
<p>ASCIIMathML.js 文件是可以修改以适合自己的需要的。我作了一些修改：</p>
<p><strong>var mathcolor = &quot;&quot;;&nbsp; // 公式颜色。默认值为 &quot;blue&quot;，设为空表示使用文本颜色<br />

var mathfontfamily = &quot;Times New Roman&quot; // 改用好看的的公式字体<br />

var translateLaTeX = false; // 博客中需要介绍 latex，故禁用 </strong>

<strong>$ 和 $$ 的识别</strong>

 <strong><br />

var translateASCIIMath = true; // 博客中使用特殊的重音符</strong>

<strong>\`</strong>

<strong>来标示公式<br />

</strong>

</p>
<p>其中，ASCIIMathML 添加了使用重音符（\`）来标示公式的方法，重音符就是键盘上 1 左边的那个字符。这样，以后需要直接显示 tex 
代码的公式还是用 $ 和 $$ 来标示，而需要处理再显示的公式就用 \` 来标示。例如下面的公式：
</p>
<p style="text-align: center;">`e^x=\sum_{n=0}^\infty\frac{x^n}{n!}`</p>
<p>显示了指数函数的幂级数展开式。</p>
<p>【更新】jsMath 现在有了继任者 <a href="http://www.mathjax.org" target="_blank">MathJax</a>

。MathJax 是美国数学会等组织和公司资助的项目，在 jsMath 的基础上开发。MathJax 同时支持 latex 和 mathml 公式的排版，也同时支持用 html+css 和 mathml 输出排版结果。和 jsMath 一样，MathJax 的代码也是由许多部分组成的，在博客上不方便直接使用，不过它提供了 CDN 供用户使用，只需要在博客模板中添加如下几行代码就可以了，详情请看<a href="http://www.mathjax.org/docs/1.1/start.html" target="_blank">官方文档</a>

的介绍。<strong>
</strong>

</p><!--sp--><br /><br /><div class="sysmsg"><b><a href="http://www.blogbus.com" target="_blank">博客大巴，你的个人传媒早班车</a></b></div><br /><br />]]></description>
   <link>http://cohomo.blogbus.com/logs/64621523.html</link>
   <author>cohomo</author>
   <pubDate>Sat, 29 May 2010 19:13:00 +0800</pubDate>
  </item>
  <item>
   <title>LaTeX之画图语言和画图软件</title>
   <description><![CDATA[<p>LaTeX 中的矢量画图语言有 metpost、asymptote 和 pgf/tikz。用这些语言作图，首先得按照它们提供的命令写一个文件，然后编译才得到图形。</p>
<p><a href="http://www.tug.org/metapost.html" target="_blank">metapost</a>：从 metafont 演化而来的，历史悠久。文件后缀为 .mp，用 mpost.exe 编译得到图片。</p>
<p><a href="http://asymptote.sourceforge.net/" target="_blank">asymptote</a>：新兴的作图语言，类似于 C 语言的语法。文件后缀为 .asy，用 asy.exe 编译得到图片。</p>
<p><a href="http://pgf.sourceforge.net/" target="_blank">pgf/tikz</a>：beamer 包作者的另一作品，与前两者的区别在于它可以直接在 tex 文件中编写，然后用 pdftex 编译。</p>
<p>LaTeX 中的矢量画图软件包括 TpX、Ipe 和 Inkscape，画图软件相对于画图语言来说更加简单直观，但是功能上会有所限制。</p>
<p><a href="http://tpx.sourceforge.net/" target="_blank">TpX</a>：用 Delphi 编写，简单小巧。输出的结果是一个形如 abc.TpX 文件和一些图片，只要 input{abc.TpX} 即可。</p>
<p><a href="http://tclab.kaist.ac.kr/ipe/" target="_blank">Ipe</a>：用 Qt 库编写，强大且支持扩展。输出结果是各种格式（包括 eps 和 pdf）的图片。</p>
<p><a href="http://www.inkscape.org/" target="_blank">Inkscape</a>：用 Gtk+ 编写，非常强大，可以输出为 svg 文件，可惜 Gtk+ 编写的程序在 Windows 下不好用。</p><!--sp--><br /><br /><div class="sysmsg"><b><a href="http://www.blogbus.com" target="_blank">博客大巴，你的个人传媒早班车</a></b></div><br /><br />]]></description>
   <link>http://cohomo.blogbus.com/logs/39280180.html</link>
   <author>cohomo</author>
   <pubDate>Tue, 12 May 2009 11:33:54 +0800</pubDate>
  </item>
  <item>
   <title>LaTeX之字体类型与文档格式</title>
   <description><![CDATA[<p>大家都说 Word 容易入门很难深入，而 TeX 的入门和深入都不容易。TeX/LaTeX 的复杂有一个原因在于它的名目繁多的字体类型和文档格式。这篇日志将总结下这两方面的问题。</p><p>首先是字体类型。LaTeX 中遇到的字体类型至少有 pk，metafont，type1，truetype 和 opentype 等等。pk 字体是点阵字体（在 pdf 文件中被视为 type3 字体），它可由 metafont 和 truetype 等矢量字体生成。type1 和 opentype 也是矢量字体，这四种矢量字体依出现的先后依次为 metafont，type1，truetype 和 opentype。（严格说来每个 metafont 和 type1 字体都由两个文件组成，这里不详叙。）</p><p>mktexpk 程序可从metafont 字体生成 pk 字体，ttf2pk 程序可以从 ttf 字体生成 pk 字体，而 ttf2pfb 和 ttf2pt1 程序可以从 ttf 字体生成 type1 字体。&nbsp; </p><p>其次是文档格式。LaTeX 中遇到的文档格式至少有 tex，dvi，ps 和 pdf。用 latex 程序可将 tex 文档编译为 dvi 文档，然后用 dvips 程序可以将 dvi 文档转换为 ps 文档，最后用 ps2pdf 程序可以将 ps 文档转换为 pdf 文档。</p><p>接着出现的 dvipdf 程序其实是一个小脚本，它将 dvips 和 ps2pdf 这两个程序连接起来，将 dvi 文档间接地转换到 pdf 文档。后来出来个 <a href="http://gaspra.kettering.edu/dvipdfm/" target="_blank">dvipdfm</a> 程序，才真正地做到将 dvi 文档直接转换为 pdf 文档。然后在其基础上又出来个 <a href="http://project.ktug.or.kr/dvipdfmx/" target="_blank">dvipdfmx</a> 程序，加强了对中日韩字体的支持。还有个 pdflatex 程序，可以直接将 tex 文档编译为 pdf 文档，最是简单快捷。</p><p>为使生成的 pdf 文档更加美观，特别是放大之后不产生锯齿，就必须在 pdf 文档中使用矢量字体。dvips 和 dvipdfm 只能使用 pk 点阵字体和 type1 矢量字体，而 dvipdfmx 和 pdflatex 可以使用 pk 点阵字体，type1 和 truetype 矢量字体。因此，为了得到高质量的 pdf 文档，最好用 dvipdfmx 和 pdflatex 来生成文档。 </p><p>最新的 xelatex 程序也是将 tex 文档直接编译为 pdf 文档，而且它可以使用前面所说的所有字体，独特的是只有它能支持 OpenType 字体的高级特性。 </p><p>参考资料：</p><p>[1] 吴凌云, <a href="http://www.ctex.org/CTeXFAQ" target="_blank">CTeX 常用问题集 v0.4 beta</a>, 2005.<br />[2] Alpha Huang, <a href="http://www.ctan.org/tex-archive/info/lnotes/lnotes.pdf" target="_blank">LATEX Notes v 1.20</a>, 2008. <br />[3] jackqq, <a href="http://blog.donews.com/jackqq/archive/2008/07/09/1317388.aspx" target="_blank">LaTeX 中文排版上手随记</a>, 2008.</p><!--sp--><br /><br /><div class="sysmsg"><b><a href="http://www.blogbus.com" target="_blank">博客大巴，你的个人传媒早班车</a></b></div><br /><br />]]></description>
   <link>http://cohomo.blogbus.com/logs/32785122.html</link>
   <author>cohomo</author>
   <pubDate>Sun, 21 Dec 2008 19:27:01 +0800</pubDate>
  </item>
  <item>
   <title>LaTeX之用XeTeX排版中文文档</title>
   <description><![CDATA[<p>之前已经介绍过用 CCT 和 CJK 宏包来排版中文 LaTeX 文档。用这两者来排版中文文档都是权宜之计，因为原本的TeX 排版程序就不支持中文，CCT 和 CJK 就是两种外挂而已，很容易就出现比如 pdf 书签乱码之类的问题。新近的 XeTeX 和 LuaTeX 从底端就支持各种文字包括中文，而且能够直接使用系统自带的字体，生成的文档更为美观，所以从 TeX 转换到 XeTeX/LuaTeX 来自然是潮流之所趋。LuaTeX 目前基本不支持 LaTeX 文档，所以现在先介绍用 XeTeX 排版 LaTeX 文档的方法。 </p><p>实际上，XeTeX 对 TeX 的改动不大，主要集中在字体的使用上，因此原来的 LaTeX 文档稍为修改下就能够用 XeTeX 编译了。国内流传甚广的 CTeX 套装太古老了，不包含 XeTeX，所以需要自个安装最新的 <a href="http://www.miktex.org" target="_blank">MiKTeX</a> 2.7 或者 <a href="http://www.tug.org/texlive/" target="_blank">TeXLive</a> 2008，编辑器推荐用免费的 TeXworks。安装完之后在编辑器中输入如下文本</p><p><strong>% !TEX program = xelatex</strong></p><p style="margin: 0px; text-indent: 0px"><strong>\documentclass[12pt,a4paper]{article}</strong></p><p style="margin: 0px; text-indent: 0px">&nbsp;</p><p style="margin: 0px; text-indent: 0px"><strong>\usepackage[cm-default]{fontspec}</strong></p><p style="margin: 0px; text-indent: 0px"><strong>\usepackage{xunicode}</strong></p><p style="margin: 0px; text-indent: 0px"><strong>\usepackage{xltxtra}</strong></p><p style="margin: 0px; text-indent: 0px"><strong>\setmainfont[BoldFont=SimHei,ItalicFont=KaiTi_GB2312]{SimSun}</strong></p><p style="margin: 0px; text-indent: 0px"><strong>\setsansfont[BoldFont=SimHei]{KaiTi_GB2312}</strong></p><p style="margin: 0px; text-indent: 0px"><strong>\setmonofont{NSimSun}</strong></p><p style="margin: 0px; text-indent: 0px"><strong><br />\XeTeXlinebreaklocale &quot;zh&quot;<br />\XeTeXlinebreakskip = 0pt plus 1pt<br /><br /></strong></p><p style="margin: 0px; text-indent: 0px"><strong>\begin{document}</strong></p><p style="margin: 0px; text-indent: 0px"><strong>\XeTeX\ Show: $\alpha$, $a^2+b^2=c^2$</strong></p><p style="margin: 0px; text-indent: 0px"><strong>中文字体！</strong></p><p style="margin: 0px; text-indent: 0px"><strong>\end{document}</strong></p><p style="margin: 0px; text-indent: 0px">&nbsp;</p><p style="margin: 0px; text-indent: 0px">然后使用 xelatex 编译，就得到一个中文文档了。一言以蔽之，很好很强大。</p><p style="margin: 0px; text-indent: 0px">&nbsp;&nbsp;</p><p style="margin: 0px; text-indent: 0px">注意 WinEdt 对 UTF-8 编码支持不够完善，需要手动选择；或者在新建的 tex 文件的首行写上如下这行<br /><font face="Courier New"><strong>% !Mode:: &quot;TeX:UTF-8&quot;</strong></font></p><p style="margin: 0px; text-indent: 0px">以让 WinEdt 在打开和保存时作编码转换。即使这样，有时也会造成乱码或字符丢失，所以不推荐用 WinEdt 编辑 UTF-8 编码的 xetex+latex 文档。</p><p style="margin: 0px; text-indent: 0px">&nbsp;</p><p style="margin: 0px; text-indent: 0px">参考资料：</p><p style="margin: 0px; text-indent: 0px">[1] lyanry@gmail, <a href="http://bbs.ctex.org/viewthread.php?tid=43236" target="_blank">XeTeX中文排版之胡言乱语</a>, 2007.&nbsp; </p><p style="margin: 0px; text-indent: 0px">[2] kmc@ctex, <span class="bold"><a href="http://bbs.ctex.org/viewthread.php?tid=43244" target="_blank">XeTeX about:fonts</a>, 2008.</span></p><p style="margin: 0px; text-indent: 0px">[3] kmc@ctex, <a href="http://bbs.ctex.org/viewthread.php?tid=43596" target="_blank">LaTeX发行版自带的字体</a>, 2008.</p><p style="margin: 0px; text-indent: 0px">[4] Marko Boon, <a href="http://www.win.tue.nl/latex/documentation/xelatextest.pdf" target="_blank">XeTeX in MiKTeX</a>, 2008.</p><p style="margin: 0px; text-indent: 0px">[5] ollydbg@ctex, <a href="http://bbs.ctex.org/viewthread.php?tid=46833" target="_blank">Lyx和Xetex新手入门教程</a>, 2008. </p><!--sp--><br /><br /><div class="sysmsg"><b><a href="http://www.blogbus.com" target="_blank">博客大巴，你的个人传媒早班车</a></b></div><br /><br />]]></description>
   <link>http://cohomo.blogbus.com/logs/31417972.html</link>
   <author>cohomo</author>
   <pubDate>Sun, 16 Nov 2008 11:52:22 +0800</pubDate>
  </item>
  <item>
   <title>LaTeX之LyX文档处理软件</title>
   <description><![CDATA[<p><a href="http://www.lyx.org/" target="_blank">Lyx</a>
 是一个近乎所见即所得的文档处理软件，它既有着 Office 软件直观易用的优点，又能利用 TeX 后端生成高质量的科学文档。因此，它适合对 TeX/LaTeX 有一定了解的用户使用。最近发布的 LyX 1.6 版本对中文的支持程度已经足够好了，这里介绍下这个软件。</p>
<p>在安装 LyX 之前，确保你已经安装了 CTeX 等 TeX 套装，并将 tex 程序所在的目录加入了环境变量。 Windows 版本的 LyX 1.6.0 不到 20 兆，安装时会自动寻找并设置 tex 环境。</p>
<p>安装之后打开 LyX，新建一个空白文档就可以撰写文档了。默认的文档类别是 latex 的 article 类。这时候在程序左上角的下拉框中可以选择输入文档头（标题、作者、日期、摘要），章节标题（section、subsection），各种列表（item、enumerate）等等；在工具栏里还可以插入各种其它的内容（图像、表格、标签、引用、脚注），自然还有许许多多的数学符号。撰写过程中随时点击工具栏中的 dvi 或 pdf 图标就可以生成并打开相应的 dvi 或 pdf 文件。撰写完毕在&ldquo;文件-&gt;导出&rdquo;菜单中就可以将 lyx 文档导出为 tex 或者 pdf 文档。</p>
<p>LyX 文档的编辑过程可以完全使用键盘快捷键（而且各种快捷键都可以自己定制）。比如按 Ctrl+M 可以插入行内公式，按 Ctrl+Shift+M 可以插入单行显示公式；最优秀之处在于，在编辑公式过程中你输入\alpha，\int，\infty 等数学命令加空格之后会自动转换为相应的数学符号，输入 ^ 和 _ 之后会自动切换到上下标位置，输入 \frac 加空格之后会自动转换为分式的模式，等等，非常直观优雅并且方便快捷。LyX 继承了 TeX 的传统，不能直接输入多于一个的空格，要输入更多的空格或者各种不同宽度的空格，可以点击工具栏的空格图标。当然也可以使用 Ctrl+Alt+Space 插入普通宽度的空格，用 Ctrl+Shift+Space 插入小宽度的空格。在 LyX 里面按 Alt+P 然后再按如下各键可以切换到各种章节标题或正文模式中：按 0，1 一直到 6 分别为 part, chapter, section, subsection, subsubsection, paragraph subparagraph；按 T 为输入文档标题，按 Shift+A 输入文档作者；按 S 可以回到正文模式中。&nbsp; </p>
<p>LyX 支持用 CJK 排版中文文档，这需要在&ldquo;文档-&gt;首选项&rdquo;菜单的&ldquo;语言&rdquo;栏中设置编码为 Chinese（GBK），否则生成 pdf 文档时会出错。LyX 同样支持 book, report 等文档类和 powerdot, beamer 等幻灯片类，这个需要在上述菜单的&ldquo;文档class&rdquo; 栏中选择；如果你使用 beamer 排版中文文档，还需要在 &ldquo;Class options&quot; 处填上 cjk 选项。注意这样虽然能正常编译，但是生成的 pdf 文件的中文书签会出现乱码，据说在文档编码设置中改用 utf8 编码可以避免此问题，由于时间关系未作测试。（建议抛弃 CJK 用下面介绍的 XeTeX 来排版中文文档。）</p>
<p>－－－－－－－－－－－－－－ 华丽的分割线 －－－－－－－－－－－－－－－－－－ </p>
<p>更新：如果要用 XeTeX 来编译 LaTeX 文档，可以按照如下步骤设置（参考<a href="http://bbs.ctex.org/viewthread.php?tid=41004" target="_blank">[1]</a>
, <a href="http://nirvana.72pines.com/2008/06/14/%E3%80%90%E5%8E%9F%E5%88%9B%E3%80%91xetexlyx%EF%BC%9A%E6%89%80%E8%A7%81%E5%8D%B3%E6%89%80%E5%BE%97%E5%9C%B0%E7%BC%96%E8%BE%91latex/" target="_blank">[2]</a>
）:</p>
<p>1. 修改 C:\Program Files\LyX16\Resources\lyxrc.dist 文件，在最后面加入下边这两行然后重新打开LyX<br />
<strong>\format &quot;pdf4&quot; &quot;pdf&quot; &quot;PDF (xelatex)&quot;&nbsp;&nbsp;&quot;&quot;&nbsp; &nbsp;&quot;&quot;&nbsp; &nbsp;&quot;&quot;&nbsp; &nbsp;&quot;document,vector&quot;<br />
\converter &quot;pdflatex&quot; &quot;pdf4&quot; &quot;xelatex $$i&quot; &quot;latex&quot;</strong>
</p>
<p>2. 在&ldquo;文档-&gt;首选项&rdquo;菜单里，将&ldquo;语言&rdquo;栏的编码改为&ldquo;Unicode (XeTeX) (utf8)&rdquo;，在&ldquo;LaTeX序&rdquo;栏中加入 XeTeX 相关的中文设置，比如<strong><br />
\usepackage[cm-default]{fontspec}<br />
\usepackage{xunicode}<br />
\usepackage{xltxtra}<br />
\setmainfont[BoldFont=SimHei,ItalicFont=KaiTi_GB2312]{SimSun}<br />
\setsansfont[BoldFont=SimHei]{KaiTi_GB2312}<br />
\setmonofont{NSimSun}<br />
\XeTeXlinebreaklocale &quot;zh&quot;<br />
\XeTeXlinebreakskip = 0pt plus 1pt</strong>
</p>
<p>3. 现在可以点击&ldquo;视图-&gt;PDF (xelatex)&rdquo;菜单以预览 pdf 文档，或者点击&ldquo;文件-&gt;导出-&gt;PDF (xelatex)&rdquo;以生成 pdf 文档。</p>
<p>4. 如果你需要在工具栏中也添加xelatex的预览和更新按钮，可以打开 C:\Program Files\LyX16\Resources\ui\stdtoolbars.inc 文件，在 Toolbar &quot;view/update&quot; &quot;View/Update&quot; 这部分后面添加下边几行然后重新打开LyX<br />
<strong>Separator<br />
Item &quot;View PDF (xelatex)&quot; &quot;buffer-view pdf4&quot;<br />
Item &quot;Update PDF (xelatex)&quot; &quot;buffer-update pdf4&quot;&nbsp; </strong>
</p>
<p><a href="http://cohomo.blogbus.com/files/s/12268346081.png" target="_blank"><img src="http://cohomo.blogbus.com/files/12268346081.png" border="0" alt="" />
</a></p><!--sp--><br /><br /><div class="sysmsg"><b><a href="http://www.blogbus.com" target="_blank">博客大巴，你的个人传媒早班车</a></b></div><br /><br />]]></description>
   <link>http://cohomo.blogbus.com/logs/31361739.html</link>
   <author>cohomo</author>
   <pubDate>Fri, 14 Nov 2008 19:36:00 +0800</pubDate>
  </item>
  <item>
   <title>LaTeX之TeXworks编辑器</title>
   <description><![CDATA[<p><a href="http://www.tug.org/texworks/">TeXworks</a> 是在 TUG（TeX Users Group）的支持下正在开发的一个全新的 TeX/LaTeX 编辑器。它的首要特点如下：自带了一个 pdf 浏览器，编辑 latex 文件时可以迅速预览排版后的 pdf 文件；默认情况下 latex 编辑窗口在左边，pdf 浏览窗口在右边，各占一半桌面，在大屏幕宽屏显示器显示的效果最好不过了。还有就是它的设计目标是简单易用，所以只支持直接生成并预览 pdf，避免dvi, ps, pdf各种文件格式对初学者的干扰。</p><p>Texworks 可以在<a href="http://code.google.com/p/texworks/downloads/list">这里</a>下载。在 Windows 下使用需要下载其中对应的两个压缩包，并将其中的内容解压到同一个目录下。如果你已经安装了 CTeX，在 TeXWorks 里设置下 latex 编译器所在目录就可以了（一般在 c:\ctex\texmf\miktex\bin 目录）。CTeX 很久没更新了，不支持 synctex，所以还需要在设置里去掉 synctex=1 选项（这个 synctex 似乎是用于正向反向搜索和自动刷新PDF文件的，所以最好还是安装最新的 latex 套装，比如 TeXLive 2008）。</p><p>另外，TeXworks 使用的是 Qt 图形界面，所以有 Windows，Linux 和 Mac OS 各种平台的版本。&nbsp;</p><p>更新1：最新版本的MiKTeX 2.7包含的 pdftex 是支持生成 synctex 文件的，只要将上述的 synctex=1 改为 synctex=-1 就可以（0表示不使用，-1表示使用 synctex 文件，1表示使用压缩的 synctex 文件，Windows版本的 TeXWorks 尚未支持压缩的 synctex 文件）。启用了 synctex 后，在 TeXWorks 的编辑窗口和浏览窗口按住 Ctrl 键用鼠标单击，即可在 tex 源码和 pdf 内容之间跳转（即正向和反向搜索）。</p><p>更新2：TeXWorks 支持命令补全（command completion）。使用方法是在输入若干字母后按 Ctrl+Tab 或者 Shift+Tab。比如，输入i之后按 Ctrl+Tab 就会变成 \item，输入xg之后按 Ctrl+Tab 会变成\gamma，输入 \bth 之后按 Ctrl+Tab 键就会变成 \begin{theorem} \end{theorem}；在最前面是否加\补全的结果是一样的。如果有几种可能的补全方式，多按几次就会在这几种方式之间循环，按 Ctrl+Tab 和按 Shift+Tab 循环方向相反。 </p><p>更新3：TeXWorks 默认使用 UTF-8 编码，如果你需要编辑用 GBK 编码的tex文件（比如 CCT 或者 CJK 文件），可以在文件的最前面加上如下一行以免乱码或者编译出错：<br /><strong>% !TEX encoding = System</strong></p><p>更新4：你也可以通过在文件最前面再加如下一行指定默认的编译命令：<br /><strong>% !TEX program = pdflatex</strong> </p><p><a href="http://cohomo.blogbus.com/files/s/12268346080.png" target="_blank"><img src="http://cohomo.blogbus.com/files/12268346080.png" border="0" alt="" /></a>&nbsp;</p><!--sp--><br /><br /><div class="sysmsg"><b><a href="http://www.blogbus.com" target="_blank">博客大巴，你的个人传媒早班车</a></b></div><br /><br />]]></description>
   <link>http://cohomo.blogbus.com/logs/28536726.html</link>
   <author>cohomo</author>
   <pubDate>Thu, 04 Sep 2008 19:31:08 +0800</pubDate>
  </item>
  <item>
   <title>LaTeX之文件拆分及独立编译</title>
   <description><![CDATA[<p>如果LaTeX文档比较大，可以考虑拆分为几个部分。比如编辑一本书的时候可以将各章独立为chap1.tex，chap2.tex，chap3.tex，然后在主文件main.tex中包含进来：</p><p><strong>\documentclass{book}<br />\begin{document}<br />\title{A LaTeX Book}<br />\author{cohomo@blogbus}<br />\date{}\maketitle<br />\input{chap1}<br />\input{chap2}<br />\input{chap3}<br />\end{document} </strong></p><p>上面的\input命令可以改为\include，区别在于，\input可以放在导言区和正文区，包含的内容不另起一页；而\include只能放在正文区，包含的内容另起一页。另外CJK中还有\CJKinput和\CJKinclude命令。</p><p>还有个问题就是，如何使得各章既可以被包含在另一个文件中也可以独立编译呢？方法是将main.tex和chap1.tex作如下修改：</p><p><strong>% main.tex<br />\documentclass{book}<br />\def\allfiles{}<br />
\begin{document}<br />
\title{A LaTeX Book}<br />
\author{cohomo@blogbus}<br />\date{}\maketitle<br />
\input{chap1}<br />
\input{chap2}<br />
\input{chap3}<br />
\end{document}</strong></p><p><strong>% chap1.tex<br />\ifx \allfiles \undefined<br />\documentclass{article}<br />\begin{document}<br />\title{Something in Title}<br />\author{cohomo@blogbus}<br />\date{}\maketitle<br />\else<br />\chapter{Chap1's Title}<br />\fi<br />\section{First Section}<br />\section{Second Section}<br />\ifx \allfiles \undefined<br />\end{document}<br />\fi&nbsp; </strong></p><p>这样编写长文档就很方便和灵活了。 </p><!--sp--><br /><br /><div class="sysmsg"><b><a href="http://www.blogbus.com" target="_blank">博客大巴，你的个人传媒早班车</a></b></div><br /><br />]]></description>
   <link>http://cohomo.blogbus.com/logs/23129805.html</link>
   <author>cohomo</author>
   <pubDate>Tue, 17 Jun 2008 23:40:12 +0800</pubDate>
  </item>
  <item>
   <title>LaTeX之用beamer制作幻灯片</title>
   <description><![CDATA[<p>用LaTeX中的beamer包可以制作PDF幻灯片。下面的例子改自beamer文档中的例子，看起来非常显然：其中的每个frame表示幻灯片的一页。beamer文档要用pdflatex编译。</p><p><strong>\documentclass{beamer}<br />%\documentclass[cjk]{beamer}<br /><br />\usetheme{Warsaw}<br /></strong></p><strong><p>%\usepackage{CJK}<br />%\hypersetup{CJKbookmarks=true} %否则编译时遇到中文的章节名会报错&nbsp;</p><p>\begin{document}<br />%\begin{CJK*}{GBK}{song}</p></strong><p><strong>\title{Example Presentation Created with the Beamer Package}<br />\author{Till Tantau}<br />\date{\today}<br /><br />\begin{frame}<br />\titlepage<br />\end{frame}<br /><br />\section{Outline}<br /><br />\begin{frame}<br />\tableofcontents<br />\end{frame}<br /><br />\section{Introduction}<br /><br />\subsection{Overview of the Beamer Class}<br />\begin{frame}<br />&nbsp;&nbsp; \frametitle{Feature of the Beamer Class}<br />&nbsp;&nbsp; \begin{itemize}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \item&lt;1-&gt; Normal LaTeX class.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \item&lt;2-&gt; Easy overlays.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \item&lt;3-&gt; No external programs needed.<br />&nbsp;&nbsp; \end{itemize}<br />\end{frame}<br /><br />%\end{CJK*}<br />\end{document}</strong></p><p>如果要用 CJK + Beamer 制作中文幻灯片，删掉第一行，然后去掉上面注释掉的那几行最前面的 ％ 号即可。</p><!--sp--><br /><br /><div class="sysmsg"><b><a href="http://www.blogbus.com" target="_blank">博客大巴，你的个人传媒早班车</a></b></div><br /><br />]]></description>
   <link>http://cohomo.blogbus.com/logs/21417141.html</link>
   <author>cohomo</author>
   <pubDate>Thu, 22 May 2008 23:38:18 +0800</pubDate>
  </item>
  <item>
   <title>LaTeX之CJK中文排版介绍</title>
   <description><![CDATA[<p>使用LaTeX排版中文文档，目前只要有两种方法：一是用CJK宏包，二是用CCT宏包。这里介绍CJK的中文排版，CCT排版的介绍见后面一篇。</p><p>CJK是外国人编写的，不仅支持中文，而且也支持其它双字节语言（CJK=Chinese＋Japanese+Korean）。MiKTeX和CTeX中都有这个包，安装之后就可以这样使用了：</p><p><strong>\documentclass{article}<br />\usepackage{CJK}<br />\begin{document}<br />\begin{CJK}{GB}{gbsn}<br />欢迎来到CJK！这里使用的是CJK宏包里有的文鼎宋体。<br />\end{CJK}<br />\end{document}&nbsp;</strong></p><p>然后就用latex编译就可以得到中文文档了，不比英文排版复杂多少，关键是要把中文部分放在\begin{CJK}和\end{CJK}之间。上面代码中的GB指的是编码，对于简体中文来说，常见的有GB编码和GBK编码两种。而gbsn指使用的字体为文鼎宋体。</p><p>由于字体的版权问题，CJK的宏包里只有文鼎宋体和文鼎楷体这两种字体，可是这两种字体生成的中文文档的效果很一般。CTeX里另外多了GBK编码的六种中文字体（宋体、仿宋、楷体、黑体、隶书和幼圆），如果你安装了CTeX，就可以类似下面来使用这几种字体：</p><p><strong>\documentclass{article}<br />\usepackage{CJK}<br />\begin{document}<br />\begin{CJK}{GBK}{song}<br />CTeX里中文默认用宋体！</strong></p><span style="font-weight: bold" class="Apple-style-span">\CJKfamily}{GBK}{hei}<br /><span style="font-weight: normal" class="Apple-style-span"><span style="font-weight: bold" class="Apple-style-span">这是CTeX里的黑体！</span>&nbsp;</span></span><p><strong>\CJKfamily{fs}<br />这是CTeX里的仿宋体！</strong></p><p><strong>\CJKfamily{kai}<br />这是CTeX里的楷体！</strong></p><p><strong>\CJKfamily{li}<br />这是CTeX里的隶书！</strong></p><p><strong>\CJKfamily{you}<br />这是CTeX里的幼圆体！</strong></p><p><strong>\end{CJK}<br />\end{document}</strong>&nbsp;</p><p>注记：中文Windows系统里没有隶书和幼圆这两种字体，而英文Windows系统里还没有楷体和仿宋这两种字体。这几个字体在安装微软Office时会安装。如果只安装CTeX而没安装CTeX-Fonts的话，编译CJK文件时需要用到系统自带的中文ttf字体文件，这样就会出错。</p><p>更新：使用 CJK 来排版中文 LaTeX 文档不太方便，现在建议<a href="../logs/31417972.html" target="_blank">使用 XeTeX 来排版中文 LaTeX 文档</a>。&nbsp;</p><!--sp--><br /><br /><div class="sysmsg"><b><a href="http://www.blogbus.com" target="_blank">博客大巴，你的个人传媒早班车</a></b></div><br /><br />]]></description>
   <link>http://cohomo.blogbus.com/logs/7975988.html</link>
   <author>cohomo</author>
   <pubDate>Tue, 28 Aug 2007 21:40:20 +0800</pubDate>
  </item>
 </channel>
</rss>

