latex

最近写了些笔记,因为我一直在ubuntu系统下工作,所以我打算用latex来整理文档,如下是安装记录


如何添加插件,例如vim-latex 在.vimrc中添加"set runtimepath+=$HOME/.vim/vim-latex" (vim-latex文件夹在~/.vim/下)
 
   
sudo apt-get install texlive

sudo apt-get install latex-cjk-all

sudo apt-get install texlive-xetex



安装字体sudo apt-get install xfonts-wqy ttf-wqy-microhei ttf-wqy-zenhei

或者手动至 /usr/share/font/





更新字体缓存

sudo fc-cache -f -s -v



查看字体

fc-list

fc-list :lang=zh-cn





texhash



查看tex的主TEXMF目录

kpsewhich -expand-var \$TEXMF

kpsewhich -expand-var \$TEXMFLOCAL


画图支持

Asymptote方便程序员使用:编程画图

sudo apt-get install asymptote



建立文件:~/.asy/config.asy
import settings;

gs = "gs";

psviewer = "gv";

pdfviewer = "evince";

 

 
   

 

Ubuntu:添加CJK中文字体

#! /bin/bash



#Note:

# I've installed texlive & latex-cjk-all before & fontforge before

# run updmap before you run this script

# font.tar.bz2: https://code.google.com/p/code-of-tualatrix/downloads/list                                                                            



#Usage:

# put simsun.ttc in font directory. (get font from font.tar.bz2)

# latex_utf8 simsun.ttc song



if [ $# -eq 2 ] 

then

  PERSONAL_TEX="${HOME}/.texmf-var"

  FONT_FORGE=`which fontforge`

  FONT_ORG=$1

  FONT_DIR=`echo $FONT_ORG | cut -d '.' -f 1`

  FONT_NEW_NAME=$2

  FONT_MAP_NAME=$FONT_NEW_NAME.map

  FONT_FD_NAME=c70${FONT_NEW_NAME}.fd



  #enable?

  ENABLE_MOVE=0



else

    echo "Usage: $0 name.ttf  font_name"

    exit 1; 

fi





if [ ! -d $PERSONAL_TEX ]

then

    echo "please command updmap to generate personal tex folder"

    echo "In ubuntu 12.04, you'll get ~/.texmf-var"

    exit 1; 

fi



if [ -z $FONT_FORGE ]

then

    echo "please sudo apt-get install fontforge"

    exit 1; 

fi



if [ -e $FONT_ORG ]

then

    rm -rf $FONT_DIR

    mkdir -p $FONT_DIR

    ls -l | grep '^-' | awk '{print $NF}' | xargs -I {} cp {} $FONT_DIR

else

    echo "name.ttf not exist"

fi



#generating map file

cd $FONT_DIR

fontforge -script subfonts.pe $FONT_ORG  $FONT_NEW_NAME Unicode.sfd

ls -l *tfm | awk '{print $NF}' | awk '{FS = "."} {printf("%s %s < %s.pfb\n"), $1, $1, $1}' >> $FONT_MAP_NAME



#generating fd file

cat >> ${FONT_FD_NAME} << EOF

% This is $FONT_FD_NAME for CJK package

% created by Edward G.J. Lee

\ProvidesFile{$FONT_FD_NAME}

\DeclareFontFamily{C70}{$FONT_NEW_NAME}{\hyphenchar \font\m@ne}

\DeclareFontShape{C70}{$FONT_NEW_NAME}{m}{n} {<-> CJK * $FONT_NEW_NAME}{}

\DeclareFontShape{C70}{$FONT_NEW_NAME}{bx}{n} {<-> CJKb * $FONT_NEW_NAME}{\CJKbold}

\endinput

EOF



mkdir -p tfm_${FONT_NEW_NAME}

mv ${FONT_NEW_NAME}*tfm tfm_${FONT_NEW_NAME}



mkdir -p pfb_${FONT_NEW_NAME}

mv ${FONT_NEW_NAME}*pfb pfb_${FONT_NEW_NAME}



mkdir -p enc_${FONT_NEW_NAME}

mv ${FONT_NEW_NAME}*enc enc_${FONT_NEW_NAME}



mkdir -p map_${FONT_NEW_NAME}

mv ${FONT_MAP_NAME} map_${FONT_NEW_NAME}                                                                           



mkdir -p fd_${FONT_NEW_NAME}

mv ${FONT_FD_NAME} fd_${FONT_NEW_NAME}



#generating test file

cat >> Jerry.tex << EOF

\documentclass{article}

\usepackage{CJKutf8}

\begin{document}

\begin{CJK}{UTF8}{${FONT_NEW_NAME}}

Jerry测试CJK UTF ${FONT_NEW_NAME} 版

\end{CJK}

\end{document}

EOF



mkdir jerry_test_${FONT_NEW_NAME}

mv Jerry.tex jerry_test_${FONT_NEW_NAME}



find ./ -maxdepth 1 -type f -exec rm {} \;



cd ../





#if you do not have root privilege, think yourself

if [ $ENABLE_MOVE -eq 1 ]

then

  echo "you must know what you are doing!!!"

  mkdir -p ${PERSONAL_TEX}/fonts/map/dvips/CJK

  mkdir -p ${PERSONAL_TEX}/fonts/tfm/CJK/${FONT_NEW_NAME}

  mkdir -p ${PERSONAL_TEX}/fonts/type1/CJK/${FONT_NEW_NAME}

  mkdir -p ${PERSONAL_TEX}/fonts/tex/latexCJK/UTF8



  cp map_${FONT_NEW_NAME}/${FONT_MAP_NAME} ${PERSONAL_TEX}/fonts/map/dvips/CJK

  cp tfm_${FONT_NEW_NAME}/* ${PERSONAL_TEX}/fonts/tfm/CJK/${FONT_NEW_NAME}

  cp pfb_${FONT_NEW_NAME}/* ${PERSONAL_TEX}/fonts/type1/CJK/${FONT_NEW_NAME}

  cp fd_${FONT_NEW_NAME}/${FONT_FD_NAME} ${PERSONAL_TEX}/tex/latex/CJK/UTF8



#########ROOT###########

sudo texhash

updmap --enable Map ${FONT_MAP_NAME}     

fi

 

 

你可能感兴趣的:(latex)