I am a beginner in LaTeX, trying to use it for an industrial metrology test report, where I need to use geometry tolerances. I have tentatively made a first one with TikZ, but this is hard coded and therefore not flexible. I need in some cases to change the number of reference planes from only 1 to 3 such as in the example (A,B,C) Conversely there is a need to use one or two digits in the main tolerance, and sometimes a symbol (such as "DIA") as prefix. It seemed to me that using chains would be a much more promising route, but I cannot make it work, the symbol is not placed at the left side, and the lines do not align properly. Would someone suggest a solution?
\documentclass[11pt ]{article}
\usepackage{tikz}
\usetikzlibrary{chains}
\usetikzlibrary{positioning}
\renewcommand{\familydefault}{\sfdefault}
\begin{document}
\Large
\newcommand{\postol}[4]{%
\begin{tikzpicture}[scale=.7]
\draw (-1em,0) -- (1em,0);
\draw(0,-1em) -- (0,1em);
\draw (0,0) circle ( .6 em);
\draw (1em, -1em) --(1em, 1em);
\draw (2.5em, 0) node{#1};
\draw(4em,-1em) -- (4em,1em);
\draw (5em, 0) node{#2};
\draw(6em,-1em) -- (6em,1em);
\draw (7em, 0) node{#3};
\draw(8em,-1em) -- (8em,1em);
\draw (9em, 0) node{#4};
\draw (-1 em,-1em) rectangle (10 em, 1 em);
\end{tikzpicture}} %
\postol{0.32}{A}{B}{C}
\newcommand{\tolgeom}[1]{
\node[rectangle, draw, on chain=going right]{
#1}}%
\begin{tikzpicture}[scale=1,
start chain,
node distance=0pt]
\draw (-1em,0) -- (1em,0);
\draw(0,-1em) -- (0,1em);
\draw (0,0) circle ( .6 em);
\tolgeom{0.32};\tolgeom{A}; \tolgeom{B};\tolgeom{C};
\end{tikzpicture}
\end{document}
Best Answer
I've defined node shapes for all the symbols found on http://en.wikipedia.org/wiki/Geometric_dimensioning_and_tolerancing#Symbols, plus one symbol for creating modifiers that takes a letter as its argument.
The line
\tol{type=position,3,2,1,modifier=M}
will printThe symbols are accessed using
type=<type>
. Here's a list of all the types that are available: