# Tag Info

34

Version, which uses uninterrupted circles (without faint lines), where the gaps are created by clipping. This solution does not use any white background color. The measurements and colors are taken from my answer in Programming Puzzles & Code Golf. \nofiles % .aux file is not needed \documentclass{standalone} \usepackage{tikz} \usetikzlibrary{calc} \...

20

Apparently, the idea of scoping the relevant code in pics works. Here is an example: \documentclass[tikz,border=2mm]{standalone} \usetikzlibrary{fit} \tikzset{pic shift/.store in=\shiftcoord, pic shift={(0,0)}, mytest/.pic = { \begin{scope}[shift={\shiftcoord}] \node (-A) at (0,0) {A}; \node (-B) at (0,1) {B}; ...

16

This seems like a perfect problem to use the tikz library knots on! The current solution is improved from the original, which had some minor "clipping issues" (for more info, see here). I consider this solution quite elegant because the code is very simple, clear and short. \documentclass{article} \usepackage{tikz} \usetikzlibrary{knots} \begin{document} \...

15

This is a work around rather than a solution. I wonder if this is a bug but my understanding of tikz is just not good enough to know for certain. Apparently, tikz no longer likes something about the to operation here within the pic. What tikz appears to be doing in the case of the \draw... to.. operation is doubling the prefix so that it looks for ...

10

I dig a little bit and this is what I found: When TikZ encounters \draw(A)to(B), this is what will happen \def\tikztostart{\tikz@pp@name{A}}; usually this is simply A; \def\tikztotarget{\tikz@pp@name{B}}; usually this is simply B; The every to/.code is applied here. In the simplest case, to is merely --, so TikZ now executes \draw(\tikztostart)--(\...

10

This is indeed a bug, but for a different reason, I think this is happening at the same place when the parsing is done in \tikz@subpicture@handle@ but still I didn't understand perfectly how it goes wrong. When TikZ starts parsing the last \draw command in the pic code and encounters node names, the name prefix is already set. But the object it is parsing ...

10

Simply add a .default key at the end of the \tikzset call: \tikzset{ % House pics/house/.style args={#1/#2/#3}{ code={ Code of the pic } }, pics/house/.default=0.65/0.15/35 }

10

Please always read manuals first. That helps a lot, especially since you are asking for tikz basis knowledge. \documentclass{article} \usepackage{tikz} \usetikzlibrary{positioning} \begin{document} \begin{tikzpicture} \node[draw=none] (a) {File of program}; \node[draw=black,below=2 of a] (b) {Pre processor}; \node[draw=none,...

10

You need to place the \includegraphics inside a \node, as in the code below. I added some comments, but it's quite straightforward, mostly just place the node at the correct location, and set the proper size for the image. \documentclass[border=5pt]{standalone} \usepackage{amsmath} \usepackage{tikz} \begin{document} \begin{tikzpicture}[scale=.5,every ...

10

Here are threefour examples of things that are much harder to achieve in the macro approach. The first three examples have been translated to macros in the revised question. \documentclass{article} \usepackage{tikz} \begin{document} \subsection*{Pics can have more complicated constructions} \tikzset{rectanglepath/.pic={\draw (-0.5,-0.5) rectangle ++(1,1); \...

9

Package adjustbox Your preamble already contains package adjustbox. It provides the features you need for trimming and clipping I am not sure, which spacing is needed around the image. The following example lets the image behave as it would have the height of the upper case letter H and the depth of g. \documentclass[12pt,a4paper]{article} \usepackage{...

9

Here's a working example. I've reformatted it a fair bit and added some styles to help keep straight what's doing what. \documentclass[12pt,tikz,border=3mm]{standalone} \usetikzlibrary{arrows.meta,% positioning,% shapes,calc%% } \tikzset{%% ura hub/.style={circle, anchor=center, ...

9

Have a look at the following code: \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture}[scale=5] \draw[blue] (0,0) circle (1); \node[circle, fill=orange, label=above left :$A$] (A) at (95:1) {}; \coordinate[label=below left :$B$] (B) at (200:1); \coordinate[label=below left :$D$] (D) at (-110:1); \...

9


8

This is a partial answer. It aims to do 2 things: demonstrate how to adjust the vertical and horizontal positioning of the second pic appropriately; clarify the issue concerning the distortion of the second tree. By default, the second pic gets aligned with the centre of the first pic. The A node in each tree is centred on (0,0) relative to the pic ...

8

You can name internal objects and refer to them by using the pic name later. \documentclass[tikz]{standalone} \usetikzlibrary{positioning} \tikzset{ pics/mp3/.style={ code={ \node[rounded corners=10*#1,draw,anchor=center, minimum height=2cm,minimum width=6cm, transform shape] (-cover) at (0,0) {}; \draw[...

8

A version in Metapost, wrapped up in luamplib. Compile with lualatex. \RequirePackage{luatex85} \documentclass[border=5mm]{standalone} \usepackage{luamplib} \begin{document} \mplibtextextlabel{enable} \begin{mplibcode} beginfig(1); path circ; pair A,B,C,D; circ = fullcircle scaled 8cm; A = point 95*8/360 of circ; B = point 200*8/...

8

I don't know the cause for this problem, it's probably related to the path construction with .pic. But if you explicitly say that the node should be in the path midway it works normally: \documentclass{standalone} \usepackage{tikz} \tikzset{thepic/.pic = {\draw (0, 0) edge node[midway]{0} (1, 0);}} \begin{document} Without \texttt{.pic}: \tikz{\draw (0, 0) ...

8

This is how .pic is defined in tikz.code.tex line 4636-4640 \pgfkeysdef{/handlers/.pic}{% \edef\pgf@temp{\pgfkeyscurrentpath}% \edef\pgf@temp{\expandafter\tikz@smuggle@pics@in\pgf@temp\pgf@stop}% \expandafter\pgfkeys\expandafter{\pgf@temp/.style={code={#1}}} } The author missed a % at the end of line 4639. I reported it as a bug here: https://...

8

I don't think you need a sledge hammer like tikzpicture for this diagram: \documentclass{article} \usepackage{amsmath} \usepackage{rotating} \newcommand\longvertarrow[1][]{\rotatebox{-90}{$\xrightarrow{\hspace{4em}}$#1}} \begin{document} \begin{tabular}{c} File of program\\[-1.5ex] \longvertarrow[~] \\ \fbox{\enspace Pre processor\enspace}\\[-1ex] \...

7

Something like this? I used random steps decorator for the green path, and "manually" built the black path, using some key points and start/end angles. Also note the use of polar coordinates, which are more appropiate for this case than cartesian ones. \documentclass{standalone} \usepackage{tikz} \usetikzlibrary{decorations.pathmorphing,shapes.geometric} \...

7

in year 2010 Mark Wibrow suggested me (for the similar problem) the hack which enable correct dropping show at custom fill of multi part node shape. using it in your (now really) mwe is: \documentclass[tikz, margin=3mm]{standalone} \usetikzlibrary{positioning, shadows, shapes.multipart} \pgfdeclarelayer{foreground} \...

7

This is in case you change your mind and use the adjacency matrices to draw the graphs. TikZ allows you to define arrays, see p. 999 of the pgfmanual. And these arrays can be converted to tables using this nice answer. And these matrices/arrays can also be used to define the graphs. \documentclass[tikz,border=3.14mm]{standalone} \usepackage{etoolbox} \...

6

As an extension of the example used in the PGF documentation about pics, I propose to draw coconuts, and attach them to seagulls (as we are lacking swallows). We will use the seagull pic defined in the manual, and introduce another very simple pic called coconut, but we want to ensure that each coconut is attached to a seagull. Here is the definition of ...

6

I think the problem is the order in which the scope is set up and the layer changed to the background layer (although I am not sure of the low level details). When using the on background layer key the scope is set up and the the layer changed. What is required is the reverse: the layer changed and then the scope set up. This might be a bug, unless there ...

6

A circle with radii at each 10 degrees can be drawn with simple means: \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} \def\Radius{2.5cm} \draw \foreach \a in {0, 10, ..., 350} { (0, 0) -- (\a:\Radius) } (0, 0) circle[radius=\Radius] ; \end{tikzpicture} \end{document} Including the annotations: \...

6

like this? it is not drawn as pic ... i found this images in collection of my answers, so you question is duplicate (unfortunately I din't make notes about questions). edit: now are corrected blocks names and added note of limitation of the first proposed solution \documentclass[tikz, border=3mm]{standalone} \usetikzlibrary{calc} \begin{document} \...

6

If the code is "repetitive" that's a good indication that you should be using \foreach somewhere: the three circles are essentially the same, so you only need to write them once if you use a \foreach statement. This also makes the code clearer and easier to modify. In terms of adding fill=white the reason why this does not work with the code in the ...

6

an alternative, with use of plot functions and intersections: \documentclass[tikz, margin=3mm]{standalone} \usetikzlibrary{arrows.meta,intersections} \begin{document} \begin{tikzpicture}[ LR/.style = {draw=red, ultra thick, line cap=round}, LG/.style = {draw=gray, thick, dashed, line cap=round}, > = Straight Barb ] % limit ...

Only top voted, non community-wiki answers of a minimum length are eligible