3

I would like to have a way to draw like what you can find in the Feynman Lectures on Physics. For instance here here more precisely something like Fig.14-6 or Fig.14-7.

So far using circuitikz and tikz I have:

\documentclass{article}
\usepackage[european]{circuitikz}
\usepackage{tikz}
\usetikzlibrary{patterns}

\begin{document}
\begin{circuitikz}
\draw
(0,0) to [battery1] (2,0) --
(2,2) to [R, i<_=i] (0,2) --
(0,0);
\begin{tikzpicture}
\draw[pattern=north west lines, pattern color=black] (0.65,4.20) rectangle (1.65,3.80);
\end{tikzpicture}
\end{circuitikz}
\end{document}

I'm using a rectangle instead of a resistor so I can have the crosshatch section but doesn't come out right.

  • 2
    Welcome! Fine ambition. What's the problem? – cfr Jun 10 '18 at 21:54
  • @cfr Thank you. Well I can't seem to find how to make nice looking drawing with greyed out area, arrow, vectors and so on. – Owen Allemang Jun 10 '18 at 22:00
  • You can certainly draw this with circuitikz and/or TikZ. If you do a google picture search with site:tex.stackexchange.com circuitikz voltmeter you'll find a lot of examples that may serve as a starting point. Just select one of those, try to adjust it, and when you have problems come back here, I am sure that then people will be much more eager to help. – user121799 Jun 10 '18 at 22:02
  • @marmot Thank you, I'm starting having a somewhat decent looking circuit, but how can I do the crosshatch section; I'm using a resistor to do the semiconductor. I also have trouble getting the wires from the voltmeter to the semiconductor, (they have to be at 90° from the long axis of the semiconductors) – Owen Allemang Jun 10 '18 at 22:40
  • 1
    BTW, I designed tex.stackexchange.com/questions/274896/… so that one could swap out $\Omega$ with V or A. – John Kormylo Jun 11 '18 at 13:00
4

You can start testing things through Visual tikz documentation, you also have the option to import images using the graphicxpackage, preferably in pdf format, for that matter all the images that you provide on that page are in svg format, you can edit them at your whim opening them in inkscape, or exporting them in pdf format for use with tikz; Here is an example of how to draw using multiple types of macros, and import an image, as you will not lose the vector format, or transparency.

RESULT-1: Running only tikz macros for drawing manually like.

enter image description here

RESULT-2: If you uncomment lines 25 and 42, of the MWE code, the background is added, and if you download the image and convert to a pdf format in the same folder and save it as imag1.pdf, the graphicx macro insert the pdf file without loosing svg properties. In the result the image above is the imported pdf file and below the tikz code generated.

enter image description here

RESULT-3: Uncomment all instruction lines, is imported the second image, saved as imag2.pdf, and the same pdf output from the actual code is inserted, it causes a warning message: multiples pdfs with page group included in a single page, it crashes for three iterations but you can get.

enter image description here

RESUME: You do not necessarily have to draw everything in tikz, you can import images and those that are in svg, that converting them into pdf can be included without problems. in the conversion if you use inkscape you can edit the image in svg, if you are lucky, you can ungroup each part of the drawing and remove the texts, then you can include them by tikz, or else you can give yourself the work of modify some in inkscape like the image below, I think that if the image requires many macros of manual positioning in tikz it is not very practical, instead you can use other programs type WYSIWYG, then import them and add the texts if you think that in those programs the tipeseting is not good. enter image description here

MWE:

\documentclass{standalone}
\usepackage[scaled]{helvet}% For serif family font that allows bold and italy
\usepackage{graphicx}
\usepackage[european]{circuitikz}
\usepackage{tikz}
\usetikzlibrary{patterns,backgrounds,arrows.meta,positioning}
% Font configurtation
\renewcommand*\familydefault{\sfdefault} % Set font to serif family
\DeclareTextFontCommand{\textbfit}{%
  \fontseries\bfdefault % change series without selecting the font yet
  \itshape
}

%Create a new patern for firefox and adobe reader from https://tex.stackexchange.com/a/219808/154390
\pgfdeclarepatternformonly{north east lines b}{\pgfqpoint{0pt}{0pt}}{\pgfqpoint{3.4pt}{3.4pt}}{\pgfqpoint{3.4pt}{3.4pt}}%
{
  \pgfsetlinewidth{0.5pt}
  %Principal line
  \pgfpathmoveto{\pgfqpoint{0pt}{0pt}}
  \pgfpathlineto{\pgfqpoint{3.4pt}{3.4pt}}
  %Complement line north east
  \pgfpathmoveto{\pgfqpoint{-1pt}{2.4pt}}
  \pgfpathlineto{\pgfqpoint{1pt}{4.4pt}}
  %Complement line south west
  \pgfpathmoveto{\pgfqpoint{2.4pt}{-1pt}}
  \pgfpathlineto{\pgfqpoint{4.4pt}{1pt}}
  \pgfusepath{stroke}
}

