我已经尝试过以下解决方案在 LaTeX 中输入 Unicode 字符在 Overleaf 上但它们不起作用。
尝试 1:使用时\usepackage[utf8]{inputenc}
:
\documentclass{article}
\usepackage[letterpaper,top=2cm,bottom=2cm,left=3cm,right=3cm,marginparwidth=1.75cm]{geometry}
\usepackage[utf8]{inputenc}
\begin{document}
To stop the charges, frugal users are advised to click on the ⏻
\end{document}
它会抛出错误
LaTeX Error: Unicode character ⏻ (U+23FB)
尝试2:当尝试\DeclareUnicodeCharacter{23FB}{\poweroff}
\documentclass{article}
\usepackage[letterpaper,top=2cm,bottom=2cm,left=3cm,right=3cm,marginparwidth=1.75cm]{geometry}
\usepackage[utf8]{inputenc}
\DeclareUnicodeCharacter{23FB}{\poweroff}
\begin{document}
To stop the charges, frugal users are advised to click on the \poweroff
\end{document}
它会引发错误:
Undefined control sequence.
尝试3:使用时\usepackage[utf8x]{inputenc}
\documentclass{article}
\usepackage[letterpaper,top=2cm,bottom=2cm,left=3cm,right=3cm,marginparwidth=1.75cm]{geometry}
\usepackage[utf8x]{inputenc}
\begin{document}
To stop the charges, frugal users are advised to click on the ⏻
\end{document}
它会引发错误:
Package ucs Error: Unknown Unicode character 9211 = U+23FB,
尝试4:使用\usepackage{fontspec}
,请参阅https://www.overleaf.com/read/vkyzfjndxkgm
\documentclass{article}
\usepackage[letterpaper,top=2cm,bottom=2cm,left=3cm,right=3cm,marginparwidth=1.75cm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{fontspec}
\begin{document}
To stop the charges, frugal users are advised to click on the {\fontspec{Symbola} \symbol{"1F343}}
\end{document}
它只是没有编译并引发错误:
(fontspec) LuaTeX.
(fontspec)
(fontspec) You must change your typesetting engine to,
(fontspec) e.g., "xelatex" or "lualatex" instead of
(fontspec) "latex" or "pdflatex".
Type <return> to continue.
...
l.45 \msg_fatal:nn {fontspec} {cannot-use-pdftex}
答案1
答案2
使用 lualatex (overleaf 侧边栏中的选项),您可以使用任何具有该字符的字体,例如
\documentclass{article}
\usepackage[letterpaper,top=2cm,bottom=2cm,left=3cm,right=3cm,marginparwidth=1.75cm]{geometry}
\usepackage{fontspec}
\newfontfamily\sfam{symbola}
\begin{document}
To stop the charges, frugal users are advised to click on the {\sfam ⏻}
\end{document}
在背面的侧边栏上: