Questions tagged [tikz-pic]

A “pic” is a “short picture” that can be inserted anywhere in TikZ picture where you could also insert a node.

Filter by
Sorted by
Tagged with
32
votes
3answers
3k views

How to get rid of the almost invisible faint lines in the Olympic rings?

I want to draw Olympic rings and used the code from here, which is, % Olympic rings % Author: Paul Gaborit \documentclass[a4paper]{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} \...
23
votes
2answers
3k views

Anchoring TiKZ pics

Is it possible to anchor a TiKZ-pic on an internal anchor? I know (more or less) how to use TiKZ pics and know that they are draw arround their origin. What I would like to be sure is that it's not ...
21
votes
3answers
3k views

How to give a name to \pic

I read instruction how to use \pic in PGF 3.0.0 manual, but description how to give names to \pic are not clear to me and given example generate error: "No shape named EmmaEmma-left is known." ...
16
votes
1answer
316 views

pic versus macro in TikZ

Consider this code in the TikZ - PGF manual, which uses a macro % Main code from % The TikZ - PGF manual % Author: Till Tantau et al % Version 3.1.3, released May 9, 2019 % Page 40 \...
12
votes
1answer
230 views

In tikz, why does a pic with a tree get distorted upon positioning with e.g. `right=of`

I'm trying to connect with edges tikz pics. I thought of using (sub)graphs like subgraph I_n and specifying the nodes with the V key, but I get an error: Undefined control sequence. \tikz@lib@graph@...
12
votes
2answers
205 views

TikZ: strange behaviour of cycle / coordinate / pic name in TikZ pics