\begin{document}
\begin{tikzpicture}[
    background rectangle/.style={% Background style
            rectangle, 
            rounded corners,
            shade,
            opacity=0.8,
            top color=black!3,
            bottom color=blue!30,
            draw=black!40!blue!60,
            },
       %show background rectangle, %Uncoment to get the background for crazy result
    %Environment Config
    font=\sf,
    %Style Config
    Dashed/.style ={
        pattern=north east lines b,
        pattern color=black,
        draw,
        thick,
        },
    Arrow/.style ={
        -{Kite[inset=0pt,scale =1.5]},
        thick
        }
]
%Downloaded image from http://www.feynmanlectures.caltech.edu/img/FLP_III/f14-06/f14-06_tc_big.svgz
%Svg file opened in inkscape and exported as PDF as imag1.pdf
%Then imported to my tikz drawing using graphicx package
%\node (IMG1) at (0,5){\includegraphics[scale=1]{imag1.pdf}}; % Uncoment to see only the tikz drawing.
%Drawing manually
\draw[Dashed] (-3,-1.7) rectangle ++(0.35,2.6) coordinate (a);
\draw[thick] (a) rectangle ++(6,-2.6) coordinate (b);
\draw[Dashed] (b) rectangle ++(0.35,2.6);
\draw[thick] (-3.75,1.7) node[label={[label distance=-3pt,font=\Large]90:+}]{} |- (-3,-0.4) coordinate (+);
\draw[fill] (+)++(0,3pt) arc (90:270:3pt);
\draw[thick] (4.5,1.7) node[label={[label distance=-3pt,font=\Large]90:--}]{} |- (3.7,-0.4) coordinate (-);
\draw[fill] (-)++(0,-3pt) arc (-90:90:3pt);
\draw[Arrow](-4.3,1.4) -- ++(0,-1.4);
\draw[Arrow](-0.35,-0.35) -- ++(1.4,0);
\node(B) at (0,0.4){\Large\it B};
\node[circle,draw,thick,on grid, right=20pt of B,inner sep=-1.5pt]{\Large$\times$};
\node(J) at (0,-0.9){\Large\it j};
\node(I) at (-4.6,0.8){\Large\it I};
\node at (0.2,1.2){\large $+(-)$};
\node at (0.2,-2){\large $-(+)$};

%Uncomment to get crazy result
%Downloaded image from http://www.feynmanlectures.caltech.edu/img/FLP_III/f14-07/f14-07_tc_big.svgz
%Svg file opened in inkscape and exported as PDF as imag2.pdf in the same folder
%Then imported to my tikz drawing using graphicx package
%\node (IMG1) at (11,5){\includegraphics[scale=1]{imag2.pdf}};
%\node (IMG1) at (11,-3){\includegraphics[scale=0.5]{examplehelp26.pdf}}; % It could make crazy results
\end{tikzpicture}
\end{document}

My Related posts for this issues: Scaling different components of tikzpicture together., 555 timer schematic, How to use Tikz \shade command in order to achieve 3D like results



UPDATE FOR PATTERNS: SOLUTION FROM tikz pattern north west lines dashed enter image description here

  • I've tried drawing it first but the north east lines are not like what you have. They are more like dash segments. – Owen Allemang Jun 11 '18 at 7:46
  • 1
    It is an interesting observation, if you see in the second result the difference between the patterns of the imported drawing above and the one made with tikz below, it is noted that the one made with tikz does not work for other drivers, I get what you see if I open the file in the firefox viewer, I updated the code with the solution offered in this post – J Leon V. Jun 11 '18 at 15:12
2

It is probably my fault to have directed you to circuitikz. I ended up drawing most with basic TikZ syntax.

\documentclass{article}
\usepackage[european]{circuitikz}
\usepackage{tikz}
\usetikzlibrary{patterns,arrows.meta}

\begin{document}
\begin{circuitikz}
\draw
(0,2)  to [battery1] (0,0) -- (4,0) -- (4,2)
--    node[pos=0.8,circle,fill,scale=0.6](left){}
coordinate[pos=0.7] (l) coordinate[pos=0.5] (m) coordinate[pos=0.3] (r)
node[pos=0.2,circle,fill,scale=0.6](right){}
 (0,2) ;
\draw[fill=gray!30] (4.5,1) rectangle (7.5,6);
\draw[fill=white] (6,4) circle (1cm);
\draw[-latex,thick] (6,3.2) -- (6.4,4.4);
\draw (6,4.8) -- (6,5) node[above,font=\sffamily]{0};
\node[anchor=south west,fill=white] at (4.5,5){$-$};
\node[anchor=south east,fill=white] at (7.5,5){$+$};
\draw[-Circle] (m) -- ++(0,0.5) -- ++(3,0);
\draw[-Circle] (m) -- ++(0,-0.5) -- ++(3,0) -- ++(0,0.5);
\draw[fill=white] ([yshift=3mm]left) rectangle ([yshift=-3mm]right);
\draw[pattern=north west lines, pattern color=black] 
([yshift=3mm]l) rectangle ([yshift=-3mm]r);
\end{circuitikz}
\end{document}

enter image description here

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.