Edit and compile if you like:
% Author: Izaak Neutelings (November, 2018)% page 8 https://archive.org/details/StaticAndDynamicElectricity% https://tex.stackexchange.com/questions/56353/extract-x-y-coordinate-of-an-arbitrary-point-on-curve-in-tikz% https://tex.stackexchange.com/questions/412899/tikz-calculate-and-store-the-euclidian-distance-between-two-coordinates\documentclass[border=3pt,tikz]{standalone}\usepackage{amsmath} % for \dfrac\usepackage{bm}\usepackage{physics}\usepackage{tikz,pgfplots}\usetikzlibrary{angles,quotes} % for pic (angle labels)\usetikzlibrary{decorations.markings}\tikzset{>=latex} % for LaTeX arrow head\usepackage{xcolor}\colorlet{Ecol}{orange!90!black}\colorlet{EcolFL}{orange!80!black}\colorlet{veccol}{green!45!black}\colorlet{EFcol}{red!60!black}\tikzstyle{charged}=[top color=blue!20,bottom color=blue!40,shading angle=10]\tikzstyle{darkcharged}=[very thin,top color=blue!60,bottom color=blue!80,shading angle=10]\tikzstyle{charge+}=[very thin,top color=red!80,bottom color=red!80!black,shading angle=-5]\tikzstyle{charge-}=[very thin,top color=blue!50,bottom color=blue!70!white!90!black,shading angle=10]\tikzstyle{gauss surf}=[green!80!black,top color=green!2,bottom color=green!80!black!70,shading angle=5,fill opacity=0.6]\tikzstyle{gauss lid}=[gauss surf,middle color=green!80!black!20,shading angle=40,fill opacity=0.6]\tikzstyle{gauss line}=[green!80!black]\tikzstyle{gauss dashed line}=[green!60!black!80,dashed,line width=0.2]\tikzstyle{metal}=[top color=black!5,bottom color=black!15,shading angle=30]\tikzstyle{vector}=[->,thick,veccol]\tikzstyle{normalvec}=[->,thick,blue!80!black!80]\tikzstyle{EField}=[->,thick,Ecol]\tikzstyle{EField dashed}=[dashed,Ecol,line width=0.6]\tikzset{EFieldLine/.style={thick,EcolFL,decoration={markings,mark=at position #1 with {\arrow{latex}}},postaction={decorate}},EFieldLine/.default=0.5}\tikzstyle{measure}=[fill=white,midway,outer sep=2]\begin{document}
Click to download: electric_field_slab.tex • electric_field_slab.pdf
Open in Overleaf: electric_field_slab.tex