Tag Info

New answers tagged

5

This is a case in which the power of the forest can be helpful; the tier key let's you get the desired alignment with no effort (notice also the shorter code): \documentclass{article} \usepackage{forest} \tikzset{ treenode/.style={ align=center, inner sep=2pt, rounded corners=2pt, minimum width = 2cm, font=\sffamily }, block/.style={ ...


5

This is a possible solution. To remove the space use coordinate instead of node, Here edge from parent/.style={draw=none} is used to not draw the line from P6 to P7, then draw the (P6)--(P7) line manually. Code \documentclass[border=1cm]{standalone} %\documentclass[landscape]{article} \usepackage{tikz} \usetikzlibrary{shapes,arrows} \begin{document} ...


2

The circle shape is the circumscribed circle to the standard rectangle shape. So, if you want that this circle to be with radius 2cm, you have to put one length of the rectangle to 2cm and the other to 0cm. \documentclass[varwidth,border=7]{standalone} \usepackage{tikz} \usetikzlibrary{calc} \begin{document} \begin{tikzpicture}[every node/.style={draw, ...


1

An alternative: use of orthogonal coordinate Code \documentclass[border=10pt,varwidth]{standalone} \usepackage{tikz} \usepackage[american,siunitx]{circuitikz} \usetikzlibrary{calc,positioning} \begin{document} An alternative solution \begin{circuitikz} \draw (0,0) node[op amp](opamp){} (opamp.out) to[short,*-o] (2,0)node[]{} node[right]{$v_{out}$}; ...


0

\draw let \p1=(opamp.out),\p2=(opamp.-) in (opamp.-) to [short,*-] ++(0,1) node{} to [R,l=$R_2$] ++($(\x1,0)-(\x2,0)$); Note that you have to \usetikzlibrary{calc}. The let syntax let you alias the points with names \p1 ... \pN, where N is the number of points. Then, after in, you could access points' coordinates with the syntax \x1 .. \xN and \y1 .. \yN ...


5

Actually, tikz nodes have text inside and labels outside: \documentclass{standalone} \usepackage{tikz} \begin{document} \begin{tikzpicture}[scale=0.8,every node/.style={draw=black,circle}] \node[label={\small 1/16}] (a) at (0,0) {a}; \node (b) at (2,0) {b}; \draw[->] (a) to (b); \end{tikzpicture} \end{document}


1

A PSTricks solution using the pst-node (for the drawing itself) and expl3 packages (for the bounding box and the label distance): \documentclass{article} \usepackage{pst-node} \usepackage{expl3} \ExplSyntaxOn \cs_new_eq:NN \calc \fp_eval:n \ExplSyntaxOff \def\labelSep{\calc{28.75*\radius+3.375}} % found by experimenting % parameters ...


6

One answer using the rotation symetry of the figure : \begin{tikzpicture}[thick, scale=.35] \draw[densely dotted, gray, shift={(-4.5,-4.5)}] (0,0) grid +(9,9); \draw (-4.5,-4.5) rectangle (4.5,4.5); \node {x}; \foreach[count=\i] \a in {0,1,2,3} { \begin{scope}[rotate={90*\a}] \draw (4.5,3.5) -| ++(-1,-1) -| ++(-1,-1) -| ++(-1,-1) -- ...


3

Just playing around (without tikz), building up stacked layers of \Sv (solid vertical), \Dv (dashed vertical), \Sh (solid horizontal), \Dh (dashed horizontal). Optional argument on vertical lines provides text following line Quirks: \Sd (solid dot) needed in upper right corner of graph, due to the way I construct things. and \intersect may need to be ...


4

\documentclass[tikz,border=5mm]{standalone} \newcommand{\mytab}[1]{% \begin{tabular}{@{}c@{}} #1 \end{tabular} } \begin{document} \begin{tikzpicture} \draw (0,0) -- (11,0); \foreach \x in {0.8,4,5.5,7,10.2} \draw(\x cm,3pt) -- (\x cm, -3pt); \draw (0.8,0) node[below=3pt] {$T_0$}; \draw (4,0) node[below=3pt] {$T_1$}; \draw (5.5,0) node[below=3pt] {$0$}; \draw ...


1

not elegant, but it works \documentclass{article} \usepackage{tikz} \begin{document} \begin{figure}\label{fig: timeline} \begin{center} \begin{tikzpicture} \draw (0,0) -- (11,0); \foreach \x in {0.8,4,5.5,7,10.2} \draw(\x cm,3pt) -- (\x cm, -3pt); \draw (0.8,0) node[below=3pt] {$T_0$}; \draw (4,0) node[below=3pt] {$T_1$}; \draw (5.5,0) node[below=3pt] ...


3

You should use blend group inside a scope. Instead of screen, multiply is more suited for your case. Further, I have changed the unit vectors instead of scale. \documentclass[12pt, tikz, border=5]{standalone} \usetikzlibrary{backgrounds} \tikzset{background rectangle/.style={draw,very thick,fill=gray!10}, textbox/.style = {draw, fill=white, ...


5

Like this? \documentclass{article} \usepackage{tikz,lipsum,showframe} \tikzset{mybox/.style = {text width=\dimexpr\linewidth-20pt-\pgflinewidth\relax,align=justify,draw=red, very thick, rectangle, rounded corners, inner sep=10pt, inner ysep=10pt}, fancytitle/.style ={fill=red, text=white,rounded corners} } \begin{document} \noindent ...


4

This doesn't look like the image but your code suggests that you are modifying it somewhat and I worked with that. \documentclass{article} \usepackage{tikz} \usepackage{subcaption} \usepackage[scale=.8]{geometry} \usetikzlibrary{positioning,arrows} \tikzset{ block/.style={ draw, rectangle, minimum height=1.5cm, minimum width=3cm, ...


0

TikZ 3.0 introduced node contents option which replaces {...} And another example to easily test it \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture}[% stuff/.style={% draw, node contents={A}} ] \node at (0,0) [stuff]; \node at (0,1) [stuff]; \node at (0,2) [stuff]; \node at (0,3) [stuff, node contents={B}]; ...


2

You can change global path thickness as below, so you no need to change it here and there: \documentclass[tikz]{standalone} \begin{document} \tikzstyle{every node}=[font=\large] \tikzstyle{every path}=[line width=2pt] \begin{tikzpicture}[ every node/.append style={circle, draw=blue!80, inner sep=2pt, minimum size=12pt}] \node (1) at ...


3

If you're looking for an arbitrary coordinate around the perimeter you can use (name.number), where name is the shape name and number is an angle in degrees measured from name.east. \documentclass[border=2mm]{standalone} \usepackage{tikz} \usetikzlibrary{shapes.geometric,plotmarks} \begin{document} \begin{tikzpicture} \node[name=s, shape=regular polygon, ...


5

Defining new anchors is tricky and basically impossible without looking at the PGF code used to define the shape. But aliasing anchors is quite straightforward (once you have the command to do it): \documentclass[tikz,border=5]{standalone} \usetikzlibrary{shapes.geometric} \makeatletter \def\pgfaliasanchor#1#2#3{% \expandafter\gdef\csname ...


3

It looks that you have exported this code from some drawing software, hence it is not readable enough. On the other hand, for such simple diagrams, you can write the code yourself. Here is one sample: \documentclass[tikz,border=5]{standalone} \definecolor{uuuuuu}{rgb}{0.266666666667,0.266666666667,0.266666666667} \definecolor{zzttqq}{rgb}{0.6,0.2,0.} ...


3

The \resizebox will scale both the graphics and the text. It would be better if you just applied a scale to the tikzpicture instead: Notes: I commented out the stuff that was irrelvant to this question. I also commented out the \begin{scriptsize} and \end{scriptsize}, as that was also resulting the changes in font size of the text. Am not sure if that ...


4

It is possible to insert a preprocessor, but obviously this involves a teensy hack of the node parser. In the code below I define a preprocess node content key which takes a macro as an argument. This macro should be defined to take one argument, which will be the text to process. Obviously if there is something more complex than simple text then the whole ...


3

There is actually a preprocessor in disguise. You can use the node contents key started with TikZ 3. And via style nesting it becomes a preprocessor. But the downside is that you have to give all the specs within the brackets because closing bracket finishes the node parsing on a path. Edit: After cfr's correction, a little better with the option to choose ...


2

Thanks to @cfr , this is the solution I came up with. I didn't fully go with his solution because I need \myn unaltered for later purposes in my main document. \documentclass{article} \usepackage{tikz} \usetikzlibrary{calc} \makeatletter \newcommand\aescandash[1]{%% \let\ae@scan@dash@result\relax \ae@scan@dash@parse#1_\@nil \ae@scan@dash@result } ...


5

Why not just this? \documentclass[tikz,border=5pt]{standalone} \usetikzlibrary{calc} \makeatletter \newcommand\aescandash[1]{%% \let\ae@scan@dash@result\relax \ae@scan@dash@parse#1_\@nil \ae@scan@dash@result } \def\ae@add@to@result#1#2{%% \ifx#1\relax \def#1{#2}%% \else \expandafter\def\expandafter#1\expandafter{#1#2}%% \fi} ...



Top 50 recent answers are included