照第2个置顶写的tex配置脚本

系统安装、升级讨论
版面规则
我们都知道新人的确很菜,也喜欢抱怨,并且带有浓厚的Windows习惯,但既然在这里询问,我们就应该有责任帮助他们解决问题,而不是直接泼冷水、简单的否定或发表对解决问题没有任何帮助的帖子。乐于分享,以人为本,这正是Ubuntu的精神所在。
回复
if
帖子: 62
注册时间: 2006-09-12 1:25

照第2个置顶写的tex配置脚本

#1

帖子 if » 2006-09-12 14:24

自己试过,装过没有问题,头一回写脚本,还请大家多提意见
运行方式:
1. copy windows下的字体simsun.ttc,simhei.ttf,simfang.ttf,simkai.ttf到~/.fonts
2.下载这俩个东西 ftp://ftp.cc.ac.cn/pub/cct/Linux/cct_0.6180.2_i386.deb download.php?id=4849 与脚本放在同一目录
3. 开终端cd到该目录下,然后 sudo chmod +x texconf.sh
4. 终端输入 sh texconf.sh
然后测试:
用gedit写如下内容

代码: 全选

\documentclass{article}
\usepackage{CJK}
\begin{document}
\begin{CJK}{GBK}{song}
这是latex
\end{CJK}
\end{document}
保存为gbk编码
安装完成后用latex *.tex来编译cjk的TeX文件,用ctex *.tex来编译cct文件。然后用dvipdfmx *.dvi或者dvipdfm *.dvi(看看结果中哪个没有乱码)来转换成pdf
更正了dvi乱码问题,kile编译成功率也大大增加,现在应该是怎么搞都不会乱码了。
一条命令直接出pdf

代码: 全选

pdflatex *.tex
上次由 if 在 2007-01-25 16:53,总共编辑 4 次。
if
帖子: 62
注册时间: 2006-09-12 1:25

#2

帖子 if » 2006-09-12 14:30

扩展名不许用sh 汗
这个脚本只适用于ubuntu6.06及基于他的hiweed和dubuntu,6.10不能使用

代码: 全选

#!/bin/bash
# apt-get and config latex+CJK+CCT 自动安装latex+CJK+CCT脚本
# Author:     if
# Version:    0.1.1 -6.06(testing version)
#for ubuntu 6.06 hiweed1.0 dubuntu6.06
# update:     21/11/2006
#-----------------------------------------------------------------------------
# This program is a free software, you can redistribute it and/or modify
# it under the eterms of the GNU General Public Liscence as published by
# the Free Software Foundation; either version 2 or (at your option) any
# later version.
#
# This program is being distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY without even the implied warranty of
# MERCHANTIBILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public Liscence for more details.
# -----------------------------------------------------------------------------
#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
#>>脚本使用方法如下:
#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
#copy windows下的字体simsun.ttc,simhei.ttf,simfang.ttf,simkai.ttf到~/.fonts
#下载这俩个东西     ftp://ftp.cc.ac.cn/pub/cct/Linux/cct_0.6180.2_i386.deb http://forum.ubuntu.org.cn/download.php?id=4849 与脚本放在同一目录
#如果你是hiweed,这样已经实现了添加字体,只需要配置tex字体了。其他版本要在除tex外的程序中使用这些字体,还要另行配置。
#使用方法:
#$sudo chmod +x texconf.sh 
#$sh texconf.sh
#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

sudo apt-get install tetex-base tetex-bin tetex-extra cjk-latex dvipdfm dvipdfm-cjk dvipdfmx fontforge -y --force-yes
sudo dpkg -i cct_0.6180.2_i386.deb
tar -zxvf gbkfonts.tar.gz
chmod +x gbkfonts 
sudo cp -p gbkfonts /usr/bin
sudo mkdir -p /usr/share/texmf/fonts/truetype/chinese
cd /usr/share/texmf/fonts/truetype/chinese/ 
#创建到~/.fonts目录下字体的联接档
ln -s ~/.fonts/simsun.ttc
ln -s ~/.fonts/simhei.ttf
ln -s ~/.fonts/simfang.ttf
ln -s ~/.fonts/simkai.ttf
cd /usr/share/texmf/
sudo gbkfonts fonts/truetype/chinese/simfang.ttf fs
sudo gbkfonts fonts/truetype/chinese/simsun.ttc song
sudo gbkfonts fonts/truetype/chinese/simkai.ttf kai
sudo gbkfonts fonts/truetype/chinese/simhei.ttf hei 
sudo texhash
sudo updmap-sys --enable Map cjk.map 
#end
6.10的源结构好像有点不一样了,应该用这个

