![平均能量损失](https://linux22.com/image/386281/%E5%B9%B3%E5%9D%87%E8%83%BD%E9%87%8F%E6%8D%9F%E5%A4%B1.png)
我需要圈出字母。我知道\textcircled{$x$}
。但是我希望能够用颜色填充圆圈,并更改文本的颜色。
具体来说,我正在寻找类似的东西\ding{182}
(可用文档\ding{188}
pifont
这里,第 47 页,表 171)。
我希望不用 TikZ 也能做到这一点。非常感谢您的建议和帮助。
答案1
这是使用环境的解决方案picture
。更新支持最大为 的字体大小\large
。实心圆不适用于大于此大小的字体。您可以使用 来解决此限制\usepackage{pict2e}
。
您可以通过允许设置默认值和可选键值来使界面更美观。这可以使用l3keys
(或其他方式)来实现,但是由于您不想要,tikz
所以您可能希望将依赖关系降到最低。
(希望@DavidCarlisle 投票支持我选择使用picture
环境。尽管我确信我缺乏他在这方面的技能。)
平均能量损失
您可能想要尝试将圆圈放在您想要的垂直位置。
此代码将它们的高度设为中心\strut
:
\setlength{\dcircle}{\dp\strutbox}%
\addtolength{\dcircle}{\ht\strutbox}%
\setlength{\rcircle}{0.5\dcircle}%
\setlength{\dpcircle}{\rcircle}%
\addtolength{\dpcircle}{-\dp\strutbox}%
本完整示例中使用的代码以数字为中心。无论你选择哪种方式,有些字符看起来都会很奇怪。你可以以被圈出的字符为中心,但如果在不同位置相邻的圆圈,这看起来会有点奇怪。
\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage{xcolor}
\newlength{\dpcircle}
\newlength{\rcircle}
\newlength{\dcircle}
% \docircle{fill}{draw}{textcolour}{text}
\newcommand{\docircle}[4]{%
\setlength{\dpcircle}{\dp\strutbox}%
\setlength{\dcircle}{\dpcircle}%
\addtolength{\dcircle}{\ht\strutbox}%
\setlength{\rcircle}{0.5\dcircle}%
\setlength{\unitlength}{1sp}%
\begin{picture}(\number\dcircle,0)
\color{#1}
\put(\number\rcircle,\number\dpcircle){\circle*{\number\dcircle}}
\color{#2}
\put(\number\rcircle,\number\dpcircle){\circle{\number\dcircle}}
\put(\number\rcircle,0){\makebox[0pt]{\textcolor{#3}{#4}}}
\end{picture}%
}
\begin{document}
Numbers:
\docircle{yellow}{red}{blue}{0}
\docircle{yellow}{red}{blue}{1}
\docircle{yellow}{red}{blue}{2}
\docircle{yellow}{red}{blue}{3}
\docircle{yellow}{red}{blue}{4}
\docircle{yellow}{red}{blue}{5}
\docircle{yellow}{red}{blue}{6}
\docircle{yellow}{red}{blue}{7}
\docircle{yellow}{red}{blue}{8}
\docircle{yellow}{red}{blue}{9}
Lower-case:
\docircle{green}{magenta}{blue}{a}
\docircle{green}{magenta}{blue}{b}
\docircle{green}{magenta}{blue}{c}
\docircle{green}{magenta}{blue}{d}
\docircle{green}{magenta}{blue}{e}
\docircle{green}{magenta}{blue}{f}
\docircle{green}{magenta}{blue}{g}
\docircle{green}{magenta}{blue}{h}
\docircle{green}{magenta}{blue}{i}
\docircle{green}{magenta}{blue}{j}
\docircle{green}{magenta}{blue}{k}
\docircle{green}{magenta}{blue}{l}
\docircle{green}{magenta}{blue}{m}
\docircle{green}{magenta}{blue}{n}
\docircle{green}{magenta}{blue}{o}
\docircle{green}{magenta}{blue}{p}
\docircle{green}{magenta}{blue}{q}
\docircle{green}{magenta}{blue}{r}
\docircle{green}{magenta}{blue}{s}
\docircle{green}{magenta}{blue}{t}
\docircle{green}{magenta}{blue}{u}
\docircle{green}{magenta}{blue}{v}
\docircle{green}{magenta}{blue}{w}
\docircle{green}{magenta}{blue}{x}
\docircle{green}{magenta}{blue}{y}
\docircle{green}{magenta}{blue}{z}
Upper-case:
\docircle{cyan}{black}{white}{A}
\docircle{cyan}{black}{white}{B}
\docircle{cyan}{black}{white}{C}
\docircle{cyan}{black}{white}{D}
\docircle{cyan}{black}{white}{E}
\docircle{cyan}{black}{white}{F}
\docircle{cyan}{black}{white}{G}
\docircle{cyan}{black}{white}{H}
\docircle{cyan}{black}{white}{I}
\docircle{cyan}{black}{white}{J}
\docircle{cyan}{black}{white}{K}
\docircle{cyan}{black}{white}{L}
\docircle{cyan}{black}{white}{M}
\docircle{cyan}{black}{white}{N}
\docircle{cyan}{black}{white}{O}
\docircle{cyan}{black}{white}{P}
\docircle{cyan}{black}{white}{Q}
\docircle{cyan}{black}{white}{R}
\docircle{cyan}{black}{white}{S}
\docircle{cyan}{black}{white}{T}
\docircle{cyan}{black}{white}{U}
\docircle{cyan}{black}{white}{V}
\docircle{cyan}{black}{white}{W}
\docircle{cyan}{black}{white}{X}
\docircle{cyan}{black}{white}{Y}
\docircle{cyan}{black}{white}{Z}
Text sizes (up to \verb|\large|):
\tiny \docircle{magenta}{green}{black}{0}
\scriptsize \docircle{magenta}{green}{black}{0}
\footnotesize \docircle{magenta}{green}{black}{0}
\small \docircle{magenta}{green}{black}{0}
\normalsize \docircle{magenta}{green}{black}{0}
\large \docircle{magenta}{green}{black}{0}
\end{document}