43

In TikZ is it possible to draw lines thinner than 0.1 mm? ultra thin option gives line thickness 0.1 mm. I want to draw a pattern using line thickness 0.07 mm.

  • Welcome to TeX.SE. – Peter Grill Oct 7 '14 at 3:52
  • 4
    When asking questions it is better to provide a full minimal working example (MWE) both in order to demonstrate what you are trying to do and to help others help you. The MWE should like like \documentclass...\begin{document}...\end{document}, it should compile and contain close to the minimal amount of code needed to explain/demonstrate what you are asking. This saves a lot of time for everyone. – Andrew Oct 7 '14 at 4:01
  • Sorry andrew. It was my first time and next time I will be careful to give MWE. I have got my answer. Thanks – praveen pathak Oct 7 '14 at 15:24
73

You can specify the line width. Here is a zoomed in view of the output so that one can see the difference:

enter image description here

Notes:

  • As John Kormylo pointed out the tikz-pgf manual says

    Line width: The “thickness” of the line. A width of 0 is the thinnest width renderable on the device. On a high-resolution printer this may become invisible and should be avoided. A good choice is 0.4pt, which is the default.

    Not really sure what 0mm means in this case, but it seems to be a non-zero width :-)

  • Obviously at some point the size difference won't be noticeable at all, especially in a print edition.

Code:

\documentclass{article}
\usepackage{siunitx}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}[yscale=0.5]
    \draw [line width=0.25mm, red ] (0,-1) -- (2,-1) node [right] {\SI{0.25}{\milli\meter}};;
    \draw [line width=0.1mm,  blue] (0,-2) -- (2,-2) node [right] {\SI{0.10}{\milli\meter}};;
    \draw [line width=0.05mm, red ] (0,-3) -- (2,-3) node [right] {\SI{0.05}{\milli\meter}};
    \draw [line width=0.01mm, blue] (0,-4) -- (2,-4) node [right] {\SI{0.01}{\milli\meter}};
    \draw [line width=0mm,   black] (0,-5) -- (2,-5) node [right] {\SI{0.0}{\milli\meter}};
\end{tikzpicture}

\end{document}
  • 3
    According to the manual, a line width of 0 is actually the smallest width possible (page 1107) – John Kormylo Oct 7 '14 at 3:52
  • @JohnKormylo: Thanks. Have incorporated that into the answer. – Peter Grill Oct 7 '14 at 4:00
  • 2
    +1 for using the siunitx package – onewhaleid Oct 7 '14 at 6:21
  • 1
    From PDF reference 1.7: A line width of 0 denotes the thinnest line that can be rendered at device resolution: 1 device pixel wide – percusse Oct 7 '14 at 10:03
  • @user63827: Please see How do you accept an answer?. – Peter Grill Oct 7 '14 at 18:07
8

A PSTricks solution:

\documentclass{article}

\usepackage{pstricks-add}
\usepackage{siunitx}

\begin{document}

\begin{pspicture}(6.25,5.2)
  \multido{\rA = 0.1+-0.01, \rB = 0.1+0.5}{11}{
    \psline[linewidth = \rA mm](0,\rB)(5,\rB)
    \uput[0](5,\rB){\texttt{linewidth} = \SI[round-mode = places, round-precision = 2]{\rA}{\mm}}
  }
\end{pspicture}

\end{document}

output

You specify the width of the line with the option linewidth = <length>.

P.S. As can be seen, the line width is too small to distinguish when using PSTricks, so that is not a good tool in this case. (I can't believe I'm saying that.)

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.