PARVESH TANEJA
I am working on some documents/books (Related to Mechanical Engineering). I found that there is no package that could be used for Geometric Dimensioning & Tolerancing symbols and Feature Control Frame.

[Upon Googling for- I found a thread on Stack Exchange
](
https://tex.stackexchange.com/questions/53471/how-to-create-geometry-tolerance-symbols-with-tikz) but it didn't helped much.

***Problem Statement:***

I want to create a package that contains all these symbols (One can call these symbols directly or through Feature Control Frame, as mentioned below) -

![Slide1.JPG](/image?hash=633b29e791346ae50bee30cf70ba6caeddbfeee61b1d8cdef6323bf0b88af53a)

Feature Control Frame are these box structure containing symbols (shown above), numbers & alphabets.

These are of 3 types-

**Type 1**
![Slide3.JPG](/image?hash=bfc53f5f27f3e33116021f71c87d6c26d1fc5a0c75939132534292450c86dc5f)

**Similarly, Type 2**
![Slide4.JPG](/image?hash=1c3cbc951bc74eaa7a288c2f96e02da66aa4ed9c1929399a5d0e13e027137693)

**Similarly, Type 3**

**Combination Type**
![Slide6.JPG](/image?hash=66edd69d8b4ff755ce8f047a7204c479c8d00ba74cd71523ec74633b86b996e8)

I am still new to LaTeX, so I have almost zero experience with creating a style file & use of TikZ Package. Could someone here please guide me how to solve this problem.

Once this is done, I will move on to Welding, hydraulic & pneumatic Symbols etc. (I want to create package & submit it on CTAN for the community).

Thanks,

-Taneja Parvesh


samcarter
### Preface:

Using Ti*k*Z to draw symbols is both rather slow[^1] and also adds a lots of dependencies to a document. I would only follow the approach for symbols which are not available in another way (I'm saying this as someone who wrote a couple packages using Ti*k*Z).

----

You're question is very broad, but maybe this short example could be a starting point.

I'm defining one symbol which will scale with the surrounding font, but also allows the user to pass the common Ti*k*Z options to the macro. I also added an option to draw it with or without the surrounding square.


\documentclass{article}

\usepackage{test}

\begin{document}

Test \mysymbol

\Huge \textcolor{red}{Test \mysymbol[noframe]}

Test \mysymbol[scale=2]

\end{document}


test.sty:


\ProvidesPackage{test}[2021/08/23 v0.1 test package]

\RequirePackage{tikz}

\newif\iftest@noframe

\tikzset{
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Pass unknown keys on to tikz
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
/test/.search also={/tikz,/pgf},
/test/.cd,
noframe/.code= \test@noframetrue,
}

\newcommand{\mysymbol}[1][]{%
\begin{tikzpicture}%
%
\tikzset{/test/.cd,#1}%
%
% store scaling factor from https://topanswers.xyz/tex?q=819#a965
\pgfgettransformentries{\tmpscaleA}{\tmpscaleB}{\tmpscaleC}{\tmpscaleD}{\tmp}{\tmp}%
\pgfmathsetmacro{\test@scalingfactor}{sqrt(abs(\tmpscaleA*\tmpscaleD-\tmpscaleB*\tmpscaleC))*sqrt(abs((\pgf@xx/1cm)*(\pgf@yy/1cm)-(\pgf@xy/1cm)*(\pgf@yx/1cm)))}%
%
%
\iftest@noframe
\path[line width=\test@scalingfactor*0.4pt] (0,0) rectangle ++ (1.5ex,1.5ex);
\else
\draw[line width=\test@scalingfactor*0.4pt] (0,0) rectangle ++ (1.5ex,1.5ex);
\fi
\draw[line width=\test@scalingfactor*0.4pt] (0.15ex,0.15ex) -- (1.35ex,1.35ex);
\end{tikzpicture}%
}

\endinput


![Screenshot 2021-08-23 at 18.16.00.png](/image?hash=f64d0626545f3182bc9f2d925ab48dd505cc9f60e3053b25214f8a8a8c09ea98)

[^1]: Unless you have magic killer bunny skills and can write packages like [xistercian](https://ctan.org/pkg/xistercian)

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.