下面的代码创建一个带有 awesomefont5 库中的图标的节点,但它太小了。我希望图标缩放到边框尺寸。
\documentclass[convert]{standalone}
\usepackage{tikz}
\usepackage{fontawesome5}
\begin{document}
\begin{tikzpicture}
\tikzset{box/.style={draw,minimum width=1cm,minimum height=1cm}}
\node[box] (A) at (0,0) {\faHeadset};
\end{tikzpicture}
\end{document}
输出:
答案1
答案2
@pascal974 答案的一些变化:
代码:
\documentclass[border=5mm]{standalone}
\usepackage{tikz}
\usepackage{fontawesome5}
\begin{document}
\begin{tikzpicture}
\tikzset{box/.style={
%draw,
inner sep=0pt,
}}
\node[box] (A) at (0,0) {\resizebox{1cm}{!}{\color{cyan}{\faHeadset}}};
\end{tikzpicture}
\begin{tikzpicture}
\tikzset{box/.style={
inner sep=0pt,
}}
\node[box,cyan] (A) at (0,0) {\resizebox{1cm}{!}{\colorbox{gray}{\faHeadset}}};
\end{tikzpicture}
\begin{tikzpicture}
\tikzset{box/.style={
%draw,
inner sep=0pt,
}}
\node[box,red] (A) at (0,0) {\resizebox{1cm}{!}{{\faHeadset}}};
\end{tikzpicture}
\rule{2pt}{1cm}
\end{document}
验证后,您可以删除或注释掉尺寸控制的行(\rule
...)-