
LaTeX ソース コードでプレーンテキストの Unicode (UTF-8 エンコード) シンボルを使用しようとしています。概念を証明するためだけに、問題のシンボルの独自の定義を ASCII のみで作成しました。
\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[verbose]{newunicodechar}
%⋮
% Unicode
\newunicodechar{♢}{<>}
\newunicodechar{⧫}{!}
\newunicodechar{⬠}{(P)}
%⋮
\begin{document}
%⋮
\subsection{Introduction}
♢ ⧫ ⬠
%…
\end{document}
\newunicodechar が存在しなかったため、コンパイルは失敗しました。
This is pdfTeX, Version 3.14159265-2.6-1.40.15 (TeX Live 2014/Debian) (preloaded format=latex 2015.4.1) 10 JUL 2017 16:47
entering extended mode
restricted \write18 enabled.
%&-line parsing enabled.
**PP5_tiling.tex
(./PP5_tiling.tex
LaTeX2e <2014/05/01>
⋮
(/usr/share/texlive/texmf-dist/tex/latex/newunicodechar/newunicodechar.sty
Package: newunicodechar 2012/11/12 v1.1 Defining Unicode characters
)
⋮
! Package inputenc Error: Unicode char \u8: not set up for use with LaTeX.
See the inputenc package documentation for explanation.
Type H <return> for immediate help.
...
l.63 ♢
⧫ ⬠
?
何が間違っているのでしょうか?
答え1
エラーメッセージは
! Package inputenc Error: Unicode char (U+202F)
(inputenc) not set up for use with LaTeX.
U+202F NARROW NO-BREAK SPACE はどこにも定義されていません。
宣言を追加すれば問題はありません。
\documentclass[12pt]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[verbose]{newunicodechar}
%⋮
% Unicode
\newunicodechar{♢}{<>}
\newunicodechar{⧫}{!}
\newunicodechar{⬠}{(P)}
\newunicodechar{ }{\nolinebreak\hspace{.1em}}
%⋮
\begin{document}
%⋮
\subsection{Introduction}
♢ ⧫ ⬠
%…
\end{document}
T1 エンコーディングに注意してください。そうしないと、<
とが得られません>
。
なぜ異なるエラー メッセージが表示されるのでしょうか? 3 年前の TeX ディストリビューションを使用しているためです。更新する時期です。