2016年4月7日 星期四

latex:texlive+texmaker

$apt-get install textlive-full
$apt-get install texmaker
就可以使用了

在xelatex裡使用中文字型:
\usepackage{fontspec}   %加這個就可以設定字體
\usepackage{xeCJK}       %讓中英文字體分開設置
\setmainfont{Times New Roman}  %設定英文字型,不設的話就會使用預設的字型
\setCJKmainfont{AR PL UKai TW} %設定中文為系統上的字型,而英文不去更動\XeTeXlinebreaklocale "zh"             %這兩行一定要加,中文才能自動換行
\XeTeXlinebreakskip = 0pt plus 1pt     %這兩行一定要加,中文才能自動換行



安裝Times New Roman字型:
$apt-get install ttf-mscorefonts-installer


列出字型列表
$cf-list

中文字型名稱:
標楷體:Kai相關詞
細明體:Ming相關詞
例如:
$fc-list | grep Kai
/usr/share/fonts/truetype/arphic/ukai.ttc: AR PL UKai CN:style=Book
/usr/share/fonts/truetype/arphic/ukai.ttc: AR PL UKai HK:style=Book
/usr/share/fonts/truetype/arphic/ukai.ttc: AR PL UKai TW:style=Book
/usr/share/fonts/truetype/arphic/ukai.ttc: AR PL UKai TW MBE:style=Book
$ fc-list | grep Ming
/usr/share/fonts/truetype/arphic/uming.ttc: AR PL UMing TW MBE:style=Light
/usr/share/fonts/truetype/arphic/uming.ttc: AR PL UMing TW:style=Light
/usr/share/fonts/truetype/arphic/uming.ttc: AR PL UMing CN:style=Light
/usr/share/fonts/truetype/arphic/uming.ttc: AR PL UMing HK:style=Light



ref:
[1]http://pangomi.blogspot.tw/2012/11/latex-in-ubuntu.html
[2]http://leavedcorn.pixnet.net/blog/post/24773932

2016年3月27日 星期日

各種vim plugin


Vim:文字編輯工具
Trinity:管理Source Explorer+Tag List+NERD_tree的工具
Source Explorer:自動顯示cursor上symbol定義的工具
NERD_tree:把資料夾目錄顯示出來的plugin
Tag List:可以看見ctag資料的vim plugin





[1]http://stenlyho.blogspot.tw/2010/03/vim-trinity-source-explorer-tag-list.html
[2]http://www.openfoundry.org/tw/tech-column/2244--vim-plugin

ctags 與 cscope 使用筆記

ctags 和 cscope 是兩款相當強大的原始碼追蹤工具

ctags:
主要功能有兩個,從函式呼叫處跳回函式實做的地方,還有跳出視窗補完結構中的成員(ex: struct. 或 struct->)

    install: $sudo apt-get install exuberant-ctags

使用:
    建立tag檔案:ctags <指令> <指定的檔案>
                     ex: ctags -R ./folder/*.[ch]
    接下來就可以在vim中使用它了
    常用指令(在vim command mode下)
                  [移動游標到指定位置] [CTRL] + ]  移動到定義處
                  [移動游標到指定位置] [CTRL] +t   返回上一個位置


cscope:
主要功能是可以跳到任何一個有呼叫這個函式的位置,是個很強大的原碼追蹤工具

    install: $apt-get install cscope

使用:
    使用前要先設定vim plugin:把 cscope_maps.vim 加到 ~/.vim/plugin中
                                               (沒有的話可以自行建立)
    需要建立ctag檔案:cscope <指令> <檔案位置>
                           ex: cscope -Rbqk ./folder/*.[ch]
    接下來就可以在vim中使用plugin提供的功能(ref. [4])



Reference:
[1]http://stackoverflow.com/questions/934233/cscope-or-ctags-why-choose-one-over-the-other
[2]http://rickey-nctu.blogspot.tw/2009/02/vim-srcexpl.html
[3]http://cscope.sourceforge.net/cscope_vim_tutorial.html
[4]http://softsmith.blogspot.tw/2009/01/vim-cscope-trace.html
[5]http://easwy.com/blog/archives/advanced-vim-skills-cscope/