35 votes
Accepted

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

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 ...
user avatar
25 votes
Accepted

Anchoring TiKZ pics

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, ...
user avatar
18 votes
Accepted

How to give a name to \pic

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 ...
user avatar
  • 184k
17 votes

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

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 ...
user avatar
  • 938
16 votes
Accepted

TikZ Pics with optional/default parameters

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 }
user avatar
14 votes

How to give a name to \pic

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@...
user avatar
  • 35.5k
11 votes

making a diagram like this picture

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} ...
user avatar
  • 32.2k
10 votes

How to give a name to \pic

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 ...
user avatar
  • 154k
10 votes
Accepted

Anchoring complex tikz pic

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,% ...
user avatar
  • 49k
10 votes
Accepted

Tikzpicture scope background image

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 ...
user avatar
9 votes
Accepted

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

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 ...
user avatar
  • 184k
9 votes
Accepted

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

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 ...
user avatar
9 votes

To draw a graph like this, what code do I need?

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 :$...
user avatar
  • 4,828
9 votes
Accepted

making a diagram like this picture

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}{$\...
user avatar
  • 261k
8 votes
Accepted

Node positioning relative to `\pic`

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[...
user avatar
  • 154k
8 votes

To draw a graph like this, what code do I need?

A version in Metapost, wrapped up in luamplib. Compile with lualatex. \RequirePackage{luatex85} \documentclass[border=5mm]{standalone} \usepackage{luamplib} \begin{document} \mplibtextextlabel{...
user avatar
  • 36.1k
8 votes
Accepted

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

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: \...
user avatar
8 votes
Accepted

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

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}% ...
user avatar
  • 35.5k
8 votes
Accepted

How can I draw this figure about Hidden Markov Model?

For exercise (how to draw dashed line and use empty cells): \documentclass[margin=3mm]{standalone} \usepackage{tikz-cd} \usepackage{amsmath} \begin{document} \begin{tikzcd}[nodes in empty cells] ...
user avatar
  • 255k
7 votes
Accepted

A nice example with `name prefix ..`

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 ...
user avatar
7 votes

drawing a 2D-plane

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 ...
user avatar
  • 54.5k
7 votes
Accepted

Various questions on the pic command from the Tikz angles library

It seems to me that you must use coordinate names. My guess is that the internals use \pgfpointanchor or some such, which requires a named node. It's probably good form to name your coordinates anyway!...
user avatar
  • 3,398
7 votes

How to fill a split node with two different colors?

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: \...
user avatar
  • 255k

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