I've searched for this extensively but couldn't find anything that could help me, but if you know of some previous question that might help, feel free to point me to it.
I have a document with Japanese characters and Latin characters. I'd like to make it clear that it used to work fine, I was able to see both set of glyphs. I left it alone for some time and when I re-took the document and typeset it, the Japanese glyphs disappeared. It worked everything except for the Japanese characters that were not printed. So I tried other packages but nothing worked.
Finally I tried setting two fonts, one for the Japanese part and one for the Latin characters. The reason behind this is that I need some words to be in italic and some to be Small Caps (for the Latin characters) since I failed to find a single font that supported Japanese and these two things as well.
However if I try to write:
\setmainfont{CMU Serif}
\setCJKmainfont{Hiragino Mincho Pro}
I get this:
LaTeX Warning: Command \selectfont has changed.
Latex Error: ...tex:37 LaTeX Error: Environment CJK undefined.
Latex Error: ...tex:175 LaTeX Error: \begin{document} ended by \end{CJK}.
So my question is: Is there a font that might support all of that? Alternatively, what packages are required for me so that I can set two fonts and so that Latex automatically recognizes when to use each? I'd prefer a minimal approach over huge preamble codes to set this up.
Here is the MWE:
\documentclass{article}
\usepackage[a4paper, margin=1cm, landscape]{geometry}
\usepackage[document]{ragged2e}
\usepackage{fontspec} % I was experimenting
\usepackage{setspace}
\usepackage{lineno}
\usepackage[english]{babel}
\usepackage{CJKutf8}
\usepackage[table]{xcolor} % loads also »colortbl«
\usepackage{tabu}
\usepackage{multirow}
\usepackage{colortbl}
\usepackage{booktabs}
\usepackage{array}
\usepackage{arydshln}
\pagestyle{empty}
%\setmainfont{CMU Serif}
%\setCJKmainfont{Hiragino Mincho Pro}
\begin{document}
Regular, \emph{italic} text, but also in \textsc{small caps}. And now for some 日本語 $\leftarrow$ Japanese.
\end{document}
Output:
Best Answer
This should work. Do not use
CJK
orCJKutf8
package. XeLaTeX is required.