1、寫乙個hello.tex檔案,內容為
/documentclass
/begin
你好,/latex !
/end
2、寫乙個hello_cn.tex檔案,
/documentclass
/usepackage
/begin
/begin
你好,/latex !
/end
/end
各種編譯方法的結果如下所示:
檔名編碼
編譯命令
編譯結果
輸出結果
hello
ansi
latex
成功中文正確顯示
hello
ansi
xelatex
成功中文未顯示
hello
utf8
latex
報錯hello
utf8
xelatex
成功中文正確顯示
hello_cn
ansi
latex
成功中文正確顯示
hello_cn
ansi
xelatex
成功中文未顯示
hello_cn
utf8
latex
報錯hello_cn
utf8
xelatex
成功中文未顯示
總結,書寫中文文件有幾種辦法:
1、文件類別採用article或者book時,需要自行匯入cjk巨集包,必須用ansi編碼,且只能用latex命令編譯。
2、文件類別用ctexbook時,則已自動匯入cjk巨集包並進入cjk環境,如果用latex編譯,則儲存時應選擇ansi編碼;如用xelatex命令編譯,則儲存時應選擇utf8編碼。
1、寫乙個hello.tex檔案,內容為
/documentclass
/begin
你好,/latex !
/end
2、寫乙個hello_cn.tex檔案,
/documentclass
/usepackage
/begin
/begin
你好,/latex !
/end
/end
各種編譯方法的結果如下所示:
檔名編碼
編譯命令
編譯結果
輸出結果
hello
ansi
latex
成功中文正確顯示
hello
ansi
xelatex
成功中文未顯示
hello
utf8
latex
報錯hello
utf8
xelatex
成功中文正確顯示
hello_cn
ansi
latex
成功中文正確顯示
hello_cn
ansi
xelatex
成功中文未顯示
hello_cn
utf8
latex
報錯hello_cn
utf8
xelatex
成功中文未顯示
總結,書寫中文文件有幾種辦法:
1、文件類別採用article或者book時,需要自行匯入cjk巨集包,必須用ansi編碼,且只能用latex命令編譯。
2、文件類別用ctexbook時,則已自動匯入cjk巨集包並進入cjk環境,如果用latex編譯,則儲存時應選擇ansi編碼;如用xelatex命令編譯,則儲存時應選擇utf8編碼。
解決Ubuntu下latex編譯缺少中文字型的錯誤
1.緒言 thesis uestc.cls 58 fontspec error font not found the font simhei cannot be found.see the fontspec documentation for further information.for imme...
LaTex 文件基本結構,編譯,符號輸入
顯示結果如下 附 如下 latex文件的基本結構,編譯和除錯,命令符號的輸入 如 documentclass book,report,letter usepackage 巨集包 導言區 begin the quick brown fox jumps over the lazy dog.the qui...
LaTex原始檔基本結構與中文處理辦法學習筆記
導言區 進行全域性設定 documentclass book,report,letter usepackage newcommand degree title author date title author date 正文區 文稿區 乙個latex環境有且只能有乙個document環境 往後一行表...