2

Rather than using floor and ceiling, I'd rather use what I would consider a proper UTF-8 character for Japanese quotation marks. Not only is it more intuitive, but it looks better (or should). I can do this using ctrl+K <' and ctrl+K >' in Vim, my text editor of choice since.

However, when I try to compile this, it throws errors at me. In particular:

! Package inputenc Error: Unicode character 」 (U+300C) (inputenc)
not set up for use with LaTeX.

See the inputenc package documentation for explanation.

So I press H for immediate help, and it mentions that I need to \DeclareUnicodeCharacter so put in

\DeclareUnicodeCharacter{300C}{「}
\DeclareUnicodeCharacter{300D}{」}

But it still fails with the same error.

I also tried \DeclareUnicodeCharacter{300D}{\「} and \DeclareUnicodeCharacter{300C}{\」}

I also tried \DeclareUnicodeCharacter{300D}{\jpr} but was given an "undefined control sequence error". However, even if this did work, it isn't what I want. I was doing this as a troubleshooting step.

This is especially frustrating since looking on line at sample docs, people just use the brackets without any special treatment, yet I'm using the CJK package.

I've also tried \usepackage[utf8x]{inputenc} which I previously chose not to use because it lead to undesirable behavior. Again, a troubleshooting step.

It was suggested I produce a minimum "working" example. Below is that example.

\documentclass{book}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{CJK}
\begin{document}
「
\end{document}

Another piece of info not requested is the compiler. Its pdflatex without any options.

  • You'll get a better answer (and probably sooner) if you post a minimal working example. – Teepeemm Dec 31 '18 at 13:44
  • @Teepeemm done, though I'm not sure that really adds anything. – Nero gris Dec 31 '18 at 13:54
  • I do think the MWE will help (although I have to admit that I'm not versed in unicode and encodings). Regarding the compiler: must it be pdflatex? I believe lualatex and xelatex are especially suited to dealing with unicode. – Teepeemm Dec 31 '18 at 14:58
  • I've been working on this set of macros and preamble for 10 years. My documents don't compile in either xetex or lualatex and fixing them is likely more effort than fixing this problem. Not only that, but I have hundreds (probably over 1k) pages written with the current combination which suddenly wouldn't compile. I have everything in a Git repo, but still. . . – Nero gris Dec 31 '18 at 15:02
  • It's meaningless to write \DeclareUnicodeCharacter{300C}{「} or \DeclareUnicodeCharacter{300C}{\「} — the whole point is to define what should be done with that Unicode character, in terms of things already known to the engine (i.e. give it a definition that does not involve that Unicode character). (Assuming not XeTeX/LuaTeX….) Also, if you want to type Unicode characters in the file, you need inputenc. (Explained many times on this site, e.g. 1, 2, 3.) – ShreevatsaR Jan 1 at 7:09
1

I think you have to enclose CJK characters in \begin{CJK} ... \end{CJK} when using CJK package. For example, if you are using pdflatex:

\documentclass{book}
\usepackage{CJKutf8}
\begin{document}

\begin{CJK}{UTF8}{ipxm}
「さくら」
\end{CJK}

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.