Path: liyi.freeshell.org » computer » tex

teTeX 3.0 的中文配置

以前一直用 CJK 宏包处理中文,基本够用,后来改用更符合中文用户使用习惯 的 CCT 宏包。下面这些内容源于以前配置 tetex-2.0 的步骤,改动后用 于tetex-3.0。现在不用了,放在这里留个纪念。

1. 建立 $TEXMFHOME 目录,拷贝 gbkfonts 二进制文件

$ mkdir ~/texmf
$ cp /your/path/gbkfonts ~/texmf/

2. copy truetype 中文字体

$ mkdir ~/texmf/fonts/truetype/chinese/
$ cp /your/path/sim*.ttf ~/texmf/fonts/truetype/chinese/

常用的有宋体、黑体、楷体。

3. 生成字体

$ cd ~/temxf/
$ ./gbkfonts ~/texmf/fonts/truetype/chinese/simsun.ttf song
$ ./gbkfonts ~/texmf/fonts/truetype/chinese/simhei.ttf hei
$ ./gbkfonts ~/texmf/fonts/truetype/chinese/simkai.ttf kai

4. 调整目录

标准 TeX 目录结构TDS)调整生成的文件:

$ mkdir -p  ~/texmf/fonts/{map/{dvipdfm,dvips,pdftex,ttf2pk},\
> enc/{dvips/chinese,pdftex/chinese}}
$ mv ~/texmf/dvips/cjk.map ~/temxf/fonts/map/dvips/
$ mv ~/texmf/pdftex/config/*.map ~/texmf/fonts/map/pdftex/
$ mv ~/texmf/dvipdfm/config/*.map ~/texmf/fonts/map/dvipdfm/
$ mv ~/texmf/ttf2pk/ttfonts.map ~/texmf/fonts/map/ttf2pk/
$ mv ~/texmf/dvips/chinese/* ~/texmf/fonts/enc/dvips/chinese/
$ mv ~/texmf/pdftex/enc/* ~/texmf/fonts/enc/pdftex/chinese/

5. dvips 的必要配置

$ mkdir ~/texmf/dvips/config/
$ cp /usr/share/texmf-tetex/dvips/config.ps ~/texmf/dvips/config/
$ cat "p +cjk.map" >> ~/texmf/dvips/config/config.ps

6. 刷新 TeX 文件名数据库

$ texhash

Category: /computer/tex | Permalink

`listings' conflicts with `CJK'

`listings' (v1.3) conflicts with `CJK' (v4.7.0) in teTeX 3.0.

The solution is to add

\lstset{extendchars=false}

to the preamble of your LaTeX source file.

See: Debian Bug report logs - #348636

Category: /computer/tex | Permalink

How to install font symbols' packages (like ifsym) in teTeX?

It's so easy to generate and set up a new .sty file.

But how can we install a font/symbol package like ifsym ?

Is this a general method ?

  1. create a directory $TEXMF/fonts/sources/public/ifsym
  2. copy all the *.mf *.gen to this directory
  3. create a directory $TEXMF/tex/latex/ifsym
  4. copy all the *sty *.fd to this directory
  5. Add the following lines to the file: $TEXMF/fontname/special.map
    ifsym public ifsym
    ifgeo public ifsym
    ifwea public ifsym
    ifclk public ifsym
  6. update the TeX file database by running texhash or whatever your Tex imprementation provides.
  7. create a document:
    \documentclass{article}
    \usepackage[geometry]{ifsym}
    \begin{document}
    \Circle
    \SquareShadowA
    \end{document}
  8. Run LaTeX, if everything is fine, you should see a dvi that has a big circle and a big square shaded with a simple line at bottom and right of the square.

(See: http://www.tug.org/pipermail/tugindia/2001-August/000056.html)

Category: /computer/tex | Permalink

Abbreviated \today

\newcommand{\abbrtoday}{\ifcase\month\or%
Jan.\or Feb.\or Mar.\or Apr.\or May\or Jun.\or%
Jul.\or Aug.\or Sep.\or Oct.\or Nov.\or Dec.\fi%
\space\number\day, \number\year}

Category: /computer/tex | Permalink

tabbing environment example

\begin{tabbing}
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\=          \=   the longest span \kill
P. O. Box xxxx, Beijing,         \>\` Phone: \>\` (xxx) xxx-xxx \\
1000xx P. R. China               \>\` Email: \>\` {\tt xxx@xxx.xxx}
\end{tabbing}

Category: /computer/tex | Permalink

LaTeX render test

|x^{*} - x^{k}| \leqslant \frac{1}{2^{k+1}}(b-a)

Category: /computer/tex | Permalink

Embed video into PDF

%% filename: embed-video.tex
%%
%% 1. Compile TeX source with pdflatex.
%% 2. Put a video file (e.g. sample.avi) in the same directory
%%    with the PDF file.
%% 3. View PDF with Acrobat Reader.

\documentclass{beamer}
\usepackage{multimedia}
\begin{document}

\begin{frame}
\frametitle{frame title}

text

\movie[label=s1,width=160pt,height=120pt,poster]{sample}{sample.avi}
\hyperlinkmovie[start=2s,duration=10s]{s1}{\beamerbutton{show 2--12s}}
\end{frame}

\end{document}

Category: /computer/tex | Permalink

Generate letter size PostScript from DVI

After using latex to get an dvi file, you should run these commands:

dvips -Ppdf -G0 myfile.dvi
ps2pdf myfile.ps

If the generated pdf file has very small top margin, it means dvips generated A4 size but you expected letter size. Thus you should use dvips like this:

dvips -t letterSize -Ppdf -G0 myfile

Category: /computer/tex | Permalink

epstopdf 90 rotate: a ghostscript bug

The epstopdf command coming from your TeX distrubution can convert eps to pdf. However, due to a bug in GhostScript, the image is rotated by 90 degrees sometimes. Thus you should use this command to do the conversion. Of course you want to replace my.eps and my.pdf with the file name of your images.

egrep -v "^%%Orientation:" my.eps | epstopdf --filter --outfile=my.pdf

Category: /computer/tex | Permalink

Page 1 of 1: 1