2

Relate to How to create geometry tolerance symbols with TikZ?

I want flexibility, adaptive control by parameter, thanks for your answer.

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

enter image description here

\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}

enter image description here

3

I'm not sure what you want, but I would make the following changes on general principles.

BTW, do you really want to use $...$ instead of \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}

enter image description here

  • thanks,the code in the question that was learned from others is too hard. I am finding the best ,beautiful solution always. – andrew Jun 26 '16 at 15:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.