I am struggling with a drawing simple schematic microstrip line (see example).
What I have already done is solid body, but shadings are not well made (suggestions are as well welcome). The main problem is with using engeneering dimension signs. I used parts of Jakes code here Tikz - move/reposition arrow decorations (arrowhead length/size) but it still results in messed up and say ugly picture.
I have no idea how to make it look more professional, I would be grateful if anyone can improve my enclosed code bellow.
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{%
decorations.pathreplacing,%
decorations.pathmorphing,
decorations.markings%
}
\usetikzlibrary{patterns,calc,arrows}
\usepackage{pgfplots}
%% please note changes in color %%
\definecolor{whitesmoke}{rgb}{0.90, 0.90, 0.90}
\definecolor{lightgray}{rgb}{0.73, 0.73, 0.73}
\definecolor{dimgray}{rgb}{0.51, 0.51, 0.51}
\definecolor{pearl}{rgb}{0.94, 0.92, 0.84}
\definecolor{antiflashwhite}{rgb}{0.95, 0.95, 0.96}
\begin{document}
\pgfarrowsdeclarecombine{dimarrow}{dimarrow}{latex}{latex}{}{}
\def\Dimline[#1][#2][#3]{
\draw[|-|,
decoration={markings, % switch on markings
mark=at position 0 with {\arrowreversed[scale=0.5]{dimarrow}};,
mark=at position .5 with {\node[black] at (0,0.25) {#3};},
mark=at position 1 with {\arrow[scale=0.5]{dimarrow}};,
},
postaction=decorate] #1 -- #2 ;
}
\begin{tikzpicture}
\filldraw [white](0,0,0) -- (0,1,0) -- (5,1,0) -- (5,0,0) -- (0,0,0);
\filldraw [whitesmoke] (0,0,5) -- (0,1,5) -- (5,1,5) -- (5,0,5) -- (0,0,5);
\shade[left color = white, right color = lightgray] (0,1,0) -- (5,1,0) -- (5,1,5) -- (0,1,5) -- (0,1,0);
\filldraw [dimgray] (5,0,0) -- (5,0,5) -- (5,1,5) -- (5,1,0);
\filldraw [lightgray] (0,0,5) -- (5,0,5) -- (5,0,0) -- (5,-0.2,0) -- (5,-0.2,5) -- (0,-0.2,5);
\filldraw [white] (1.5,1.2,5) -- (3.5,1.2,5) -- (3.5,1,5) -- (1.5,1,5) -- cycle;
\filldraw [lightgray] (1.5,1.2,5) -- (3.5,1.2,5) -- (3.5,1,5) -- (1.5,1,5) -- cycle;
\shade [left color = white, right color = whitesmoke] (1.5,1.2,0) -- (3.5,1.2,0) -- (3.5,1.2,5) -- (1.5,1.2,5) -- cycle;
\filldraw [lightgray] (3.5,1,5) -- (3.5,1.2,5) -- (3.5,1.2,0) -- (3.5,1,0) -- cycle;
\node at (4,0.5,5) {$\varepsilon$};
\node at (1.5,1.5,0) (nA) {};
\node at (3.5,1.5,0) (nB) {};
\Dimline[($(nA)+(0,1)$)][($(nB)+(0,1)$)][$w$];
\draw (1.5,2.5,0) -- (1.5,1.3,0);
\draw (3.5,2.5,0) -- (3.5,1.3,0);
\node at (-1.5,0.2,0) (nA) {};
\node at (-1.5,0.2,5) (nB) {};
\Dimline[($(nA)+(0,1)$)][($(nB)+(0,1)$)][$l$][left];
\draw (-1.5,1.2,5) -- (1.4,1.2,5);
\draw (-1.5,1.2,0) -- (1.4,1.2,0);
\node at (7,0,5) (nA) {};
\node at (7,0.2,5) (nB) {};
\Dimline[($(nA)+(0,1)$)][($(nB)+(0,1)$)][$t$][left];
\draw (7,1.2,5) -- (3.6,1.2,5);
\draw (7,1,5) -- (3.6,1,5);
\node at (-1.5,0,5) (nA) {};
\node at (-1.5,-1,5) (nB) {};
\Dimline[($(nA)+(0,1)$)][($(nB)+(0,1)$)][$h$][left];
\draw (-1.5,1,5) -- (-0.1,1,5);
\draw (-1.5,0,5) -- (-0.1,0,5);
\end{tikzpicture}
\end{document}