Pdflatex 不打印 unicode 字符

Pdflatex 不打印 unicode 字符

这是代码:

\documentclass[oneside, pdftex, a4paper, 12pt]{scrbook}
\usepackage[left = 1cm, right = 1cm, top=2cm, bottom = 2cm]{geometry}
\usepackage{microtype}
\usepackage{alltt}
\usepackage{latexsym}
\usepackage{amsfonts}
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\usepackage[utf8x]{inputenc}
\usepackage[table]{xcolor}
\usepackage{longtable}[cc]
\usepackage{etoolbox}
\usepackage{setspace}
\doublespacing
\definecolor{lightgray}{gray}{0.9}
\rowcolors{1}{}{lightgray}
\begin{document}
{\tt

\begin{tabular} {r l}
         GAME: & 22766 \\
        EVENT: & 2006 WC R5   \\
  GOLD PLAYER: & 2116 Adanac (CA) \\
SILVER PLAYER: & 2236 Fritzlein (US) \\
     DURATION: & 03 hours 08 minutes and 18 seconds \\
    PLY COUNT: & 74 \\
\end{tabular}
\begin{longtable}{| p{8.5cm} | p{8.5cm} |}
\hline
\multicolumn{1}{|c|}{\bfseries GOLD} & \multicolumn{1}{|c|} {\bfseries SILVER} 
\endhead
\ SE \ \ Da2 Mb2 Hc2 Cd2 De2 Hf2 Eg2 Ch2  \ TUP.\ \ Ra1 Rb1 Rc1 Rd1 Re1 Rf1 Rg1 Rh1 & \ SE \ \ ra7 hb7 dc7 ed7 me7 cf7 hg7 dh7  \ \ TUP.\ \ ra8 rb8 rc8 rd8 ce8 rf8 rg8 rh8\\
002. Eg2n \ Eg3n \ Hf2▲ Hg2n \ & 002. ed7s \ ed6s \ ed5s \ ed4▲\\
003. Ch2w \ Cg2w \ Eg4w \ Da2n \ & 003. ee4s \ ee3w \ De2n \ hg7s\\
004. Ef4w \ De3s \ Mb2n \ Ee4w \ & 004. ed3▲ ee3n \ De2n \ dh7w\\
005. Mb3n \ Da3▲ Cd2n \ De3s \ & 005. ee4n \ ee5w \ ed5w \ hb7s\\
006. Mb4▲ Mc4s \ Ed4w \ Cd3s \ & 006. me7s \ ce8s \ ce7w \ me6n\\
007. Ec4w \ Eb4n \ Hc2w \ Mc3s \ & 007. ec5s \ ec4w \ dc7w \ cd7w\\
008. Db3w \ Da3s \ Eb5▲ Ec5▲ & 008. eb4s \ eb3w \ ea3▲ Da2n\\
009. Ed5n \ Ed6n \ Cd2n \ Ra1n \ & 009. me7n \ Da3n \ eb3w\\
010. cc7s \ Ed7w \ Ec7▲ rc8s \ & 010. Da4n \ ea3n \ Da5n \ ea4n\\
\hline
\end{longtable}
\newpage

}
\end{document}

我没有得到向上箭头,而是得到了 [U+25B2] ,如果我改变:

\usepackage[utf8x]{inputenc}

\usepackage[utf8]{inputenc}

我什么都没得到。我尝试使用\uparrow\Uparrow但文本行消失了。

答案1

避免utf8x;您可以更轻松地使用 定义未覆盖的 Unicode 字符newunicodechar

例如,这里我定义 ▲ 在脚本样式中使用\blacktriangleamssymb在与当前字体中的数字一样宽的框内(通常为 0.5em)。

