如何在 LaTeX 文本中使用电源符号 (⏻) 字符?

如何在 LaTeX 文本中使用电源符号 (⏻) 字符?

我已经尝试过以下解决方案在 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

作为一种解决方法,如果您在选择正确的字体或设置文档时遇到困难,您可以使用包\faPowerOff提供的功能fontawesome

\documentclass{article}
\usepackage{fontawesome}

\begin{document}
To stop the charges, frugal users are advised to click on the \faPowerOff
\end{document}

在此处输入图片描述

答案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}

在背面的侧边栏上:

在此处输入图片描述

相关内容