New answers tagged

2

Here's a way of doing it with PGF keys and a couple of macros. It allows you to say \tikzset{% S1 set={3,5,8}, S2 set={1,4}, } for example, to determine which nodes should take each of styles S1 and S2. It is probably a bad idea to name nodes using numbers alone, but I've not changed this in the code below. (Giving each a standard prefix is an easy ...


2

This version adopts etoolbox, very powerful package for setting conditions. I guess it could be included in the \tikzset but I'm not sure how yet. I'll edit the answer in case. Output Code \documentclass[margin=10pt]{standalone} \usepackage[utf8]{inputenc} \usepackage{amsmath} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{tikz} ...


1

Frankly said, I do not understand what you doing in your code and what should be your result, so the main purposes of this answer is clarify this. The MWE below generate this picture: where colors are select on basis even/odd number in \label: \documentclass[10pt,a4paper]{article} \usepackage[utf8]{inputenc} \usepackage{amsmath,amsfonts,amssymb} ...


2

You can call \usetikzlibrary{positioning} to specify where to place a label. In this case, you want it to the northeast, so you'd specify it as \node[above right=<distance> of \label]. I found a distance of 0 looked nice, but you can adjust it as needed. \begin{tikzpicture} \foreach \i in {1,...,9} { \pgfmathtruncatemacro{\y}{(\i - 1) / 3}; ...



Top 50 recent answers are included