如何使用 TikZ 创建表面光洁纹理符号?

如何使用 TikZ 创建表面光洁纹理符号?

与......有关如何使用 TikZ 创建几何公差符号?

我想要灵活性、通过参数进行自适应控制,感谢您的回答。

20160627 update start:
For example 
\RF{a=Rz1.6,b=xx,c=xx,d=xx,e=xx,romoval=1}
\RF{a=Ra3.2,b=xx,c=mill,d=xx,e=xx,romoval=0}
Can display as the the picture. If the parameter is emplty ,it will be  undisplay
update end

https://en.wikipedia.org/wiki/Surface_finish

在此处输入图片描述

\documentclass{article}
\usepackage{pgf,amsmath,tikz,type1cm,fix-cm}
\usetikzlibrary{positioning}

\newlength{\XHeight}
\newlength{\XWidth}

\newcommand*\RF[3]{\ensuremath{
      \settowidth{\XWidth}{#1}
      \addtolength{\XWidth}{.4em}
      \setlength{\XHeight}{\XWidth}
      \tikz[baseline]{
        \draw 
        (.75\XWidth,.3\XHeight) -- 
        (0.25\XWidth,.3\XHeight) -- 
        (.495\XWidth,-0.1\XHeight) -- 
        (.98\XWidth,.7\XHeight) --
        (1.5\XWidth,.7\XHeight) ;
        \node at (0.5\XWidth,.5\XHeight)[scale=0.66] {$#1$};
        \node at (1.25\XWidth,.9\XHeight)[scale=0.66] {$#2$};        
        \node at (1.25\XWidth,.5\XHeight)[scale=0.66] {$#3$};           
      }
    }
}

\begin{document}
test \RF{3.2}{Mill}{Rz}test \RF{0.8} {grinder}{}test\\\RF{0.8} {}{}test\\
\end{document}

在此处输入图片描述

答案1

我不确定你想要什么,但我会根据一般原则做出以下改变。

顺便问一下,您真的想使用 $...$ 而不是 \textit{...} 吗?

\documentclass{article}
\usepackage{pgf,amsmath,tikz}
\usetikzlibrary{positioning}

\newcommand*\RF[3]% #1=(not in diagram), #2=a, #3=c
{\bgroup% use local registers 0-2
  \dimendef\XWidth=0
  \dimendef\XHeight=1
  \dimendef\XTop=2
  \setlength{\XTop}{1em}% minimum
  \settowidth{\XWidth}{$#2$}%
  \ifdim\XWidth>\XTop \XTop=\XWidth \fi
  \settowidth{\XWidth}{$#3$}%
  \ifdim\XWidth>\XTop \XTop=\XWidth \fi
  \setlength{\XTop}{0.66\XTop}% scale=0.66
  \settowidth{\XWidth}{$#1$}%
  \addtolength{\XWidth}{.4em}%
  \setlength{\XHeight}{\XWidth}%
  \tikz[baseline]{
        \draw 
        (.75\XWidth,.3\XHeight) -- 
        (0.25\XWidth,.3\XHeight) -- 
        (.495\XWidth,-0.1\XHeight) -- 
        (.98\XWidth,.7\XHeight) --
        +(\XTop,0) ;% use relative doordinate
        \node at (0.5\XWidth,.5\XHeight)[scale=0.66] {$#1$};
        \node at (\XWidth+0.5\XTop,.9\XHeight)[scale=0.66] {$#2$};        
        \node at (\XWidth+0.5\XTop,.5\XHeight)[scale=0.66] {$#3$};           
      }%
\egroup}


\begin{document}
test \RF{3.2}{Mill}{Rz}test \RF{0.8} {grinder}{}test\\\RF{0.8}{}{}test\\
\end{document}

在此处输入图片描述

相关内容