In a TikZ pic, the combination of -- cycle, \coordinates, and the name key (or using parenthesis) only works sometimes. \documentclass{article} \usepackage{tikz} \begin{document} \tikzset{ ...
10
votes
3answers
898 views

How to fill a split node with two different colors?

I have that issue when try to fill a split node with two different colors. After using rectangle split part fill={red,blue} as an node argument the drop shadow overlap the node because I don't use the ...
9
votes
1answer
1k views

TikZ Pics with optional/default parameters

I am trying to set up a small TikZ library or package with pics I can reuse. Thus, I create a file called "tikzlibraryBES.code.tex" with the following content: \tikzset{ % House pics/house/....
9
votes
2answers
1k views

How should I prevent a .pic definition inside a document environment, but outside a tikzpicture, from adding a space to the typeset output?

How can I prevent the definition of a .pic from adding an additional space to the typeset output, where the .pic is defined in a \tikzset{} within the document body, rather than either in the preamble ...
8
votes
2answers
665 views

Tikzpicture scope background image

I copied and modified the code given on http://www.texample.net/tikz/examples/swan-wave-model/ \begin{figure}[H] \begin{tikzpicture}[scale=.5,every node/.style={minimum size=1cm},on grid] \...
8
votes
1answer
473 views

Problems combining clip, layer and pic when multiple instances are included in the same tikzpicture

I'm having trouble figuring out how I am supposed to combine (or if I am supposed not to combine) pics, clipping and layering when more than one instance of a pic is included in a single tikzpicture ...
7
votes
3answers
499 views

Overlapping nodes in a decision tree

I have the following decision tree taken from this example with little modification. When I added two sub-nodes to the second right node, the inner left and inner right nodes have been overlapped. How ...
7
votes
1answer
711 views

Anchoring complex tikz pic

In my illustration I need a sketch of clock. For it I use pic capability of TikZ. It works fine with quit annoying exception: positioning of clocks in picture. If I put a clock at some absolute ...
7
votes
1answer
119 views

How to use composite Tikz pics with rotation

I am trying to draw a tiled pattern, building it from simpler elements using pic. This is a simplified version of my code \documentclass[tikz,border=2mm]{standalone} \usepackage{tikz} \begin{...
7
votes
1answer
157 views

How to give a name to \pic (part II)

When I was looking for the solutions of How to give a name to \pic, I discovored that it looks like that the problem is only with the code of \tikztostart in the to path and not with the \tikztotarget....
6
votes
3answers
411 views

Tikz Payoff Matrix

I am trying to remove the bottom two rows (C and D) completely so as to create a 2*4 payoff matrix. In addition to this, I would also like to move "Player 2" up slightly once they have been removed (...
6
votes
1answer
114 views

TikZ: Bug (?) with `.pic`: misalignement of nodes

I am using .pic to use a same picture several times. I noticed a difference of behavior between the same code inside a .pic or outside. In the example below, one can notice that within a .pic, the ...
6
votes
1answer
2k views

Various questions on the pic command from the Tikz angles library

I have a few questions regarding the pic command from the tikz.angles library that I am trying to experiment (the documentation in the Tikz-pgf manual remain very obscur to me). So here is one bit of ...
6
votes
1answer
444 views

A nice example with `name prefix ..`

TiKZ pics include a new key called name prefix ... TiKZ documentation defines it with /tikz/name prefix .. This key is available only inside the code of a pic. There, it (locally) ...
6
votes
3answers
604 views

TikZ using \tkzMarkAngle in pics

I am trying to draw some Penrose tiling in order to learn more about tikz, and I can now make pics and place them. But I can't label angles: if I use \tkzMarkAngle (which would be ideal) in pics, I ...
6
votes
1answer
2k views

Understanding TikZ anchors using pics

With the MWE below, I get the following figure: Could someone explain me why in the right figure, the red circle is not "inside" the square? I guess it has to do with the square being a node, and not ...
5
votes
2answers
239 views

Tikz and lines with the Q letter

I do have a tex, that always show me a twolines, in a tikzfigure when letter Q is in the line. Let me share the TEX with you \documentclass[parskip]{scrartcl} \usepackage[margin=10mm]{geometry} \...
5
votes
1answer
333 views

Spherical Polar Diagram

I'm trying to recreate (pretty much copy) the Example image with Latex, but I can't really figure out how to draw the xz plane arc and the other arcs. I got it to a certain point, as seen below. ...
5
votes
1answer
458 views

Perfect crossing of two dashed lines

I need to draw to dashed line which cross at the center of a circle using the tikz package. I would like to obtain a pefect cross at the center of the circle so I wonder if there is a method to force ...
5
votes
1answer
1k views

Node positioning relative to `\pic`

I want to position a node relative to a \pic. I'm able to position a \pic relative to a node, but I want it the other way. \documentclass{standalone} \usepackage{tikz} \tikzset{ pics/mp3/.style ...
5
votes
1answer
266 views

How to add fill in a \pic?

I wrote a TikZ pic for a simple database icon (first picture below). What I want is to hide the two edges that are behind overlaying boxes, similar to the second picture. I thought I could add a white ...
5
votes
1answer
596 views

tikz - Curved cloud shape

So here is my code that produces a circle with text inside and three clouds, also with text, around it. I would like the clouds to curve in an arc around the circle, if that is possible. There is this ...
5
votes
1answer
175 views

Shading grid which is fully inside slips

I have an ellipse drawn over a grid of small square, I need to shade those square in which are fully inside the ellipse, is there is way to do it without trying to shade one by one for each square? ...
4
votes
2answers
873 views

Generating adjacency matrices from isomorphic graphs

Here are some isomorphic graphs and their corresponding adjacency matrices. I can draw the graphs with tikz. But I'm not sure the best way to draw the matrices. Is it possible to generate one from ...
4
votes
1answer
654 views

Crop an image in tikz using 2 points of reference and a height

Consider the following code: % DOCUMENT TYPE \documentclass[12pt,a4paper]{article} % PACKAGES \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage[english]{babel} \usepackage[margin=10pt,...
4
votes
4answers
1k views

Arrow Between Equations

Is there a better way to put arrows between equations? \documentclass{article} \usepackage[utf8]{inputenc} \usepackage{amsmath} \usepackage{tikz} \begin{document} \begin{tikzpicture} \node at (-4,0)...
4
votes
2answers
406 views

TikZ: clip with Pic?

Title explains it all really, I want to clip a picture using an exiting .pic that I have already defined, as I plan on using this clip shape many times over. \documentclass[border=5pt]{standalone} \...
4
votes
1answer
197 views

How to move tikzpicture with named nodes?

I am trying to position an image with rounded corners to a specific position on screen. However, according to the following post, yshift and xshift do not affect nodes that are named and I am still a ...
4
votes
1answer
71 views

problem with fadings and pic

I try to generate several copies of a faded text using the PG 3.0 pic feature but something with the placement went wrong. Only the one at the origin is drawn. Here is what I have done: \...
4
votes
2answers
94 views

Named paths inside a tikz/pic

I am trying to understand the naming behavior of paths inside a pic definition. Consider the following \documentclass{standalone} \usepackage{tikz} \usetikzlibrary{intersections} \tikzset{% ...
4
votes
1answer
86 views

Placing the middle of a predefined picture at a certain node

I am trying to create the following reaction network cycle. Here's my output so far. My MWE is \documentclass[11pt]{standalone} \renewcommand*{\familydefault}{\sfdefault} \usepackage{sfmath} \...
4
votes
1answer
549 views

drawing directed graph

How can I draw an edge from (ab) to ($a^3$$b$)? I tried using \Edge(ab)($a^3$$b$) like I did for drawing an edge from (b) to (e) but the same method didn't work. I think it has something to do with ...
4
votes
1answer
126 views

making a cartoon plot of some grids using tikz

I want to use latex to generate similar figure as following plot using tikzpicture. For instance using the example given here \documentclass{article} \usepackage{tikz} \begin{document} \begin{...
4
votes
1answer
538 views

How can I pass an array as argument to a tikz pic?

I would like to pass an array as the first argument to a pic. However, the naive method doesn't work: \documentclass[border=10pt]{standalone} \usepackage{tikz} \tikzset{ ball/.pic = { \...
4
votes
1answer
106 views

Create projection inside matrix - tikz 3dplot

I can create two nodes in tikz-3dplot, and create a projection like view, like this : But how to create view like this(the right one- only those projection lines) ? I have created the basic, I just ...
4
votes
1answer
381 views

Nested tikz pics?

I have a basic pic ("brick") that I rotate/flip/shift within other pics (e.g. "wall"). These pics ("wall") then get drawn in my tikzpicture, possibly themselves rotated/flipped/shifted. The brick pic ...
4
votes
0answers
103 views

Accessing a node defined inside a pic outside its definition [duplicate]

I am trying to access a node defined inside a pic definition outside its scope. I found this example in the PGF manual v3.0.1a on page 254. The example given is as follows. \documentclass{standalone} ...
3
votes
2answers
339 views

How to use fit tikzpicture in a LaTeX file

I use tkiz to draw a picture in LaTeX. It works with me with \documentclass[border=5pt,tikz]{standalone}. However, when I try to use the same code in my original LaTeX file \documentclass[english]{...
3
votes
4answers
214 views

Triangle. Changing vertices. Draw the height of the triangle

1) I'm a drawing triangles in latex, but I want the vertices A and B to be horizontal. In the code below vertices A and C are horizontal. I have problem changing the code. 2) I want to add a ...
3
votes
2answers
278 views

Section of sine / clipped sine

I want to draw a limited sine curve. My problem is, that I know how to draw 1/4 sin but not how to get only a section of it. \setlength{\unitlength}{1mm} \begin{minipage}{\linewidth} \begin {...
3
votes
1answer
162 views

Designing this graph with tikz

How can I design this diagram with tikz? \documentclass[a4paper]{book} \usepackage{tikz} \usepackage{tkz-berge} \usetikzlibrary{matrix,positioning,arrows,calc,patterns,automata} \begin{document} \...
3
votes
4answers
370 views

How to make a flow chart with the arrows across the box?

I want to draw a flow chat like this But I have no idea how to make those arrows across the box, and make the boxes larger. \documentclass{beamer} \usepackage{amsmath} \usepackage{tikz} \usepackage{...
3
votes
1answer
160 views

TikZ: How to pass default option to pic?

Is there a way to pass default options to a pic? In the MWE, the option transform shape is passed to an instance of a pic. Is it possible to make this option the default for all pics square such that ...
3
votes
2answers
111 views

Currency symbol not working in tikzpicture

I want to create a currency exchange graph as shown with currency symbol instead of wordings in nodes. and this is the original code \documentclass[10pt,a4paper]{article} \usepackage{tikz,tkz-berge} ...
3
votes
2answers
410 views

How to make properly macro with the use of pic?

I'd like do make a picture that consists of few blocks. One of these blocks I called \elementsymbol (in MWE below) - it consists of an arrow surrounded by a circle. I have the problem with scaling of ...