Re: [問題] 中英文可以分別使用不同字型嗎?

看板LaTeX (論文排版)作者 (Myrmarachne)時間16年前 (2009/01/17 19:14), 編輯推噓2(202)
留言4則, 3人參與, 最新討論串2/7 (看更多)
※ 引述《sdlinux (sdlinux)》之銘言: : 請問一下歐! : 在xelatex中 (或其他latex系統) 可以針對中英文分別使用不同的字型嗎? : 像是中文用標楷體,英文用times new roman : 在此先感謝大家的回答啦 新的 CJK package 已經和 xelatex 整合了:xCJK。 http://tug.ctan.org/cgi-bin/ctanPackageInformation.py?id=cjk 你看了解一下 fontspec package 的用法, 再看看以下的網頁: http://tug.ctan.org/get/language/chinese/CJK/cjk-4.8.2/doc/xCJK.txt 網頁中提到了三個新命令: \setCJKmainfont[<font features>]{<font name>} \setCJKfamilyfont{<family name>}[<font features>]{<font name>} \setCJKmonofont[<font features>]{<font name>} 以及二個 options: boldfont italicfont 至於我說你可以先了解 fontspec package 的用法, 是因為 fontspec package 的用法可以套用在 <font features> 裡面。 以下是一個我自己的例子。 我在 mactex (也同於 texlive 2008)上, 已經有 bsmi 這個傳統 CJK 字體(也就是 AR PL New Sung)。 另外,我也自行在作業系統中安裝以下數種 TTF 或 OTF 字型: TeX Gyre Termes(自由的 Times Roman) TeX Gyre Heros(自由的 Helvetica) Tex Gyre Cursor(自由的 Courier) AR PL New Sung AR PL New Kai ==範例開始== \documentclass[10pt]{article} \usepackage[T1]{fontenc} \usepackage{mathptmx}% 設定數學式為 Times Roman \usepackage{xunicode,xltxtra,fontspec}% 引入 xelatex 相關 package \usepackage[boldfont]{xCJK}% 引入 xCJK packge。至於 boldfont 請看先前說明。 %xetex 的一些基本設定 \XeTeXinputencoding "utf8" \XeTeXdefaultencoding "utf8" \XeTeXlinebreaklocale "zh" %利用 fontspec 設定英文字型 \setmainfont[Mapping=tex-text]{TeX Gyre Termes} \setsansfont[Mapping=tex-text,Scale=0.92]{TeX Gyre Heros} \setmonofont[Ligatures=NoCommon,Scale=0.9,Kerning=Off]{Tex Gyre Cursor} %利用 xCJK 與 fontspec 設定中文字型 \setCJKmainfont[ Scale=1, ItalicFont={AR PL New Kai}, ItalicFeatures={Scale=0.96}, BoldFont={AR PL New Sung}, BoldFeatures={FakeBold=2,LetterSpace=-40}, BoldItalicFont={AR PL New Kai}, BoldItalicFeatures={FakeBold=2,FakeSlant=0.18,LetterSpace=-40}, ]{AR PL New Sung} \setCJKmonofont{AR PL New Sung} \begin{document} \begin{CJK}{UTF8}{bsmi} \CJKtilde \large \normalfont 內文~ABC123, {\bfseries 內文~ABC123}, {\itshape 內文~ABC123}, {\bfseries\itshape 內文~ABC123}; \sffamily 內文~ABC123, {\bfseries 內文~ABC123}, {\itshape 內文~ABC123}, {\bfseries\itshape 內文~ABC123}; \ttfamily 內文~ABC123, {\bfseries 內文~ABC123}, {\itshape 內文~ABC123}, {\bfseries\itshape 內文~ABC123}; \[PV=nRT\;\mbox{我唯一記得的化學式}\] \clearpage \end{CJK} \end{document} ==範例開始== 成果在此: 原檔:http://docs.google.com/View?docid=dhh7t4qb_13d4stb4g3 PDF:http://www.scribd.com/doc/10703106/xcjkpdf -- http://apansharing.blogspot.com/ -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 122.125.195.80

01/18 23:43, , 1F
01/18 23:43, 1F

01/19 07:57, , 2F
唯一記得的化學式XD 我都忘了
01/19 07:57, 2F

01/19 12:59, , 3F
這個實在太棒了…一直找不到這個。不過…MiTeX裡好像
01/19 12:59, 3F

01/19 13:01, , 4F
xCJK耶,有得下載嗎?
01/19 13:01, 4F
文章代碼(AID): #19SRs6s9 (LaTeX)
討論串 (同標題文章)
文章代碼(AID): #19SRs6s9 (LaTeX)