Draw line of any thickness in Tikz LaTeX

Today I will show you how we can set custom thickness for lines in Tikz – LaTeX.

We all know that we can set the thickness of the lines using the below predefined thickness commands:

  • ultra thin
  • very thin
  • thin
  • semithick
  • thick
  • very thick
  • ultra thick

But can we change the thickness according to our needs?

The answer is a big YES!

We can use the command like this: \draw[line width=thicknessvalue]

Let’s understand with an example how we can do this:

\documentclass{article}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
    \draw[line width=0.5pt] (0,0) -- (4,0);
\end{tikzpicture}


\end{document}

It will set the line thickness to 0.5pt which is less than the thickness of ultra thin.

\documentclass{article}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
    \draw[line width=0.5pt] (0,0) -- (4,0);
\end{tikzpicture}
\begin{tikzpicture}
    \draw[line width=1pt] (0,0) -- (4,0);
\end{tikzpicture}
\begin{tikzpicture}
    \draw[line width=2pt] (0,0) -- (4,0);
\end{tikzpicture}

\end{document}

Output:

Thickness of line in Tikz - LaTeX

 

Leave a Reply

Your email address will not be published. Required fields are marked *