男单 618

生活象筒装的卫生纸,开始的时候怎么扯都不觉得在转,后来转的越来越快。

Archive for the ‘latex’ tag

reStructuredTEXT输出为LaTeX以及公式的问题

without comments

中文的rst文件,输出为LaTeX文件:

在home目录下编辑.docutils文件,内容如下:

[latex2e writer]
documentclass: article
documentoptions: 12pt a4paper
output-encoding: utf-8
stylesheet: /home/username/docutils.tex

前几行没什么可说的,最后一行所指定文件的内容如下:

\usepackage[slantfont,boldfont,CJKaddspaces,CJKchecksingle]{xeCJK}
\CJKlanguage{zh-cn}
\setmainfont{Times New Roman}
\setCJKmainfont{Adobe Song Std}
\usepackage{CJKfntef}

我这是想用xelatex,如果是用CCT或者CTEX,语句相对少些。大家自己改吧。

公式的话,在文件头添加

.. role:: raw-math(raw)
    :format: latex html
行内公式这样写:
If :raw-math:`$x=5 \times 3$` then :raw-math:`$x$` is
注意,冒号后面没空格!
独立公式这样写:
.. raw:: latex html

    $$ W \approx \sum{f(x_k) \Delta x} $$
    $$ W = \int_{a}^{b}{f(x) dx} $$
参考源:
  1. Docutils Configuration: http://docutils.sourceforge.net/docs/user/config.html
  2. reStructured Text tips and tricks: http://www.programmerq.net/rsttricks.html
  3. [tip] python-docutils: rst2latex create chinese pdf(繁体中文): http://kalug.linux.org.tw/~lloyd/bblog/archives/2009/11/09/%5Btip%5D_python-docutils:_rst2latex_create_chinese_pdf/

注:

如果是使用Sphinx,那么对于公式的支持就不用这么麻烦了,可以直接使用:math:和.. math::这样的命令,因为Sphinx支持rST扩展,用上面的方法,反而会出很多问题。

1 [latex2e writer]
2 documentclass: article
3 documentoptions: 12pt,a4paper
4 output-encoding: utf-8
5 stylesheet: /home/mzy/docutils.tex
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
– 可视 行 —                                                 5,1          全部

Written by amao

十二月 20th, 2009 at 10:36 下午

Posted in 软件

Tagged with , ,

TEX THE WORLD

with one comment

TeX THE WORLD是一个FireFox插件,它的作用是在浏览器的输入中很方便的加入TeX公式。在[; 和 ;]之间直接按照TeX语法写公式,就可以了。如果编辑器是支持HTML的(比如Gmail),那么结果可以实时显示(有一点点延迟,基本可以忽略),如果是纯文本的编辑器,结果需要在结果提交之后才能显示。比如:

[;F(x)=\int_a^x f(t)dt;]

公式实际上是保存在远程服务器上的图片,这和原来用LaTeXRender实现的LaTeX公式编辑器本质上是一样的,只是用起来更方便。

另外,基于Chrome的插件也已经出来了,在这里。安装和使用方法请自行Google之。

Written by amao

十一月 16th, 2009 at 7:45 下午

Posted in 软件

Tagged with , ,

一种基于Latex语言的中文期刊双栏排版模板

without comments

LaTeX模板也能申请专利?居然还是发明专利。

一种基于Latex语言的中文期刊双栏排版模板:http://zhuanli.baidu.com/pages/sipo/20061001/17/8689afa3f9b3ab08f79f203dddeae334_0.html

虽然编写好的LaTeX模板是一件十分困难的事情,但是没想到还能申请发明专利。

Written by amao

十一月 5th, 2009 at 10:27 下午

Posted in LaTeX相关

Tagged with ,

几个值得深入学习的工具

without comments

  1. 正则表达式
  2. VIM
  3. LaTeX
  4. Python
  5. Linux

Written by amao

十月 20th, 2009 at 10:22 下午

Posted in 其他

Tagged with , , , ,

解决apt依赖问题

without comments

