[Tex/LaTex] How to typeset dimensional tolerances (mechanical engineering) with LaTeX

formattingtechnical-drawingunits

Is there a package which allows to typeset dimensional tolerances as used in mechanical engineering like:
Example for engineering dimensional tolerances?

I have to use them in the text and wonder how to do that best. So I'm searching for a package which can

  • correctly typeset the upper and lower limits
    (also in combination with length units! I admit that I'm not sure how to do that the best way.)
  • also makes available the symbols for form tolerances like roundness, cylindricity, straightness, etc.

Best Answer

You should use the siunitx package to format all your numbers and units. The symbol can be drawn using \diameter from the wasysym package and the tolerances are simple math super- and subscripts:

\documentclass{article}

\usepackage{wasysym}
\usepackage{siunitx}
\sisetup{output-decimal-marker={,}}

\newcommand{\tol}[3]{\ensuremath{\si{#1}^{+\num{#2}}_{-\num{#3}}}}

\newcommand{\diatol}[3]{\ensuremath{\diameter\si{#1}^{+\num{#2}}_{-\num{#3}}}}

\begin{document}

\diatol{0,125}{0.000}{0.001}

\tol{2,225\meter}{0.100}{0.20}

\tol{2,225m}{0.100}{0.20}

\end{document}

Result:

Result