# how to use special utf-8 characters in submodules? [duplicate]

In my thesis (my first real project with LaTeX), I need Japanese and some Russian characters. I divided my thesis by submodules. My main module looks as follows:

 \documentclass[11pt]{article}

\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{CJK}

\includeonly{spis_tresci}

\begin{document}

% Definition of title and author
\title{ My Thesis title. }
\author{Mazeryt Freager \\
\\
\begin{CJK*}{UTF8}{min}
一部の日本人のもの
\end{CJK*}
\\ śćóœ}
\maketitle

\clearpage

\input{Table_of_Contents}

\end{document}


 \section{Table_of_Contents}

%When I add here something more than ASCI code I got into compilation failure
%No mather if it is:
%\begin{CJK*}{UTF8}{min}
%一部の日本人のもの
%\end{CJK*}
%\\ śćóœ}
abcdefghijklmnoprstuwxyzABCDEFGHIJKLMNOPRSTUWXYZ
%but standard ASCI works


I search a lot about this but I didn't find any solution that works for me. Any idea?

## marked as duplicate by Leo Liu, user31729, Guido, Jesse, Svend TveskægAug 11 '14 at 11:51

• The commented non-ascii part has an additional } on the third line - just a copy paste error, but will throw you off at this point. – greyshade Aug 10 '14 at 8:14
• I had an error "! LaTeX Error: Can be used only in preamble." that point to first \uspackage. When I remove alle usepackage the code compile with comments – Mazeryt Aug 10 '14 at 8:32
• @MazerytFreager You can't have \usepackage after \begin{document}; nor you can enable and disable CJK; by the way, you should use CJKutf8. – egreg Aug 10 '14 at 9:42
• Thanks In my case problem is CJK because when I mixed Asian and non-Asian characters I got several of errors. Also usepackages should not be in subfile. I will try with CJKutf8 – Mazeryt Aug 10 '14 at 9:47

I believe the problem lies in the misconception about the use of the CJK environment - as @egreg said, it can't be enabled and disabled. Just enclose the whole document in one CJK environment and when using CJKutf8 (see here for what difference it makes) utf8 characters using latin script but outside of ASCII will be fine.

Thus your MWE in a fixed version would be:

\documentclass[11pt]{article}

\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{CJKutf8}

\begin{document}

% Definition of title and author
\begin{CJK*}{UTF8}{min}
\title{My Thesis title.}
\author{Mazeryt Freager\\ \\一部の日本人のもの\\śćóœ}
\maketitle

\clearpage

\input{Table_of_Contents}
\end{CJK*}
\end{document}


with the Table_of_Contents.tex' having the following contents:

一部の日本人のもの\\
Polish characters are: ąćśżźółęń\\
ASCII: abcdefghijklmnoprstuwxyzABCDEFGHIJKLMNOPRSTUWXYZ
`

and the output being on the title page:

and

on the first page.