Is there a simple way to increase the size of an arrow tip using something like:
\tikzset{myptr/.style=->, ????}
without designing a new arrow style from scratch?
One solution, very quick, to just scale the arrow head is number %2 in the following:
\documentclass[multi=false,tikz,border=2mm]{standalone}
\usetikzlibrary{arrows,decorations.markings}
\begin{document}
\begin{tikzpicture}
%1
\draw [->,>=stealth] (0,.5) -- (2,.5);
%2
\draw [decoration={markings,mark=at position 1 with
{\arrow[scale=3,>=stealth]{>}}},postaction={decorate}] (0,0) -- (2,0);
\end{tikzpicture}
\end{document}
This produces:
(sorry for excessive zoom).
Much more in the answers to this question and in this answer, that I used as a source.
Addendum
\tikzset approach. This code:
\documentclass[multi=false,tikz,border=2mm]{standalone}
\usetikzlibrary{arrows,decorations.markings}
\begin{document}
\begin{tikzpicture}
\tikzset{myptr/.style={decoration={markings,mark=at position 1 with %
{\arrow[scale=3,>=stealth]{>}}},postaction={decorate}}}
%1
\draw [->,>=stealth] (0,.5) -- (2,.5);
%2
\draw [myptr] (0,0) -- (2,0);
\end{tikzpicture}
\end{document}
produces the same output as the above one (source: PGF Manual, section 2.8).
Obviously you can use -Latex instead of stealth.
There is a new solution, see https://latexdraw.com/exploring-tikz-arrows/#t-1610685307397. It allows changing both the length and width of arrows:
\documentclass[border=1mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,arrows}
\begin{document}
\begin{tikzpicture}
\draw [-{Stealth[length=3mm, width=2mm]}] (0,0.5) -- (1,0.5);
\draw [-stealth] (0,0) -- (1,0);
\end{tikzpicture}
\end{document}
Related
I currently have the code below which produces the later output. I would like to generate the 10 points randomly as I already am. But instead of having blue dashed lines connecting to the the location (0,0), I want them to connect to the other dots if the distance is less than 4cm away.
I attempted things such as storing the data into arrays but updating and accessing the values was not working. I attempted nested for loops but handling the seed became difficult. What is a good way to do this?
\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw[step=0.5cm,color=gray] (-2.5,-2.5) grid (2.5,2.5);
\pgfmathsetseed{2}
\foreach \x in {1,...,10}
{
\pgfmathrandominteger{\a}{-240}{240}
\pgfmathrandominteger{\b}{-240}{240}
\fill [color=red,anchor=center](\a*0.01,\b*0.01) circle (0.1);
% CHANGE HERE
\draw [color=blue,densely dotted] (\a*0.01,\b*0.01) -- (0.0,0.0);
};
\end{tikzpicture}
\end{document}
I seemed to have figured out a solution (not ideal but works for this case).
The key was to use the \pgfmathparse for performing the if statement to get a 0 or 1 to use in \ifnum.
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{math}
\begin{document}
\begin{tikzpicture}
\draw[step=0.5cm,color=gray] (-2.5,-2.5) grid (2.5,2.5);
\pgfmathsetseed{2}
\foreach \x in {1,...,10}
{
\pgfmathrandominteger{\a}{-240}{240}
\pgfmathrandominteger{\b}{-240}{240}
\fill [color=red,anchor=center](\a*0.01,\b*0.01) circle (0.1);
\pgfmathsetseed{2}
\foreach \y in {0,...,\x}
{
\pgfmathrandominteger{\c}{-240}{240}
\pgfmathrandominteger{\d}{-240}{240}
\tikzmath{\i=(\a*0.01-\c*0.01)^2;}
\tikzmath{\j=(\b*0.01-\d*0.01)^2;}
\tikzmath{\k=\i+\j;}
\pgfmathparse{\k < 4.0 ? 1 : 0}
\ifnum\pgfmathresult=1
\draw [color=blue,densely dotted] (\a*0.01,\b*0.01) -- (\c*0.01,\d*0.01);
\fi
};
};
\end{tikzpicture}
\end{document}
I want the line on the left to end right at the y-coordinate of the SPDT input so I can connect them seamlessly with a straight line. As you can see, the line on the left ends a bit lower than the SPDT input which causes the connecting line to be tilted
Is there a way to automatically adjust the length? I'd rather avoid inching towards an acceptable result by adjusting the length over and over again manually.
Here is the code
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{circuitikz}
\begin{document}
\begin{figure}
\begin{circuitikz}
\node [spdt, rotate=90] (S) {};
\draw
(S.in) to [C] ++(0,-2)
to ++(-2,0)
to [V] ++(0,3)
to(S.out 1);
\end{circuitikz}
\end{figure}
\end{document}
Instead of adjusting the length on the left, I would just make sure that it is above the switch and then use -| to connect it with first an horizontal segment and then a vertical segment:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{circuitikz}
\begin{document}
\begin{figure}
\begin{circuitikz}
\node [spdt, rotate=90] (S) {};
\draw
(S.in) to [C] ++(0,-2)
to ++(-2,0)
to [V] ++(0,3.5)
-| (S.out 1)
;
\end{circuitikz}
\end{figure}
\end{document}
I would like to make this diagram in latex but I don't know even how to start:
As said in the comments, the tikz package is great to do this (and about any) kind of diagram.
The following example should give you something to start with.
\documentclass{article}
\usepackage{mathtools}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\begin{document}
\begin{tikzpicture}
\node (left) at ( 0,0) {\(\overbracket[.4pt]{\underbracket[.4pt]{\Delta\Pi} \text{ and } \Delta\mu}\)};
\node (right) at (10,0) {\(\Delta G \text{ and } \Delta T\)};
\draw [-{>[scale=1.5]}] (right.north) to [out=150, in=30] (left.north);
\draw [-{>[scale=1.5]}] (-.7,-.29) to [out=-30, in=-150] (right.south);
\end{tikzpicture}
\end{document}
Is there some simple way to avoid shorting the pins of a FET?
\documentclass{standalone}
\usepackage{tikz}
\usepackage{circuitikz}
\begin{document}
\begin{circuitikz}
\draw (0,0)
to[I,I=$I_s$] (0,2) % The current source
to[short] (2,2);
\draw (2,0)
to node[nigfete]{FET} (2,2) % The FET transistor
to[short] (2,0) to[short] (0,0);
\draw (2,2)
to[short] (4,2)
to[R=$R$] (4,0)
to[short] (2,0);
\draw (4,2);
\draw node[rground]{};
\end{circuitikz}
\end{document}
I am not sure to understand what you want to achieve, but
use short only if you need to add poles or labels, otherwise -- is easier to type;
use the anchors of the components.
tikz is automatically loaded by circuitikz, and that one has a mandatory argument (the voltage direction standard, look at the manual and at the wanings! ;-).
So a first change could be this:
\documentclass[border=4pt] {standalone}
\usepackage[RPvoltages]{circuitikz}
\begin{document}
\begin{circuitikz}
\draw (0,0) node[rground]{}
to[I,I=$I_s$] (0,2) -- (2,2)
node[nigfete, anchor=D](F){FET} % The FET transistor
(F.S) to[short, -*] (2,0) -- (0,0);
\draw (2,2) -- (4,2)
to[R=$R$] (4,0) -- (2,0);
\draw node[rground]{};
\end{circuitikz}
\end{document}
which leads to:
then, in my opinion, it would be better to use relative positioning to make the circuit relocatable.
If you need/want the FET centered in the branch it could be better to start with it or use the calc TikZ library (already loaded by circuitikz). In the following circuit all the movement are relative, so you can move it by just changing the first (0,0):
\documentclass[border=4pt] {standalone}
\usepackage[RPvoltages]{circuitikz}
\begin{document}
\begin{circuitikz}
\draw (0,0) node[rground](GND){} to[I,I=$I_s$] ++(0,2)
-- ++(2,0) coordinate(top)
-- ++(2,0) to[R=$R$] ++(0,-2)
-- (GND-|top) coordinate(bottom)
-- (GND)
($(top)!0.5!(bottom)$) node[nigfete](F){FET}
(F.D) -- (top) (F.S) -- (bottom);
\end{circuitikz}
\end{document}
I'm trying to draw this in latex.
Anyone know how?
Use the calc-library and do the following:
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}
\node[draw=black, circle, fill=green] (A) at (0,0) {A};
\draw let \p1=(A) in (A) -- (\x1+40,\y1+10);
\end{tikzpicture}
\end{document}
Using the let-statement it allows you to specify a reference point (or even more) to use it's coordinates for further calculation.