我已修复一些错误并且只加载真正必要的包。

  1. \usepackage{longtable}[cc]是错的
  2. \tt绝不应该用来代替\ttfamily
  3. |\multicolumn{1}{|c|} {\bfseries SILVER} that has been fixed as\multicolumn{1}{c|} {\bfseries SILVER}`中存在错误
  4. 为了保持一致性,我在 ▲ 后添加了缺失的双空格。

这是代码。

\documentclass[oneside, a4paper, 12pt]{scrbook}
\usepackage[left = 1cm, right = 1cm, top=2cm, bottom = 2cm]{geometry}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\usepackage[table]{xcolor}
\usepackage{longtable}
\usepackage{amssymb}

\usepackage{newunicodechar}

\newunicodechar{▲}{%
  \makebox[.5em]{% the same size as digits in the current font
    $\scriptstyle\blacktriangle$%
  }%
}

\definecolor{lightgray}{gray}{0.9}
\rowcolors{1}{}{lightgray}

\begin{document}

\ttfamily

\begin{tabular} {r l}
         GAME: & 22766 \\
        EVENT: & 2006 WC R5   \\
  GOLD PLAYER: & 2116 Adanac (CA) \\
SILVER PLAYER: & 2236 Fritzlein (US) \\
     DURATION: & 03 hours 08 minutes and 18 seconds \\
    PLY COUNT: & 74 \\
\end{tabular}
\begin{longtable}{| p{8.5cm} | p{8.5cm} |}
\hline
\multicolumn{1}{|c|}{\bfseries GOLD} & \multicolumn{1}{c|} {\bfseries SILVER} 
\endhead
\ SE \ \ Da2 Mb2 Hc2 Cd2 De2 Hf2 Eg2 Ch2  \ %
 TUP.\ \ Ra1 Rb1 Rc1 Rd1 Re1 Rf1 Rg1 Rh1 &
\ SE \ \ ra7 hb7 dc7 ed7 me7 cf7 hg7 dh7  \ \ %
 TUP.\ \ ra8 rb8 rc8 rd8 ce8 rf8 rg8 rh8\\
002. Eg2n \ Eg3n \ Hf2▲ \ Hg2n \ & 002. ed7s \ ed6s \ ed5s \ ed4▲\\
003. Ch2w \ Cg2w \ Eg4w \ Da2n \ & 003. ee4s \ ee3w \ De2n \ hg7s\\
004. Ef4w \ De3s \ Mb2n \ Ee4w \ & 004. ed3▲ \ ee3n \ De2n \ dh7w\\
005. Mb3n \ Da3▲ \ Cd2n \ De3s \ & 005. ee4n \ ee5w \ ed5w \ hb7s\\
006. Mb4▲ \ Mc4s \ Ed4w \ Cd3s \ & 006. me7s \ ce8s \ ce7w \ me6n\\
007. Ec4w \ Eb4n \ Hc2w \ Mc3s \ & 007. ec5s \ ec4w \ dc7w \ cd7w\\
008. Db3w \ Da3s \ Eb5▲ \ Ec5▲ \ & 008. eb4s \ eb3w \ ea3▲ \ Da2n\\
009. Ed5n \ Ed6n \ Cd2n \ Ra1n \ & 009. me7n \ Da3n \ eb3w\\
010. cc7s \ Ed7w \ Ec7▲ \ rc8s \ & 010. Da4n \ ea3n \ Da5n \ ea4n\\
\hline
\end{longtable}

\end{document}

以下是输出

在此处输入图片描述

答案2

加载pifont

\usepackage{pifont}

并声明

\DeclareUnicodeCharacter{9650}{\ding{"73}}

梅威瑟:

\documentclass[oneside, pdftex, a4paper, 12pt]{scrbook}
\usepackage[left = 1cm, right = 1cm, top=2cm, bottom = 2cm]{geometry}
\usepackage{microtype}
\usepackage{alltt}
\usepackage{latexsym}
\usepackage{amsfonts}
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\usepackage[utf8x]{inputenc}
\usepackage[table]{xcolor}
\usepackage{longtable}
\usepackage{etoolbox}
\usepackage{setspace}
\doublespacing
\definecolor{lightgray}{gray}{0.9}
\rowcolors{1}{}{lightgray}
\usepackage{pifont}
\DeclareUnicodeCharacter{9650}{\ding{"73}}
\begin{document}
{\ttfamily

\begin{tabular} {r l}
         GAME: & 22766 \\
        EVENT: & 2006 WC R5   \\
  GOLD PLAYER: & 2116 Adanac (CA) \\
SILVER PLAYER: & 2236 Fritzlein (US) \\
     DURATION: & 03 hours 08 minutes and 18 seconds \\
    PLY COUNT: & 74 \\
\end{tabular}
\begin{longtable}{| p{8.5cm} | p{8.5cm} |}
\hline
\multicolumn{1}{|c|}{\bfseries GOLD} & \multicolumn{1}{|c|} {\bfseries SILVER}
\endhead
\ SE \ \ Da2 Mb2 Hc2 Cd2 De2 Hf2 Eg2 Ch2  \ TUP.\ \ Ra1 Rb1 Rc1 Rd1 Re1 Rf1 Rg1 Rh1 & \ SE \ \ ra7 hb7 dc7 ed7 me7 cf7 hg7 dh7  \ \ TUP.\ \ ra8 rb8 rc8 rd8 ce8 rf8 rg8 rh8\\
002. Eg2n \ Eg3n \ Hf2▲ Hg2n \ & 002. ed7s \ ed6s \ ed5s \ ed4▲\\
003. Ch2w \ Cg2w \ Eg4w \ Da2n \ & 003. ee4s \ ee3w \ De2n \ hg7s\\
004. Ef4w \ De3s \ Mb2n \ Ee4w \ & 004. ed3▲ ee3n \ De2n \ dh7w\\
005. Mb3n \ Da3▲ Cd2n \ De3s \ & 005. ee4n \ ee5w \ ed5w \ hb7s\\
006. Mb4▲ Mc4s \ Ed4w \ Cd3s \ & 006. me7s \ ce8s \ ce7w \ me6n\\
007. Ec4w \ Eb4n \ Hc2w \ Mc3s \ & 007. ec5s \ ec4w \ dc7w \ cd7w\\
008. Db3w \ Da3s \ Eb5▲ Ec5▲ & 008. eb4s \ eb3w \ ea3▲ Da2n\\
009. Ed5n \ Ed6n \ Cd2n \ Ra1n \ & 009. me7n \ Da3n \ eb3w\\
010. cc7s \ Ed7w \ Ec7▲ rc8s \ & 010. Da4n \ ea3n \ Da5n \ ea4n\\
\hline
\end{longtable}
\newpage

}
\end{document} 

输出:

在此处输入图片描述

附注:请使用\ttfamily而不是\tt因为在 LaTeX 中已不推荐使用 。

另请注意,您有一行

\usepackage{longtable}[cc]

应该是

\usepackage{longtable}

相关内容