tikz.dev / TikZpingus Manual

The TikZpingus package

Internals

C.8 The Feet

C.8.1 Important Commands

\basicfeetbend

This macro holds a hardcoded value to be used as the angle of rotation of the feet. Its default value is 45. The left foot uses the negative value. It may be removed in the future (or replaced by an option).

The only reason for the command being user accessible is, that it was the primary way to modify the penguin in a previous version of the package.

\pingu@foot@single@w

This dimension holds a hardcoded value to be used as the base foot width. Its default value is 2.98741pt. It may be removed in the future (or replaced by an option).

\pingu@foot@single@h

This dimension holds a hardcoded value to be used as the base foot height. Its default value is 5.69054pt. It may be removed in the future (or replaced by an option).

C.8.2 The Code

Similarly to the eyes, the feet of the penguin are controlled by two selections for the left, and the right foot. There are no extra coordinates necessary, therefore \pingu@create@selection receives no argument for the none-version:

This defines the six commands: \pingu@leftfoot@select, \pingu@leftfoot@add, \@pingu@drawer@leftfoot@, \pingu@rightfoot@select, \pingu@rightfoot@add, and \@pingu@drawer@rightfoot@.

Within the initialization of all penguin options, we use these commands. Furthermore, /pingu/feet acts as a comfort option which operates on both selectors:

left foot color/.code = \pingu@color{foot@left}{#1},
left foot/.code = \pingu@leftfoot@select{#1},
right foot color/.code = \pingu@color{foot@right}{#1},
right foot/.code = \pingu@rightfoot@select{#1},
feet/.style = {
/pingu/left foot={#1},
/pingu/right foot={#1}
},
feet color/.style = {
/pingu/left foot color={#1},
/pingu/right foot color={#1}
},
feet front/.is if = @pingu@feet@front,

The conditional \if@pingu@feet@front is defined above and defaults to false:

\newif\if@pingu@feet@front
\newif\if@pingu@bill@above

Each foot has one color to work with: \pingu@color@foot@left for the left and \pingu@color@foot@right for the right foot.

C.8.3 Adding new Feet

Now on how to add new feet. While it is possible to use \pingu@leftfoot@add and \pingu@rightfoot@add, setting up the corresponding “foot” and “feet” comfort-methods is rather tedious. For this, i created the command \pingu@feet@s…

\pingu@feet@s{⟨name⟩}{⟨left-foot⟩}{⟨right-foot⟩}[default color=pingu@yellow]

Allows easily adding new feet.

The macro \pingu@feet@s is defined with the help of \pingu@feet@s@ like this:

\long\def\pingu@feet@s#1#2#3{%
\@ifnextchar[%
{\pingu@feet@s@{#1}{#2}{#3}}%
{\pingu@feet@s@{#1}{#2}{#3}[pingu@yellow]}%
}
\long\def\pingu@feet@s@#1#2#3[#4]{%
\pgfqkeys{/pingu}{%
left foot #1/.style = {/pingu/left foot={#1}, /pingu/left foot color={##1}},%
left foot #1/.default = {#4},%
right foot #1/.style = {/pingu/right foot={#1}, /pingu/right foot color={##1}},%
right foot #1/.default = {#4},%
feet #1/.style = {/pingu/feet={#1}, /pingu/feet color={##1}},%
feet #1/.default = {#4}%
}%
\pingu@leftfoot@add{#1}{#2}\pingu@rightfoot@add{#1}{#3}%
}

As an example, this is the definition of the “normal feet” (/pingu/feet normal) in the code:

\pingu@feet@s{normal}{%
\coordinate (@tmp) at ([xshift=-.5\pingu@foot@single@h]\pingu@name-foot-left);
\pingu@block[rotate around={-25+\basicfeetbend:(@tmp)}]{\pingu@color@foot@left}
(@tmp) ellipse [
x radius=\pingu@foot@single@w,
y radius=\pingu@foot@single@h
];
\pingu@block[rotate around={\basicfeetbend:(\pingu@name-foot-left)}]
{\pingu@color@foot@left} (\pingu@name-foot-left) ellipse [
x radius=\pingu@foot@single@w,
y radius=\pingu@foot@single@h
];

\coordinate (@tmp) at ([xshift= .5\pingu@foot@single@h]\pingu@name-foot-left);
\pingu@block[rotate around={25+\basicfeetbend:(@tmp)}]{\pingu@color@foot@left}
(@tmp) ellipse [
x radius=\pingu@foot@single@w,
y radius=\pingu@foot@single@h
];
}{%
\coordinate (@tmp) at ([xshift=-.5\pingu@foot@single@h]\pingu@name-foot-right);
\pingu@block[rotate around={-25-\basicfeetbend:(@tmp)}]{\pingu@color@foot@right}
(@tmp) ellipse [
x radius=\pingu@foot@single@w,
y radius=\pingu@foot@single@h
];
\pingu@block[rotate around={-\basicfeetbend:(\pingu@name-foot-right)}]
{\pingu@color@foot@right} (\pingu@name-foot-right) ellipse [
x radius=\pingu@foot@single@w,
y radius=\pingu@foot@single@h
];
\coordinate (@tmp) at ([xshift= .5\pingu@foot@single@h]\pingu@name-foot-right);
\pingu@block[rotate around={25-\basicfeetbend:(@tmp)}]{\pingu@color@foot@right}
(@tmp) ellipse [
x radius=\pingu@foot@single@w,
y radius=\pingu@foot@single@h
];
}

As another example, this is the definition of the “simple feet” (/pingu/feet simple):

\pingu@feet@s{simple}{%
\pingu@block[rotate around={-\basicfeetbend:(\pingu@name-foot-left)}]
{\pingu@color@foot@left} (\pingu@name-foot-left) ellipse [
x radius=2.66\pingu@foot@single@w,
y radius=\pingu@foot@single@h
];
}{%
\pingu@block[rotate around={\basicfeetbend:(\pingu@name-foot-right)}]
{\pingu@color@foot@right} (\pingu@name-foot-right) ellipse [
x radius=2.66\pingu@foot@single@w,
y radius=\pingu@foot@single@h
];
}