2
votes
1answer
62 views

Macro for pgfplot cycle list entry

I'm trying to define multiple cycle lists based on macro variables. The reason for this is that I need more than one list and I want to be able to change the appearance quickly while keeping the ...
4
votes
1answer
67 views

Passing variable as argument

I need to pass a variable to a command, but I cannot get it to work. Here is a short example that shows that #1 can be sent to a command, but not a variable that is a copy of #1. Why is this? ...
7
votes
2answers
157 views

Expanding a sequence inside a TikZ path

I am trying to draw a simple path using TikZ, with a custom syntax to specify it. This works: \documentclass{article} \usepackage{tikz} \begin{document} \newcommand{\latticepath}[1]{ ...
4
votes
1answer
138 views

Is it possible to define abbreviations for coding?

I am using the tikz-timing package to create a timeline since chronosys and chronology wouldn't cooperate and were too limited and archaic-looking to suit my purposes, and moderntimeline unfortunately ...
6
votes
3answers
167 views

How can I get these two nested \foreach loops to work?

I try to use nested \foreach loops to create edges between many nodes. \documentclass{standalone} \usepackage{tikz} \begin{document} \begin{tikzpicture} \node (a) at (0, 1) {}; \node (b) at (0, ...
4
votes
1answer
63 views

Preventing argument expansion

TikZ is able to define parametrized styles using arguments like #1. If used in \newcommand or \newenvironment, they mix up with the arguments of the command. The effect is so severe that the following ...
9
votes
2answers
209 views

Expansion problems with pgfkeys

I'm using pgfkeys, and a fairly adventurous syntax in which the values for some keys contain additional key/value pairs. (For instance, the value of the nodes key is a list of pairs, and the second ...
7
votes
1answer
1k views

Difference between \newcommand and \pgfmathsetmacro used in TikZ \coordinate

Consider the following code: \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} \newcommand{\MA}{4} \pgfmathsetmacro{\MB}{4}; \coordinate (V11) at (0,0); ...
12
votes
1answer
309 views

How to expand a macro used in the range of a foreach loop?

Motivating Example: Suppose that I want to draw the following tree: root / \ / \ / \ A B C D This is easy enough to do by explicitly drawing the two subtrees as children of ...
6
votes
3answers
181 views

How to “demux” several aspects from a `\foreach` variable with `\ifstrequal`?

How can I "demux" several features from a mode specification given in a \foreach? I would like to use a \foreach to draw several nodes in a TikZ picture. The loop will specify a mode for each ...
8
votes
1answer
503 views

'Undefined control sequence' error when defining a color through a macro

I'm trying to color a cell using its data value. However, when I try to compute some value (using the content of the cell) then the definition of the color color!\somemacro in the \cellcolor does not ...
7
votes
1answer
226 views

Why do some arguments in a macro need to be preceded by \noexpand?

I keep on studying the use of nested tikzpicture environments (sorry) and I discover the next problem. I'm not sure but it sounds like a problem with "fragile" commands. Perhaps, the problem is the ...
4
votes
1answer
402 views

pgfmath expansion - call a command from within a pgfmath environment

I am trying to define a newcommand using pgfmath. This commands calls a previously defined command but it fails. It propably has to do something with expansion. I've read this question about ...
6
votes
2answers
470 views

Forcing tikz/pgf to expand macros within commands

I would like to use simple macros within tikz commands, but it seems tikz doesn't expand them in the ways I would expect. For instance, the code ...
8
votes
1answer
683 views

Problem with environment expansion and the Tikz external library.

I've created my own environment mytikz, which basically looks like this (full MWE): \documentclass[a4paper]{article} \usepackage{tikz} \usetikzlibrary{external} \newenvironment{mytikz}{%begin code ...