[Tex/LaTex] TikZ/TeX: Minimum line width/maximum resolution

pdftex-coretikz-pgf

I would like to employ TikZ for some constructive work, namely, programming a FabLab laser cutter. This nifty device gets a 2d drawing (as PDF) and cuts along all hairlines in the PDF. A harline is defined as a path with a thickness of 0.01 pt.

However, if I try this with TikZ and pdflatex

\begin{tikzpicture}
    \draw[line width=0.01pt] (0,0) rectangle (1cm,1cm);
\end{tikzpicture}

and open the resulting PDF in Adobe Illustrator, it shows me a line width of 0.0179 pt – way too thick. Seems as if I have reached the limits of TeX.


Edit: The 0.0179 pt were a twofold effect. Firstly, I used pt where I actually should have used 0.01bp, as a the letter unit actually is what everybody else refers to as points. (See What are the possible dimensions / sizes / units LaTeX understands?). Secondly, the PDFs I was analyzing did not came directly out of pdflatex, but where post processed by MacOS, which results in the strange line widths. Thanks Paul!

Remains the generic question about the minimum line width and maximum resolution of TeX.


So what is the minimum line width I can get out of with TeX and TiKZ?

Also, what is this the same as the maximum resolution to place objects?

(For technical drawings, one sometimes has to go down to the µm level, with 1 µm = 0.002845 pt)

Best Answer

Compile this document via pdflatex:

\documentclass[tikz]{standalone}
\pdfcompresslevel=0
\pdfobjcompresslevel=0
\begin{document}
\begin{tikzpicture}
    \draw[line width=0.01pt] (0,0) rectangle (1cm,1cm);
\end{tikzpicture}
\end{document}

Then search w directives in the PDF (a simple text file). You find:

0.3985 w 
0.00995 w 

The first occurrence is the default line width (=~ .4pt) of TikZ.

The second occurrence is the line width used by the drawn rectangle. You are right: it is not 0.01 but 0.00995.

If you use line width=0.01004pt in your document, you get exactly 0.01 in the PDF file (0.01004/72.27*72=.0100024906600249063...).

(look at What are the possible dimensions / sizes / units LaTeX understands?, especially pt and bp units...)

Edit:

The minimum non null line width produced by TikZ is 0.00003pt (0.00002 w in PDF).

Note: null line width has special meaning in PDF (as in PostScript).

Extract from PDF 32000-1:2008: A line width of 0 shall denote the thinnest line that can be rendered at device resolution: 1 device pixel wide. However, some devices cannot reproduce 1-pixel lines, and on high-resolution devices, they are nearly invisible. Since the results of rendering such zero-width lines are device-dependent, they should not be used.

Related Question