在Ubuntu下一直是用国内朋友修改后的texlive,原来是2005,现在是2008。这样如果再要装kile这样的软件的话,就会有包依赖的问题,一直不知道怎么解决。今天在查另外一个问题的时候,无意中看到解决方案。总的来就,就是造一个假包装上。在这里,42楼:http://forum.ubuntu.org.cn/viewtopic.php?f=35&t=168940。下面还是转一下原文。

引用:

另外我想重复再问一下,谁有解决 apt 包依赖问题的办法?

手工安装 TeX Live 后,如果还要从源里安装依赖 texlive 的软件(一个明显的例子就是 LaTeX 的编辑器 kile),就又会要求你再装源里面的那个已经被分解得比较零碎的 texlive2007。似乎是需要做一个关于 texlive 的空的假包?哪里有相关的文档,似乎不好找。

装 dummy 包的办法很简单了,过程如下:

代码:
sudo apt-get install equivs

它要装不少东西,好在不是很大,另外有我本来就需要的 MySQL。

在桌面上新建一 .ctl 个文件,比如:texlive-dummy.ctl 。

然后添加如下内容:

代码:
Section: tex
Package: texlive-dummy
Provides: texlive, texlive-base-bin, texlive-base-bin-doc,texlive-bibtex-extra, texlive-common, texlive-doc-base, texlive-doc-bg,texlive-doc-cs+sk, texlive-doc-de, texlive-doc-el, texlive-doc-en,texlive-doc-es, texlive-doc-fi, texlive-doc-fr, texlive-doc-it,texlive-doc-ko, texlive-doc-mn, texlive-doc-nl, texlive-doc-pl,texlive-doc-pt, texlive-doc-ru, texlive-doc-th, texlive-doc-tr,texlive-doc-uk, texlive-doc-vi, texlive-doc-zh, texlive-extra-utils,texlive-font-utils, texlive-fonts-extra, texlive-fonts-extra-doc,texlive-fonts-recommended, texlive-fonts-recommended-doc,texlive-formats-extra, texlive-full, texlive-games,texlive-generic-extra, texlive-generic-recommended, texlive-humanities,texlive-humanities-doc, texlive-lang-african, texlive-lang-all,texlive-lang-arab, texlive-lang-armenian, texlive-lang-cyrillic,texlive-lang-czechslovak, texlive-lang-danish, texlive-lang-dutch,texlive-lang-finnish, texlive-lang-french, texlive-lang-german,texlive-lang-greek, texlive-lang-hebrew, texlive-lang-hungarian,texlive-lang-indic, texlive-lang-italian, texlive-lang-latin,texlive-lang-manju, texlive-lang-mongolian, texlive-lang-norwegian,texlive-lang-polish, texlive-lang-portuguese, texlive-lang-spanish,texlive-lang-swedish, texlive-lang-tibetan, texlive-lang-ukenglish,texlive-lang-vietnamese, texlive-latex-base, texlive-latex-base-doc,texlive-latex-extra, texlive-latex-extra-doc, texlive-latex-recommended,texlive-latex-recommended-doc, texlive-latex3, texlive-math-extra,texlive-metapost, texlive-metapost-doc, texlive-music, texlive-omega,texlive-pictures, texlive-pictures-doc, texlive-plain-extra,texlive-pstricks, texlive-pstricks-doc, texlive-publishers,texlive-publishers-doc, texlive-science, texlive-science-doc,texlive-xetex, texlive-lang-other, texlive-lang-croatian, texlive-base,texlive-doc-ja, cm-super, lmodern, latex-xcolor, latex-beamer, pgf,preview-latex-style
Description: TeXlive dummy package
This package provides dpkg with the information that
there is a local TeXlive version installed.

保存后开始打包:

代码:
sudo equivs-build texlive-dummy.ctl

然后可以看见一个 deb 文件,名为:texlive-dummy_1.0_all.deb

现在就可以安装它了:

代码:
sudo dpkg -i texlive-dummy_1.0_all.deb

行了,下面就不用多说了,打开新立德,找到 kile 安装就是了,效果如下:

附件:
Screenshot.png

Screenshot.png [ 1002.93 KiB | 被浏览 738 次 ]

顺便把这两个文件也一并打包附赠:

