Posts

Showing posts with the label Tikz Pgf

Arrow Styles In TikZ Trees

Image
Answer : There are easier ways to draw trees, but if you wish to stick to TikZ's verbosity, you can override the style with another. \documentclass[border=9pt]{standalone} \usepackage[]{tikz} \begin{document} \tikzset{ breakarrow/.style={->, dashed}, myarrow/.style={solid, -}, varnode/.style = {shape=rectangle, rounded corners, draw, align=center, top color=red!20, bottom color=white} } \begin{tikzpicture}[sibling distance=6em, every node/.style = {shape=rectangle, rounded corners, draw, align=center, top color=white, bottom color=violet!20}] \node {/} child { node {tmp/}} child { node {initrd.img}} child { node {usr/} child { node {local/}} child { node {lib/}} child { node [varnode] {$\alpha_{/usr}$} edge from parent [breakarrow]}}; \end{tikzpicture} \begin{tikzpicture}[sibling distance=6em, every node/.style = {shape=rectangle, rounded corners, draw, align=center, top color=white, bottom color=violet!20}] \node [varnode] {$\alpha_{/u...

A 3D "ell" Shape Or "L" Shape

Image
Answer : To give you a start. \documentclass[tikz,border=3mm]{standalone} \usetikzlibrary{perspective} \begin{document} \begin{tikzpicture}[3d view={30}{15},line cap=round, declare function={ax=2;ay=1.5;az=2.5;bx=0.5;bz=0.5;}] \draw (0,0,0) -- (ax,0,0) -- (ax,0,bz) -- (bx,0,bz) -- (bx,0,az) -- (0,0,az) -- cycle (0,0,az) -- (0,ay,az) -- (bx,ay,az) edge ++ (0,-ay,0) -- (bx,ay,az) edge ++ (0,-ay,0) -- (bx,ay,bz) edge ++ (0,-ay,0) -- (ax,ay,bz) edge ++ (0,-ay,0) -- (ax,ay,0) -- (ax,0,0); \end{tikzpicture} \end{document} The perspective library allows us to change the view angles, and declare function is used to define parameters that can be changed, too. \documentclass[tikz,border=3mm]{standalone} \usetikzlibrary{perspective} \begin{document} \begin{tikzpicture}[3d view={40}{35},line cap=round, declare function={ax=3;ay=2;az=2.5;bx=0.8;bz=0.8;}] \draw (0,0,0) -- (ax,0,0) -- (ax,0,bz) -- (bx,0,bz) -- (bx,0,az) -- (0,0,az) -- cycle (0,0,az) -- (0,a...

Chalkboard Texture For Tikz Lines

Image
Answer : It takes ages . \documentclass[tikz,border=5]{standalone} \usetikzlibrary{decorations,backgrounds} \pgfkeys{decoration/.cd, iterations/.store in=\pgfdecorationiterations, iterations=75, radius/.store in=\pgfdecorationradius, radius=0.25pt, } \pgfdeclaredecoration{chalk}{draw}{ \state{draw}[width=\pgfdecorationsegmentlength]{ \pgftransformxshift{0.5\pgfdecorationsegmentlength/2} \pgfmathloop \ifnum\pgfmathcounter>\pgfdecorationiterations \else \pgfpathcircle{\pgfpointpolar{rnd*360}{rnd*\pgfdecorationsegmentamplitude}}% {\pgfdecorationradius}% \repeatpgfmathloop }} \begin{document} \begin{tikzpicture}[background rectangle/.style={fill=black}, show background rectangle, chalk/.style={fill=white, decorate, decoration={chalk, segment length=1.5pt, amplitude=3pt} },looseness=0.25] \path [chalk] (1/8,2) -- (0,1/2) arc (180:315:1/2) (-1/2,3/2) to [bend right] (5/8,3/2); \path [chalk, shift=(0:1)] (1/8,1) to [bend left] (0,0); \path [chalk, shift=(0:3/2)] (1/8,2) t...