# VSCode + LaTex 中文字體解決方案 (Ubuntu 16.04) ### 1. 下載中文字體 先從網路上找到喜歡的字體,這邊我是下載Google 與Adobe 所開發的字體「思源宋體」。 首先到[Google Noto 字型網站](https://www.google.com/get/noto/),之後搜尋「Noto Serif CJK TC」,便可找到該字體的下載檔。 下載之後解壓縮成一個資料夾。 ### 2.安裝字型 移動上一步所解壓縮的資料夾到Ubuntu 存放字體的目錄之下。 打開Terminal 輸入: ```terminal $ sudo mv <字體資料夾目錄> </usr/share/fonts/truetype/> ``` 確定該字體資料夾已經移動之後,依序輸入以下3個指令: ```terminal $ sudo mkfontscale $ sudo mkfontdir $ sudo fc-cache -f - v ``` 之後確認已安裝字體。 ```terminal $ fc-list :lang=zh-cn ``` ![](https://i.imgur.com/uodinFL.png) 由上圖可以發現已經安裝好NotoSerifCJKtc-hinted 字體。 ### 3. 在LaTex檔中設定 打開欲編輯(缺字)之tex檔,於 \documentclass 之下添加package: ``` \usepackage{xeCJK} \setCJKmainfont{NotoSerifCJKtc-Medium} ``` 其中「NotoSerifCJKtc-Medium」可替換成「思源宋體」其他字型,如:「NotoSerifCJKtc-Black」或是「NotoSerifCJKtc-Light」等。 ### 4.參考資料 以上資料參考於 > http://www.voidcn.com/article/p-oynozthn-dr.html > https://www.playpcesor.com/2017/04/google-adobe-noto-Serif-CJK-download.html > 上科大神