## Parse Tree in Latex

Latex 真的是什麼都有XD
 The parsetree Package for Drawing Trees in LaTeX
[ LaTeX for Linguists.dvi.ps.pdfTestFile]

• Basic Use

• Interaction with other packages
• Boxes, Subscripts, Unlabelled Nodes

• AVMs on Nodes

• Special Characters in Node Labels

• Non-Local Lines

• This is my favoured and recommended method for drawing standard linguistic trees where the nodes have less than three daughters. It is very simple, and interacts well with other packages. Here is a simple example.

\begin{parsetree}
( .S.
(.NP.  we')
( .VP.
(.V.    gave' )
(.NP.   them')
(.NP. ~ a toy')
)
)
\end{parsetree}

Apart from information on basic usage you will find information about the use of the package for more complex examples, and use in conjunction with avm.sty, and tree-dvips) for drawing really rather complicated things.
The package is available from the usual archive sites, but I have not been able to find documentation other than what is in the source code. So I have made this up myself. My apologies to the author (Eirik Hektoen) for misrepresentations.
This documentation is available in printed form: PostScript and DVI. The style/package file parsetree.sty is also available here.

# Basic Use

In the preamble, put:
\usepackage{parsetree}

In the text put:
\begin{parsetree}
( .S.
(.NP.  we')
( .VP.
(.V.    gave' )
(.NP.   them')
(.NP. ~ a toy')
)
)
\end{parsetree}

Basic usage is as follows:
• \begin{parsetree}...\end{parsetree}
• A (sub-) tree consists of a "(", a node label, some daughters, and a ")".
• A terminal node consists of just the node label. Terminal node labels are written in quotes: baby'gave'
• Non-terminal node labels are surrounded by dots, e.g. .S.,
• Putting a ~ before a node label puts it under a triangle, rather than a vertical line.
• Node labels can be arbitrarily complex (see examples below).
• Warning: no more than tree daughters are allowed per node.
• Warning: don't use "(", or ")", or "." or "~" inside node labels (see below on how to avoid this restriction).
• The following commands can be used to vary the appearance of trees, see below for examples of their use. \pthorgap horizontal gap between sisters (default 12pt) \ptvergap vertical gap between mother/daughter (default 12pt) \ptnodefont font and strut height/depth of non-terminal nodes \ptleaffont fond and strut height/depth of leaves
Here are some more simple examples:
\begin{parsetree}
(.S. .NP. .VP.)
\end{parsetree}


\begin{parsetree}
(.NP. Sam')
\end{parsetree}


# Interaction with other packages

Node labels can be arbitrarily complicated. Just to give you an idea, the following examples show nodes containing arrays, co-indexing subscripts, and frame boxes, and nodes without node lables; nodes labelled with feature structures (made with the avm.sty package); node labels containing round brackets and other characters that parsetree treats specially; and nodes with lines linking remote parts of the tree (made with the tree-dvips package).

## Boxes, Subscripts, Unlabelled Nodes

An example with some nodes boxed, and some nodes unlabelled (just put nothing between the .' and .'):
\begin{parsetree}
( .\begin{tabular}{c}S\\TNS=pres\\asp=simple\end{tabular}.
(.\fbox{NP$_i$}. .the baby.)
( . .
(. . .gave. )
(.\fbox{NP$_{j , {j \neq i}}$}.
.the baby. )
(. . .a toy.)
)
)
\end{parsetree}


## AVMs on Nodes

For making trees labelled with AVMs (Feature Structures), a useful hint is to first use \newcommand to define commands to draw the AVMs (this means you can check they are correct before you try to combine them into a tree), and makes the tree much easier to read.
We define three commands to draw the AVMs: \fsA\fsB, and \fsC, e.g.
\newcommand{\fsB}{\begin{avm}
\sort{f}{$cat & det \\ agr & \@1 \\ def & \@2$ }
\end{avm} }

One can, of course test these just by putting:
\fsA
\fsB
\fsC

To draw the tree, we put these commands in the node labels, preceded by some commands to adjust the space between nodes (see below):

\begin{parsetree}
\pthorgap{75pt}
\ptvergap{40pt}
( .\fsA .
.\fsB .
.\fsC .
)
\end{parsetree}

This example uses the parsetree declarations: \pthorgap and \ptvergap:
• The gap between sisters is controlled by the \pthorgap declaration (default is 12pt)
• The vertical distance between mother and daughters is controlled by the \ptvergap declaration (default is 12pt).
These can be set globally, or anywhere within individual parsetree environments.You can also alter the font and height/depth allowed for non-terminal node labels and leaves with \ptnodefont and \ptleaffont. The following are the defaults:
\ptnodefont{\normalsize\rm}{11pt}{3pt}  % font and strut height/depth: nodes
\ptleaffont{\normalsize\it}{11pt}{3pt}  % font and strut height/depth: leaves


## Special Characters in Node Labels

Parsetree treats some characters specially (e.g. round brackets, dot, tilde), using them as commands to draw trees. This can be a problem if you want these characters in your trees. However, there is a simple solution.
The parsetree environment is simply a wrapper that: (a) makes these special characters active' (i.e. special), and (b) calls the commands\ptbegtree \ptendtree at the beginning and end of the environment respectively. If we use these latter commands directly, then these special characters retain their normal meanings, and can appear in node lables. However, we must now use the underlying parsetreecommands to draw the tree:
• replace "(" with \ptbeg, and ")" with \ptend
• replace .N. by \ptnode{N}.
• replace N' by \ptleaf{N}.
• replace ~ with \pttritrue
Here is our original example:

\ptbegtree
\ptbeg \ptnode{S}
\ptbeg \ptnode{NP}  \ptleaf{we} \ptend
\ptbeg \ptnode{VP}
\ptbeg \ptnode{V}    \ptleaf{gave}  \ptend
\ptbeg \ptnode{NP}   \ptleaf{them}  \ptend
\ptbeg \ptnode{NP} \pttritrue  \ptleaf{a toy} \ptend
\ptend
\ptend
\ptendtree

And here is an example, with special' characters thrown in:

\ptbegtree
\ptbeg \ptnode{(VP)}
\ptbeg \ptnode{(V)}    \ptleaf{(saw)}  \ptend
\ptbeg \ptnode{NP}     \ptleaf{Sam's~~~toy.} \ptend
\ptend
\ptendtree

Here is a more complicated and realistic example (to simplify things, I have defined \npile to produce a node label consisting of an array -- of course, with something this complicated, you would probably want to simplify things even further, but this is just for exemplification).
\newcommand{\npile}[1]{%
\ptnode{               %
$$\begin{array}{c}#1% \end{array} %$$   }}


\ptbegtree
\ptbeg
\npile{S\\
see' (s, k)\\
\lambda y see' ( y,k ) (s)}
\ptbeg
\npile{NP\\s}
\npile{Sam\\s}
\ptend
\ptbeg
\npile{VP\\ \lambda y see' ( y,k )\\
\lambda x \lambda y see' ( y,x ) (k)}
\ptbeg
\npile{V\\ \lambda x \lambda y see' ( y,x ) }
\npile{saw\\ \lambda x \lambda y see ( y,x )}
\ptend
\ptbeg
\npile{NP\\k}
\npile{Kim\\k}
\ptend
\ptend
\ptend
\ptendtree


## Non-Local Lines

The tree-dvips package can be used to draw non-local' lines, as in the following example, supposed to show something like "Quantifier Raising":

\begin{parsetree}
( .S.
(.NP. ~ .\node{1}{\strut every baby}. )
(.S.
(.NP. .a baby.)
( .{VP}.
(.V. .{gave}. )
(.NP. .every child.)
(.NP. .\node{2}{\strut t}.)
)
)
)
\abarnodeconnect[-10pt]{2}{1}
\end{parsetree}

Here is a more complicated example:
\begin{parsetree}
( .\node{1}{S}.
( .\node{2}{NP$_i$}. .the baby.)
( .\node{3}{VP}.
(.\node{4}{V}. .\node{5}{gives}. )
(.NP$_j$. .the baby.)
(.NP. .a toy.)
)
)
\anodecurve[tl]{2}[bl]{1}{20pt}
\anodecurve[r]{1}[t]{3}{20pt}
\anodecurve[bl]{3}[t]{4}{20pt}
\anodecurve[bl]{4}[l]{5}{20pt}
\end{parsetree}


LaTeX for Linguists,
Doug Arnold,
doug@essex.ac.uk,
November 30, 2009.

## C code in latex

\documentclass[a4paper,10pt]{article}
\usepackage[utf8x]{inputenc}

\usepackage{listings}

\begin{document}

\lstset{language=C,frame=single,numbers=left,tabsize=2}
\begin{lstlisting}
#include
#include
#include

int
max(int a, int b)
{
if(a>b) return a;
else return b;
}

void
reconstruct(char *x, char *y,
int table[strlen(x)+1][strlen(y)+1])
{
int n=strlen(x),m=strlen(y),i,j,currentChar;
int maxlcs=table[n][m];
char* lcschar=(char*)malloc((maxlcs+1)*sizeof(char));
*(lcschar+maxlcs)='\0';

currentChar=0;
i=0;
j=0;

while(currentChar
{
if( *(x+i) == *(y+j) )
{
*(lcschar+currentChar)=*(x+i);
currentChar++;
//printf("%c\n",*(x+i));
i++;
j++;
}
else if(table[i+1][j] >= table[i][j+1]) i++;
else j++;
}
printf("%s\n",lcschar);
free(lcschar);
}

int
lcs(char *x,char *y)
{
//printf("%zu\n",strlen(x));
int n=strlen(x), m=strlen(y), i, j, table[n+1][m+1];
for(i=0;i<=n;i++) table[i][0]=0;
for(j=0;j<=m;j++) table[0][j]=0;
for(i=1;i<=n;i++)
for(j=1;j<=m;j++)
if( *(x+i) == *(y+j) ) table[i][j]=1+table[i-1][j-1];
else table[i][j]=max(table[i-1][j], table[i][j-1]);

reconstruct(x,y,table);
return table[n][m];
}

void
main()
{
//printf("%d\n",res);
}
\end{lstlisting}

\end{document}

## Gas Tex TXT

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%% GasTeX : Graphs and Automata Simplified in TeX

## GasTex Example(For Automata)

http://www.liacs.nl/~hoogeboo/praatjes/gastex/

GasTeX (Graphs and Automata Simplified in TeX, by Paul Gastin) is a package for drawing figures with a LaTeX interface and the help of Postscript. Everyone that needs to draw automata in his LaTeX documents on a regular basis should have a look at this package.
The examples below are mainly to remind me of the possible settings for figures I sometimes need.

\begin{figure}[H]
\begin{center}
\unitlength=4pt
\begin{picture}(15, 28)(0,-10)
\gasset{Nw=5,Nh=5,Nmr=2.5,curvedepth=3}
\thinlines
\node(A0)(7.5,0){$0$}
\node[Nmarks=i,iangle=90](A1)(0,13){$1$}
\node[Nmarks=if,iangle=90,fangle=90](A2)(15,13){$2$}
\drawloop[loopangle=180](A1){$a$}
\drawloop[loopangle=0](A2){$b$}
\drawedge(A1,A2){$a$}
\drawedge(A2,A1){$b$}
\drawedge(A2,A0){$a$}
\gasset{curvedepth=-3}
\drawedge[ELside=r](A1,A0){$b$}
\drawloop[loopangle=270](A0){$a, b$}
\end{picture}
\end{center}
\caption{La complétion de l'automate.}
\end{figure}

 Code binary relation Code binary tree (post order) Code undirected graph (a) Code undirected graph (b) Code undirected graph (c - linear) Code fsa (final 0 or even 1's) Code fsa (subword 00 or even 1's) Code fsa (ends in a - - , deterministic) Code cube (strings Hamilton dist 1) Code CMB Euler path Code CMB probes (A..G) and clones (1..6) Code CMB PQ trees Code Hilbert curve (tiles)

## Latex Makefile

all:
latex *.tex
dvips *.dvi
ps2pdf &.ps
epdfview *.pdf

## Install Latex package

Put them here

/usr/share/texmf-tetex/tex/latex/base/

## [轉錄] Latex Matrix

### Matrices and other arrays in LaTeX

Matrices and other arrays are produced in LaTeX using the \textbf{array} environment. For example, suppose that we wish to typeset the following passage:
This passage is produced by the following input:
The \emph{characteristic polynomial} $\chi(\lambda)$ of the
$3 \times 3$~matrix
$\left( \begin{array}{ccc} a & b & c \\ d & e & f \\ g & h & i \end{array} \right)$
is given by the formula
$\chi(\lambda) = \left| \begin{array}{ccc} \lambda - a & -b & -c \\ -d & \lambda - e & -f \\ -g & -h & \lambda - i \end{array} \right|.$

First of all, note the use of \left and \right to produce the large delimiters around the arrays. As we have already seen, if we use
\left) ... \right)
then the size of the parentheses is chosen to match the subformula that they enclose. Next note the use of the alignment tab character & to separate the entries of the matrix and the use of \\ to separate the rows of the matrix, exactly as in the construction of multiline formulae described above. We begin the array with \begin{array} and end it with \end{array}. The only thing left to explain, therefore, is the mysterious {ccc} which occurs immediately after \begin{array}. Now each of the c's in {ccc} represents a column of the matrix and indicates that the entries of the column should be centred. If the c were replaced by l then the corresponding column would be typeset with all the entries left-justified, and r would produce a column with all entries right-justified. Thus
$\begin{array}{lcr} \mbox{First number} & x & 8 \\ \mbox{Second number} & y & 15 \\ \mbox{Sum} & x + y & 23 \\ \mbox{Difference} & x - y & -7 \\ \mbox{Product} & xy & 120 \end{array}$

produces

We can use the array environment to produce formulae such as
Note that both columns of this array are set flush left. Thus we use {ll} immediately after \begin{array}. The large brace is produced using\left\{. However this requires a corresponding \right delimiter to match it. We therefore use the \emph{null delimiter} \right. discussed earlier. This delimiter is invisible. We can therefore obtain the above formula by typing
$|x| = \left\{ \begin{array}{ll} x & \mbox{if x \geq 0};\\ -x & \mbox{if x < 0}.\end{array} \right.$ 

## [轉錄]Latex image inside table

Pictures do not necessarily have to be placed inside the figure environment, but can perfectly be included inside table cells.

The advantage is, you can without any effort arrange a series of images in a matrix and individually scale them.

And here is how you would do it: You first need the graphicx package to include graphics:

\usepackage{graphicx}

\begin{table}[ht]

\caption{A table arranging images}
\centering
\begin{tabular}{cc}
\includegraphics[scale=1]{graphic1}&\includegraphics[scale=1]{graphic2}\\
\newline
\includegraphics[scale=1]{graphic3}&\includegraphics[scale=1]{graphic4}\\
\end{tabular}
\label{tab:gt}

\end{table}%

Note: In order to have visual borders, you would have \hline instead of \newline and use horizontal bars in the column definition of the tabular environment (“|c|c|” instead of “cc”).

The downside of this technique is obvious, you do not have access to features provided by the figure environment like a label or caption. Nevertheless, it might still come in handy in certain situations.

Note: The figures will not appear in the \listoffigures index, for the reason mentioned above.

## [轉錄]Lists: Enumerate, itemize, description and how to change them

Latex distinguishes between three different enumeration/itemization environments. Each of them provide four levels, which means you can have nested lists of up to four levels.
Enumerate:
\begin{enumerate} \item ... \end{enumerate}
The enumerate-environment is used to create numbered lists.
If you like to change the appearance of the enumerator, the simplest way to change is to use the enumerate-package, giving you the possibility to optionally choose an enumerator.
 \usepackage{enumerate} ... \begin{enumerate}[I]%for capital roman numbers. \item \end{enumerate}
\begin{enumerate}[(a)]%for small alpha-characters within brackets. \item \end{enumerate}
Itemize:
\begin{itemize} \item ... \end{itemize}
Itemization is probably the mostly used list in Latex. It also provides four levels. The bullets can be changed for each level using the following command:
Amongst the more commonly used ones are $\bullet$ ($\bullet$), $\cdot$ ($\cdot$),$\diamond$ ($\diamond$), $-$ ($-$), $\ast$ ($\ast$) and $\circ$ ($\circ$).
Description:
\begin{description} \item[] ... \end{description}
The description list might be the least known. It comes in very handy if you need to explain notations or terms. Its neither numbered nor bulleted.
Example:
\begin{description} \item[Biology] Study of life. \item[Physics] Science of matter and its motion. \item[Psychology] Scientific study of mental processes and behaviour. \end{description}
And in a PDF it would look like this:
Example of a description list.
Note:
The space between different items can be controlled with the \itemsep command (can only be added just after “begin”):
\begin{itemize}\itemsep2pt \item \end{itemize}

## latex中文目錄

當在編輯目錄時
要讓本來是英文的目錄標題變成中文
只需重新命名就好了
\renewcommand\contentsname{目錄}
\renewcommand\listfigurename{圖目錄}
\renewcommand\listtablename{表目錄}
LaTex 預設生成的目錄會長這樣1　簡介
1.1　研究背景
1.2　研究動機
為了要符合中文樣式
將 "1　簡介" 改成 "第一章　簡介"
可以這樣改寫
%使用 titletoc 這一個 package \usepackage{titletoc}\titlecontents{chapter}
[0em]
{}
{第\CJKnumber{\thecontentslabel}章~~}
{}{\titlerule*{.}\contentspage}
\titlecontents{section}
[4em]
{}
{\contentslabel{2em}}
{}{\titlerule*{.} \contentspage}
\titlecontents{subsection}
[8em]
{}
{\contentslabel{3em}}
{}{\titlerule*{.} \contentspage}
此外一般我們中文的圖、表目錄
都會習慣寫成
圖1.1
表1.1
而 LaTex 預設是沒有那些圖、表的文字，只有顯示數字
因此必須要修改一下
\newcommand{\loflabel}{圖}
\newcommand{\lotlabel}{表}
在圖目錄的地方插入這二行
\renewcommand{\numberline}[1]{\loflabel~#1\hspace*{1em}}
\listoffigures
在表目錄的地方插入這二行
\renewcommand{\numberline}[1]{\lotlabel~#1\hspace*{1em}}
\listoftables

## 解決index的中文問題

> i run latex on the file.. it runs file; then i run makeindex on the
> file, it runs fine.  then i run latex on the file again, and it
> starts complaining.

makeidx.sty uses \write, (not \immediate\write) for index entries
which means that the output to the index file is delayed until the
whole page is output.  You thus have to do two things.

. Move \printindex into a CJK environment

. Insert \newpage after \printindex.

Below is my (slightly changed) version which works just fine.

Werner

======================================================================

\documentclass[12pt]{article}

\usepackage{CJKutf8}
\usepackage{pinyin}
\usepackage[vietnam]{babel}
\usepackage{makeidx}

\makeindex

\begin{document}

\begin{CJK}{UTF8}{bsmi}

我是美國人\index{美國 mỹ quốc}

我不會說中文\index{cannot speak}

\printindex
\newpage

\end{CJK}

\end{document}

%%% Local Variables:
%%% coding: utf-8
%%% mode: latex
%%% TeX-master: t
%%% End:

## [轉錄] Simple FlowChart using Latex




## error: gnu/stubs-32.h:No such file or directory

解決的方法是裝一些套件

sudo apt-get install libc6-dev-i386
sudo apt-get install g++-4.4-multilib lib32z1-dev lib32ncurses5-dev

這樣就可以了~

## [轉錄]Watch “ppt157: Everything in this video is a PowerPoint Template”

We made a little video about these 157 free templates that are available for PowerPoint 2007. There are a lot of them, so they are broken down into 8 download sets. Each set below has a download link, previews, and complete instructions for customizing. If you just want to download the sets, go here.

--Doug Thomas & Eric Schmidt
find more free templates at office.com/templates

# Geometry套件入門

## 前言

LaTeX的排版功能當然很強，很多時候，你也不用設定什麼，用現成的格式，就可以做出不錯的文章。
不過呢，我們多多少少有要自訂邊界啦，文字範圍擴大啦等等的需求。你心裡可能會想，這LaTeX當然不會有問題... 你這麼想，只對了一半！
是的，LaTeX當然可以自訂邊界，可以訂你想定的任何東西。但是，整個LaTeX設定排版的方式非常複雜。最重要的是，很多變數是相互關聯的。
也就是說，你好不容易翻到要改變某個邊界大小的方法。結果一用之下，和你想像的可能是完全不一樣！在改來改去之後，你終於放棄...
事實上呢，有很方便的改法。就是用一個叫 geometry 的套件。這個套件在許多LaTeX都是標準套件，所以你可能不用特別去安裝。

## 開始

我們使用 geometry 套件，至少有兩種方法。一種是先宣告使用 geometry 套件，再下排版指令；一種是第一次使用就下指令。為了避免困擾，我就只用第二種方式。
我們在LaTeX檔案前面加入這一行：
\usepackage[你要下的參數]{geometry}

這方括孤中「你要下的參數」當然不是打入這些中文，而是下面我們要介紹的幾個常用設定。

## 常用參數集

這裡我們介紹常用的參數。如果要加入兩個以上的指令，請用逗號分開。
a4paper 指定使用A4紙張
margin=1in 把四邊邊界都設成 1英吋（當然可改數字，後不再說明）
left=1in 把左邊邊界設成 1英吋
right=1in 把右邊邊界設成 1英吋
hmargine=1in 把左右邊界都設成 1英吋
top=1in 把上方邊界設成 1英吋
bottom=1in 把下方邊界設成 1英吋
vmargin=1in 把上下方邊界都設成 1英吋

萬一，我們想要在左右留個裝訂的空間，該如何設呢？很容易，就是加入以下設定
bindingoffset=0.5in

這樣一來，在奇數頁左邊，偶數頁的右邊，會多出0.5英吋的裝訂空間。
geometry 套件還有許多的功能，請自行參考使用說明。

## [轉錄] cwTex 字型

cwTeX[1] Type 1 字型（cwt1）
Version 1.1

Copyright (c) 1999-2004 Tsong-Min Wu, Tsong-Huey Wu.
Copyright (c) 2005-2007 Tsong-Min Wu, Tsong-Huey Wu and Edward G.J. Lee.

COPYING 檔）。可自由重製、修改、散佈。如果沒有收到這個 COPYING 檔，

Free Software Foundation
51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA

索取。

這些字型允許嵌入 ps/pdf（及其他相類的）檔案中而不因此影響文件或文件
格式本身所使用的授權（許可證）。

這些字型並不明示或暗示有任何的保證，請詳見 COPYING 檔。

摘要：
-----

這五套 Type1 字型是由 cwttf[2] 字型轉換而來。用於 LaTeX CJK 套件。

CJK 字型檔名　　中文字體

[Big5/UTF8 環境皆使用相同的字型名，以下為標點符號置中]
cwmc 　　　　　　明體
cwkc 　　　　　　楷書
cwfsc　　　　　　仿宋體
cwhbc　　　　　　粗黑體
cwyc 　　　　　　圓體

[以下為標點符號置於底線]
cwmb 　　　　　　明體
cwkb 　　　　　　楷書
cwfsb　　　　　　仿宋體
cwhbb　　　　　　粗黑體
cwyb 　　　　　　圓體

命名原則：
---------

cw 代表 cwTeX。
m, k, fs, hb, y 代表明，楷，仿宋，粗黑，圓。
c, b 代表標點符號置中（center），置底線（baseline）。

1.1 變動：
---------

1. 不管 UTF8/Bg5 環境，皆使用相同的字型名。
2. 不再製斜體字，請使用其他相當的中文字型代替。
3. 標點符號由所使用的字型名來區分，字型名最後為 c(center) 代表置
中，b(baseline) 代表置於底線。字型本體只使用一種，其他不管是
不同編碼或不同標點符號系統皆使用用虛擬字型，以便節省字型空間。
兩種標點符號系統可以同時存在於同一文件中。

下載處：
-------

site1： ftp://cle.linux.org.tw/tex/cjk/fonts/cwt1
site2： http://edt1023.sayya.org/fonts/tex/cwt1

安裝：
-----

tar zxvf cwX-1.1.tar.gz
cd cwX-1.1
./install.sh
移除：
./uninstall.sh

TeX Live 2007 的使用者，請修改 texmf.cnf，在 TEXMFDBS 最後加入
!!TEXMFHOME：

-TEXMFDBS = {[省略]!!$TEXMFMAIN,!!$TEXMFLOCAL,!!$TEXMFDIST} +TEXMFDBS = {[省略]!!$TEXMFMAIN,!!$TEXMFLOCAL,!!$TEXMFDIST,!!$TEXMFHOME} Have fun! 問題回報： 李果正 Edward G.J. Lee 〈edt1023_AT_cle.linux.org.tw〉 [1] http://ccms.ntu.edu.tw/~ntut019/cwtex/cwtex.html [2] http://cle.linux.org.tw/fonts/cwttf/ ## [轉錄] Ubuntu 為 latex 新增中文字型 # 小頭的UBUNTU筆記本 轉錄至以上部落格:) 以新增 utf8 nsung 字型(nsungu)為例 字型載點 http://cle.linux.org.tw/fonts/FireFly/type1/ cd ~/ wget http://cle.linux.org.tw/fonts/FireFly/type1/nsungu-1.3.0.tar.gz tar xvzf nsungu-1.3.0.tar.gz 在解開的 nsungu資料夾中, 有幾種檔案 數個小檔 *.afm, *.tfm, *.pfb, *.enc 以及 nsungu.map, nsungu.fd 分別把它們放到對的地方, 設定一下 重整 tex系統即可 ==== 可以先設定好目錄變數 SYSTEXMF=/usr/share/texmf 1. 移動 *.afm cd ~/nsungu sudo mkdir$SYSTEXMF/fonts/afm/CJK/nsungu
sudo mv *.afm $SYSTEXMF/fonts/afm/CJK/nsungu 2. 移動 *.tfm sudo mkdir$SYSTEXMF/fonts/tfm/CJK/nsungu
sudo mv *.tfm $SYSTEXMF/fonts/tfm/CJK/nsungu 3.移動 *.pfb sudo mkdir$SYSTEXMF/fonts/type1/CJK/nsungu
sudo mv *.afm $SYSTEXMF/fonts/type1/CJK/nsungu 4.移動 *.enc sudo mkdir$SYSTEXMF/fonts/enc/CJK/nsungu
sudo mv *.afm $SYSTEXMF/fonts/enc/CJK/nsungu 5.移動 .map, .fd sudo mv c70nsungu.fd$SYSTEXMF/tex/latex/CJK/UTF8/
sudo mv nsungu.map $SYSTEXMF/fonts/map/dvips/CJK 6.設定 //編輯並新增 sudo nano$SYSTEXMF/dvips/config/config.nsungu
內容為
p +nsungu.map

sudo nano /etc/texmf/updmap.d/10nsung.cfg
內容為
Map nsungu.map

7. 更新 tex系統
sudo texhash
sudo update-updmap
sudo updmap-sys