如何包含顛倒的 Unicode 文字?

如何包含顛倒的 Unicode 文字?

似乎根本沒有辦法讓 Latex 在 PDF 中包含您想要的任何通用 Unicode 字符,以及解決方案這個問題太複雜了。

有沒有簡單的方法來包含顛倒的 Unicode 文本,例如˙ʎɐpoʇ ʎddɐɥ ɯɐ I

編輯使用 XeLatex 編譯似乎對於該特定示例工作得很好,但在文檔的後面我遇到了

! Package inputenc Error: Unicode char \u8:ñosd not set up for use with LaTeX.

See the inputenc package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.173 ...d on reading \emph{Cien años de soledad}
                                                   and ...

我不知道我之前是如何能夠ñ毫無問題地將其放在那裡......

編輯原來CJKutf8是引入的罪魁禍首包inputenc

答案1

您可以直接輸入任何Unicode字符,只需使用LuaLaTeX或XeLaTeX進行編譯(例如lualatex file在終端機中)即可將它們編譯為PDF。您也可以使用該rotating包旋轉文字。透過該turn環境,您可以將文字旋轉到任何所需的角度(請參閱texdoc rotating)。

原始碼必須採用 UTF-8 編碼,必須使用 LuaLaTeX 或 XeLaTeX 進行編譯,並且必須使用fontspec適當的套件來選擇包含所需 Unicode 字元的字型。

% compile with LuaLaTeX or XeLaTeX
\documentclass{article}
\usepackage{libertine}
\usepackage{rotating}

\newcommand{\unicodetext}{Greek μετανοεῖτε, accents \emph{esdrújulos}, pictograms ☹}

\begin{document}

This is UTF-8 encoded text with Unicode characters input directly:

\unicodetext

\begin{turn}{180}
\unicodetext
\end{turn}

\bigskip
This is text input upside-down:
˙ʎɐpoʇ ʎddɐɥ ɯɐ I ?

\end{document}

在此輸入影像描述

答案2

如果您使用基於 unicode 的 tex,例如 xelatex 或 luatex,它自然會工作:

在此輸入影像描述

\documentclass{article}

\usepackage{fontspec}
\setmainfont{Arial}
\begin{document}
˙ʎɐpoʇ ʎddɐɥ ɯɐ I ?
\end{document}

相關內容