【问题标题】:Creating Wifi signal bars with Latex使用 Latex 创建 Wifi 信号条
【发布时间】:2021-02-10 05:47:42
【问题描述】:

有谁知道如何用 Latex 创建以下图标(我猜是 tikz)

有了一些newcommand,我可以选择 tex 文档中从 0 到 4 填充的条形。

类似于他们在这里定义的命令:In-line graphics in text to represent a loading bar for language skills in a CV,但不是用圆圈绘制这个 wifi 条。

谢谢!

【问题讨论】:

    标签: latex tikz


    【解决方案1】:
    \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}
    

    【讨论】:

    • 当然看起来很棒。你能edit 解释一下代码吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-01-13
    • 2013-10-17
    • 1970-01-01
    • 1970-01-01
    • 2015-06-24
    • 2018-07-26
    相关资源
    最近更新 更多