使用 Latex 创建 Wifi 信号条
Creating Wifi signal bars with Latex
有谁知道如何使用 Latex 创建以下图标(我猜是 tikz)
有了一些newcommand
,我可以在tex文档中选择要填充的条从0到4。
类似于他们在此处定义的命令:In-line graphics in text to represent a loading bar for language skills in a CV,但不是绘制此 wifi 条的圆圈。
谢谢!
\documentclass[border=2mm]{standalone}
\usepackage{tikz}
\newcommand{\wifi}[1][4]{%
\colorlet{col1}{gray}%
\colorlet{col2}{gray}%
\colorlet{col3}{gray}%
\colorlet{col4}{gray}%
\ifnum0<#1
\colorlet{col1}{green}%
\fi%
\ifnum1<#1
\colorlet{col2}{green}%
\fi%
\ifnum2<#1
\colorlet{col3}{green}%
\fi%
\ifnum3<#1
\colorlet{col4}{green}%
\fi%
\begin{tikzpicture}[rounded corners=0.05ex]
\fill[col1] (0ex,0ex) rectangle ++(0.5ex,0.9ex);
\fill[col2] (0.7ex,0ex) rectangle ++(0.5ex,1.05ex);
\fill[col3] (1.4ex,0ex) rectangle ++(0.5ex,1.20ex);
\fill[col4] (2.1ex,0ex) rectangle ++(0.5ex,1.35ex);
\end{tikzpicture}%
}
\begin{document}
test \wifi[0] \wifi[1] \wifi[2] \wifi[3] \wifi[4]
\Huge test \wifi
\end{document}
有谁知道如何使用 Latex 创建以下图标(我猜是 tikz)
有了一些newcommand
,我可以在tex文档中选择要填充的条从0到4。
类似于他们在此处定义的命令:In-line graphics in text to represent a loading bar for language skills in a CV,但不是绘制此 wifi 条的圆圈。
谢谢!
\documentclass[border=2mm]{standalone}
\usepackage{tikz}
\newcommand{\wifi}[1][4]{%
\colorlet{col1}{gray}%
\colorlet{col2}{gray}%
\colorlet{col3}{gray}%
\colorlet{col4}{gray}%
\ifnum0<#1
\colorlet{col1}{green}%
\fi%
\ifnum1<#1
\colorlet{col2}{green}%
\fi%
\ifnum2<#1
\colorlet{col3}{green}%
\fi%
\ifnum3<#1
\colorlet{col4}{green}%
\fi%
\begin{tikzpicture}[rounded corners=0.05ex]
\fill[col1] (0ex,0ex) rectangle ++(0.5ex,0.9ex);
\fill[col2] (0.7ex,0ex) rectangle ++(0.5ex,1.05ex);
\fill[col3] (1.4ex,0ex) rectangle ++(0.5ex,1.20ex);
\fill[col4] (2.1ex,0ex) rectangle ++(0.5ex,1.35ex);
\end{tikzpicture}%
}
\begin{document}
test \wifi[0] \wifi[1] \wifi[2] \wifi[3] \wifi[4]
\Huge test \wifi
\end{document}