附件:

texlive-dummy.tar.gz [4.25 KiB]

被下载 90 次

Written by amao

十月 19th, 2009 at 8:02 下午

Posted in LaTeX相关, linux

Tagged with , ,

CaR,GCLC,TikZ

without comments

C.a.R.和GCLC都可以算做类似几何画板的所谓动态几何软件,这里是维基百科上关于这类软件的一个比较。那张表并不完整,至少缺了是否跨平台这一栏。而这两个软件都具备以下特点:

  1. 免费
  2. 跨平台
  3. 支持LaTeX

另外,C.a.R.可以将动态结果输出至网页形式,只要装了Java的机器,可以直接在浏览器中操作。GCLC则有机器证明的功能,并可以将做图脚本输出为TikZ格式。

而TikZ是LaTeX上的一个宏包,可与Beamer很好的配合。

缺点是这三个软件都非常小众,无论国内还是国外,用户似乎都不多。

8月15日补充:

关于TikZ/PGF的好站(强力推荐):http://www.texample.net

Written by amao

八月 15th, 2009 at 10:33 上午

几则Beamer技巧

without comments

1、列目录时,隐藏所有的小节
\tableofcontents[hideallsubsections]

2、自动压缩,以显示全部内容
\begin{frame}[shrink]

3、在每一节(或小节)前增加目录
命令\AtBeginSection[]{}和\AtBeginSubsection[]{}。比如下面两个命令可以实现在每一节前显示文档目录,隐藏所有小节标题,并高亮当前节标题,而在每一小节前显示的目录中,只会显示本节的小节标题,并高亮当前小节标题,其他节的小节标题不显示,只显示节标题。
\AtBeginSection[]
{
    \begin{frame}
        \tableofcontents[currentsection,hideallsubsections]
    \end{frame}
}
\AtBeginSubsection[]
{
    \begin{frame}
[shrink]
        \tableofcontents[sectionstyle=show/shaded,subsectionstyle=show/shaded/hide]
    \end{frame}
}

4、frametitle的两种写法
\begin{frame}
  \frametitle{标题}
\end{frame}

\begin{frame}{标题}
\end{frame}

btw: 其实这些技巧在手册中都有,只是手册太长,一直没有完整的读过。结果每次都有新发现。喜欢Beamer,不单因为Beamer确实比较方便、漂亮,更重要的是Beamer的作者对于幻灯片的制作和使用有自己独到的见解。内容的组织,颜色的搭配,时间的控制,都有所涉及。让人感觉非常专业,自然产生一种信任。

Written by amao

八月 15th, 2009 at 1:15 上午

Posted in LaTeX相关

Tagged with ,

Beamer文档中添加PDF文档信息(PDF document information)

without comments

默认参数下,Beamer宏包可以将文档的\title{}和\author{}字段的内容自动加入PDF文档信息(PDF document information)的相应字段中,如果还想添加主题和关键字等信息,可以使用\subject{}和\keywords{}命令。但是由于Beamer用的是hyperref宏包来实现这些功能,而hyperref宏包的这一功能并不支持中文。所以,如果你的幻灯片是中文标题、中文作者,那么PDF文档信息中将出现乱码。

一个可以接受的解决方案是,正文中仍然使用中文,但向PDF文档信息中添加英文信息。要实现这一点并不难,只需要先禁止Beamer自动添加这些信息,再由手工添加即可。具体做法如下:

  1. 使用参数usepdftitle,禁止Beamer自动添加这些信息,比如这样:\documentclass[usepdftitle=false,mathserif]{beamer}
  2. 手工添加相应信息,比如这样:

\hypersetup{CJKbookmarks=true,%
                pdftitle={Computer Simulation},%
                pdfauthor={Mao Ziyang},%
                pdfcreator={amao@ai7.org},%
                pdfsubject={Computer Simulation},%
                pdfkeywords={simulation}
                }

关于\hypersetup命令的其他信息,请参考:使用pdfLaTeX时,添加PDF文件属性的方法

Written by amao

八月 10th, 2009 at 11:35 上午

Posted in LaTeX相关

Tagged with , ,