3

I'm starting in my thesis which, while written primarily in English, needs a few lines of Korean font for things like professor names. Following this I figured out how to typeset Korean characters which works well in the main body of the text.

However, when I try to pass Korean in as the argument to one of the macros defined in the style file the generated output is gibberish. What do I have to do to be able to pass Korean in as an argument?

Here are the commands I'm using. \makesigpageB is a macro defined in the style file and produces gibberish (ìİťëęĎ) for the 5th name. I also tried moving the \inKorean command inside the style file but that didn't help. I even tried hardcoding some Korean in the style file (after including the same packages) but still got the same gibberish.

The later call to \inKorean, though, produces the correct output.

\usepackage[T1]{fontenc}
\usepackage{CJK}
\usepackage[english]{babel}
\usepackage{utepcsthesis} % thesis style file

\newenvironment{Korean}{%
  \CJKfamily{mj}}{}
\newcommand{\inKorean}[1]{\begin{CJK}{UTF8}{}\begin{Korean}#1\end{Korean}\end{CJK}}

\begin{document}

\makesigpageB{Chair, Prof 1}{Prof 2}{Prof 3}{Prof 4}{\inKorean{교수님 5}}

\inKorean{본문}

\end{document}

In the sytle file ...

\newcommand{\makesigpageB}[5]{
\thispagestyle{empty}
\begin{center}
% title
{\large\bf\@title}\\[0.4in]
% author
{\large\@author}\\[0.4in]
% department
{\large\@deptnm}
\end{center}
\vfill
\hspace{3.5in}APPROVED:\\[0.1in]

\noindent
\hspace{3.5in}\underline{\hspace{2.9in}}

\noindent
\hspace{3.5in}#1\\[0.05in]

\noindent
\hspace{3.5in}\underline{\hspace{2.9in}}

\noindent
\hspace{3.5in}#2\\[0.05in]

\noindent
\hspace{3.5in}\underline{\hspace{2.9in}}

\noindent
\hspace{3.5in}#3\\[0.05in]

\noindent
\hspace{3.5in}\underline{\hspace{2.9in}}

\noindent
\hspace{3.5in}#4\\[0.05in]

\noindent
\hspace{3.5in}\underline{\hspace{2.9in}}

\noindent
\hspace{3.5in}#5 %
\noindent

\newpage}
4
  • Do you have \usepackage[utf8]{inputenc} in your document?
    – egreg
    Oct 6, 2013 at 10:48
  • No, but would that explain why it works in one place (the body) and not the other (in the .sty file)?
    – ryan0270
    Oct 6, 2013 at 14:14
  • If I add it, I get Korean characters under the last signature line.
    – egreg
    Oct 6, 2013 at 14:26
  • Sure enough, that worked. Thanks! If you add it as an answer I'll mark it correct.
    – ryan0270
    Oct 6, 2013 at 23:40

1 Answer 1

3

Using \begin{CJK}{UTF8}{} requires you to have

\usepackage[utf8]{inputenc}

in your preamble. Of course the document must be UTF-8 encoded.

As Leo Liu (an expert in this field) says, it's probably even better to say

\usepackage{CJKutf8}

so the cooperation between CJK and inputenc will be ensured.

4
  • One should use CJKutf8 package instead of CJK + inputenc. And it is always preferred to use CJK environment globally.
    – Leo Liu
    Oct 7, 2013 at 7:47
  • @LeoLiu What's the difference?
    – egreg
    Oct 7, 2013 at 8:00
  • @egeg: CJKutf8 package has some patches for inputenc to make sure that the two package don't conflict. Both inputenc and CJK manipulate catcodes of characters in the range of 0x80--0xFF.
    – Leo Liu
    Oct 7, 2013 at 8:13
  • CJK environment is safer to be used globally. There may be some subtle problems. e.g. It is often necessary (described in the document of CJK pkg) to use a \clearpage before \end{CJK} to prevent a bug that cannot be repaired.
    – Leo Liu
    Oct 7, 2013 at 8:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .