Skip to content

Commit

Permalink
TeX 相关配置
Browse files Browse the repository at this point in the history
  • Loading branch information
lilydjwg committed Feb 9, 2011
1 parent 040ea04 commit a806820
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 47 deletions.
17 changes: 17 additions & 0 deletions autoload/texcommon.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
" Vim script file
" FileType: TeX (common file)
" Author: lilydjwg
" Maintainer: lilydjwg
" Last Change: 2011年2月9日

function texcommon#tex2pdf(cmd)
redir @">
w
lcd %:p:h
exe '!' . a:cmd . ' %'
redir END
endfunction

function texcommon#view()
silent !setsid evince %:r.pdf&
endfunction
11 changes: 7 additions & 4 deletions ftplugin/context.vim
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
" Vim script file
" FileType: ConteXt
" Author: lilydjwg <[email protected]>
" Last Change: 2010年6月5日

" Last Change: 2011年2月9日
" ---------------------------------------------------------------------
if $PATH !~ 'context'
echohl WarningMsg
echo "没有载入 ConTeXt 初始化脚本!"
echohl None
endif
runtime ftplugin/texcommon.vim

nmap <buffer> <C-CR> :call Lilydjwg_tex_pdf('texexec')<CR>
nmap <buffer> <C-F5> :call texcommon#tex2pdf('context')<CR>
" ---------------------------------------------------------------------
" Vim Modeline:
" vim:fdm=expr:fde=getline(v\:lnum-1)=~'\\v"\\s*-{20,}'?'>1'\:1
Expand Down
12 changes: 8 additions & 4 deletions ftplugin/plaintex.vim
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@
" FileType: XeTeX (plaintex)
" Author: lilydjwg
" Maintainer: lilydjwg
" Last Change: 2009年12月30日

" Last Change: 2011年2月9日
" ---------------------------------------------------------------------
runtime ftplugin/texcommon.vim

nmap <buffer> <C-CR> :call Lilydjwg_tex_pdf('xetex')<CR>
nmap <buffer> <C-F5> :call texcommon#tex2pdf('xetex')<CR>
setlocal conceallevel=2
" ---------------------------------------------------------------------
" Vim Modeline:
" vim:fdm=expr:fde=getline(v\:lnum-1)=~'\\v"\\s*-{20,}'?'>1'\:1
" ---------------------------------------------------------------------
13 changes: 8 additions & 5 deletions ftplugin/tex.vim
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@
" FileType: XeLaTeX
" Author: lilydjwg
" Maintainer: lilydjwg
" Last Change: 2009年12月30日

" Last Change: 2011年2月9日
" ---------------------------------------------------------------------
runtime ftplugin/texcommon.vim

command! -buffer Make call Lilydjwg_tex_pdf('xelatex')
nmap <buffer> <C-CR> :call Lilydjwg_tex_pdf('xelatex')<CR>
nmap <buffer> <C-F5> :call texcommon#tex2pdf('xelatex')<CR>
setlocal conceallevel=2
" ---------------------------------------------------------------------
" Vim Modeline:
" vim:fdm=expr:fde=getline(v\:lnum-1)=~'\\v"\\s*-{20,}'?'>1'\:1
" ---------------------------------------------------------------------
25 changes: 9 additions & 16 deletions ftplugin/texcommon.vim
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
" Vim script file
" FileType: XeTeX (common file)
" Author: lilydjwg
" Maintainer: lilydjwg
" Last Change: 2009年12月30日
"
function! Lilydjwg_tex_pdf(cmd)
redir @">
w
lcd %:p:h
" 目录中不要脚注
" !fixlatex.py %:r.toc
" !pdflatex %
exe '!' . a:cmd . ' %'
silent !setsid evince %:r.pdf&
redir END
endfunction
" FileType: TeX common settings
" Author: lilydjwg <[email protected]>
" Last Change: 2011年2月9日
" ---------------------------------------------------------------------
nmap <buffer> <S-F5> :call texcommon#view()<CR>
" ---------------------------------------------------------------------
" Vim Modeline:
" vim:fdm=expr:fde=getline(v\:lnum-1)=~'\\v"\\s*-{20,}'?'>1'\:1
" ---------------------------------------------------------------------
25 changes: 7 additions & 18 deletions templates/template.tex
Original file line number Diff line number Diff line change
@@ -1,18 +1,7 @@
\documentclass{article}
\usepackage[BoldFont,SlantFont,CJKnumber,CJKchecksingle]{xeCJK}
% \usepackage[unicode,pdfborder={0 0 0}]{hyperref}
\begin{document}

% \setCJKmainfont{宋体}
% \setCJKfamilyfont{hei}{黑体}
\setCJKmainfont{Adobe Song Std}
\setCJKfamilyfont{hei}{Adobe Heiti Std}
\setCJKfamilyfont{fang}{Adobe Fangsong Std}
\setCJKfamilyfont{kai}{Adobe Kaiti Std}

\XeTeXlinebreaklocale "zh"
\XeTeXlinebreakskip = 0pt plus 1pt minus 0.1pt
\setlength{\parindent}{2em}%中文缩进两个汉字位


\end{document}
\usemodule[zhfonts]
\zhfonts[rm, 11pt]

\starttext


\stoptext

0 comments on commit a806820

Please sign in to comment.