LaTeX forum ⇒ XeTeXfontspec and related things in xelatex - texlive Topic is solved

Information and discussion about XeTeX, an alternative for pdfTeX based on e-Tex
annier
Posts: 16
Joined: Mon Sep 14, 2015 4:24 pm

fontspec and related things in xelatex - texlive

Postby annier » Wed Feb 03, 2016 10:29 am

Hi All,
I recently have tried to compile the following tex file in xetex (texlive-2015) in ubuntu 14.04.
  1. \documentclass{article}
  2. \usepackage{fontspec}
  3. \usepackage{amsmath,amssymb}
  4. %\setmainfont[Ligatures=TeX]{TeX Gyre Pagella}
  5. \usepackage[CJKnumber,CJKaddspaces,CJKchecksingle,BoldFont]{xeCJK}
  6. \usepackage{mathrsfs} % 一种常用于定义泛函算子的花体字母,只有大写。
  7. \usepackage{bm} % 处理数学公式中的黑斜体的宏包
  8. \setmainfont[Ligatures=TeX]{LMRoman10}
  9. \setsansfont[Ligatures=TeX]{LMSans10}
  10. \setmonofont[Ligatures=TeX]{LMMono10}
  11. \begin{document}
  12.  
  13. Hello, World!
  14.  
  15. \end{document}


It produces the following log.
...
  1. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  2. !
  3. ! xeCJK error: "key-unknown"
  4. !
  5. ! Sorry, but xeCJK/options does not have a key called `CJKaddspaces'.
  6. !
  7. ! The key `CJKaddspaces' is being ignored.
  8. !
  9. ! See the xeCJK documentation for further information.
  10. !
  11. ! Type <return> to continue.
  12. !...............................................
  13. l.3538 \ProcessKeysOptions { xeCJK / options }

...
  1. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  2. !
  3. ! fontspec error: "font-not-found"
  4. !
  5. ! The font "LMRoman10" cannot be found.
  6. !
  7. ! See the fontspec documentation for further information.
  8. !
  9. ! For immediate help type H <return>.
  10. !...............................................
  11.  
  12. l.8 \setmainfont[Ligatures=TeX]{LMRoman10}

...
  1. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  2. !
  3. ! fontspec error: "font-not-found"
  4. !
  5. ! The font "LMSans10" cannot be found.
  6. !
  7. ! See the fontspec documentation for further information.
  8. !
  9. ! For immediate help type H <return>.
  10. !...............................................
  11.  
  12. l.9 \setsansfont[Ligatures=TeX]{LMSans10}


...
  1. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  2. !
  3. ! fontspec error: "font-not-found"
  4. !
  5. ! The font "LMMono10" cannot be found.
  6. !
  7. ! See the fontspec documentation for further information.
  8. !
  9. ! For immediate help type H <return>.
  10. !...............................................
  11.  
  12. l.10 \setmonofont[Ligatures=TeX]{LMMono10}
  13.  


How can i add the necessary fonts and packages in the texlive 2015 and make it run?

Yours Sincerely,
Anil Kunwar

User avatar
Johannes_B
Site Moderator
Posts: 3551
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Wed Feb 03, 2016 7:10 pm

For the font names, use Latin Modern Roman, Latin Modern Sans and Latin Modern Mono.

In teh xeCJK manual i can spot a CJKspace (i don't read chinese, so ...), but not CJKaddspaces. Where did you get this from? Maybe it was available in an old version and got renamed?
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

annier
Posts: 16
Joined: Mon Sep 14, 2015 4:24 pm

Postby annier » Thu Feb 04, 2016 11:23 am

Hi Johannes,
Thank you very much for providing me the solutions.
Now i have got the following working examples for my context:

Method - A
    a). Yes, replacing CJKaddspaces by CJKspace solved the log as shown above.
    b). In context of replacements of LMRoman10 by Latin Modern Roman and so on, the xetex compilation ran successfully.
Working Example
  1. \documentclass{article}
  2. \usepackage{fontspec}
  3. \usepackage{amsmath,amssymb}
  4. %\setmainfont[Ligatures=TeX]{TeX Gyre Pagella}
  5. \usepackage[CJKnumber,CJKspace,CJKchecksingle,BoldFont]{xeCJK}
  6. \usepackage{mathrsfs} % 一种常用于定义泛函算子的花体字母,只有大写。
  7. \usepackage{bm} % 处理数学公式中的黑斜体的宏包
  8. \setmainfont[Ligatures=TeX]{Latin Modern Roman}
  9. \setsansfont[Ligatures=TeX]{Latin Modern Sans}
  10. \setmonofont[Ligatures=TeX]{Latin Modern Mono}
  11. % \setromanfont[ItalicFont={MinionPro-It}]{MinionPro-Regular}
  12. %\setmainfont[Mapping=tex-text]{Times New Roman}
  13. %\setsansfont{Helvetica}
  14. %\setmonofont[Scale=MatchLowercase]{Monospace}
  15. %\newfontfamily\hebrewfont[Script=Hebrew]{Ezra SIL}
  16. \begin{document}
  17. \section{中文字的測試}
  18. \section{Hello, World!}
  19.  
  20. \end{document}


Method - B
Alternatively, i downloaded and installed the microsoft fonts in the way as described in this link. For CJK fonts, i installed from the Ubuntu Software center.
Working Example
  1. \documentclass{article}
  2. \usepackage{fontspec}
  3. \usepackage{xeCJK}
  4. \XeTeXlinebreaklocale "zh"
  5. \XeTeXlinebreakskip = 0pt plus 1pt
  6. %Select fonts
  7. \setmainfont[Mapping=tex-text]{Times New Roman} % rm
  8. \setsansfont[Mapping=tex-text]{Arial} % sf
  9. \setmonofont{Courier New} % tt
  10. \setCJKmainfont{WenQuanYi Zen Hei} %xelatex 標楷體
  11. %\setCJKmonofont{SimSun} %xelatex 細明體
  12. \setCJKmonofont{AR PL UKai CN} %xelatex 細明體
  13. %...
  14. \begin{document}
  15. 中文字的測試
  16. \end{document}




Yours Sincerely,
Anil Kunwar


Return to “XeTeX”

Who is online

Users browsing this forum: No registered users and 2 guests