代码: 全选

#!/bin/bash
# apt-get and config latex+CJK+CCT 自动安装latex+CJK+CCT脚本
# Author:     if
# Version:    0.1.1 -6.10(testing version)
#for ubuntu 6.10
# update:     21/11/2006
#-----------------------------------------------------------------------------
# This program is a free software, you can redistribute it and/or modify
# it under the eterms of the GNU General Public Liscence as published by
# the Free Software Foundation; either version 2 or (at your option) any
# later version.
#
# This program is being distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY without even the implied warranty of
# MERCHANTIBILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public Liscence for more details.
# -----------------------------------------------------------------------------
#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
#>>脚本使用方法如下:
#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
#copy windows下的字体simsun.ttc,simhei.ttf,simfang.ttf,simkai.ttf到~/.fonts
#下载这俩个东西     ftp://ftp.cc.ac.cn/pub/cct/Linux/cct_0.6180.2_i386.deb http://forum.ubuntu.org.cn/download.php?id=4849 与脚本放在同一目录
#如果你是hiweed,这样已经实现了添加字体,只需要配置tex字体了。其他版本要在除tex外的程序中使用这些字体,还要另行配置。
#使用方法:
#$sudo chmod +x texconf.sh 
#$sh texconf.sh
#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
sudo apt-get install tetex-base tetex-bin tetex-extra cjk-latex dvipdfm-cjk dvipdfmx fontforge  -y --force-yes
sudo dpkg -i cct_0.6180.2_i386.deb
tar -zxvf gbkfonts.tar.gz
chmod +x gbkfonts 
sudo cp -p gbkfonts /usr/bin
sudo mkdir -p /usr/share/texmf/fonts/truetype/chinese
cd /usr/share/texmf/fonts/truetype/chinese/ 
#创建到~/.fonts目录下字体的联接档
ln -s ~/.fonts/simsun.ttc
ln -s ~/.fonts/simhei.ttf
ln -s ~/.fonts/simfang.ttf
ln -s ~/.fonts/simkai.ttf
cd /usr/share/texmf/
sudo gbkfonts fonts/truetype/chinese/simfang.ttf fs
sudo gbkfonts fonts/truetype/chinese/simsun.ttc song
sudo gbkfonts fonts/truetype/chinese/simkai.ttf kai
sudo gbkfonts fonts/truetype/chinese/simhei.ttf hei 
sudo texhash
sudo updmap-sys --enable Map cjk.map 
#end
enjoy it!
:em11
上次由 if 在 2007-01-25 17:00,总共编辑 12 次。
inoppc
帖子: 11
注册时间: 2006-09-04 15:48

#3

帖子 inoppc » 2006-09-14 16:33

好东西,没早发现,我按照置顶的那帖子配置了半天才弄好,才发现楼主的帖~~~想见恨晚。刚开始用linux很多东西不懂。
xphenix
帖子: 35
注册时间: 2006-05-04 15:52

#4

帖子 xphenix » 2006-09-15 4:24

如果locale 为 zh_CN.UTF-8,那么置顶的配置还能用么???
if
帖子: 62
注册时间: 2006-09-12 1:25

#5

帖子 if » 2006-09-15 6:05

好像默认local都是utf-8,但是cjk只认识gbk
解决方法是保存时选择gbk编码
kile和gedit都能这么干,别的编辑器我就不清楚了
一定要选gbk,否则中文乱码或者干脆没有
头像
Tenyears
帖子: 2245
注册时间: 2005-06-30 15:46
来自: 成都

#6

帖子 Tenyears » 2006-09-18 15:47

加精奖励。

建议楼主继续完善。如加上选项,完善通用性。
要是机器上没有装windows或者没装在hda1?
Humanity to others // 己所不欲,勿施与人
Laptop: ThinkPad X220 --- Win7 Home / Ubuntu 12.04
Desktop: Win7/Ubuntu 12.04
Server: Ubuntu12.04
if
帖子: 62
注册时间: 2006-09-12 1:25

#7

帖子 if » 2006-09-19 23:27

没发几个贴就给我加精了,受宠若惊啊 :D
前两天有数模竞赛和钢混设计,忙得我都吐了(不是开玩笑,真的吐了),没上版,刚一上版就看见这个好消息,happy死了
正在积极学习linux中
大家有什么功能要求尽管提好了
回复