Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
ch-tikz
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Christoffer Holm
ch-tikz
Commits
0fcbea36
Commit
0fcbea36
authored
2 months ago
by
Christoffer Holm
Browse files
Options
Downloads
Patches
Plain Diff
Added the ability to consume options for each element in drawlist and drawarray
parent
240c88c2
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ch-tikz.tex
+22
-13
22 additions, 13 deletions
ch-tikz.tex
with
22 additions
and
13 deletions
ch-tikz.tex
+
22
−
13
View file @
0fcbea36
...
...
@@ -660,7 +660,7 @@
%% overwrite it for the first node.
\edef\array
@SaveOppositeDirection
{
\array
@OppositeDirection
}
\edef\array
@OppositeDirection
{
\array
@Anchor
}
\drawarray
@Element[array origin]
{
#3
}
%
\drawarray
@Element[array origin]
{
#3
}
{}
%
%% Restore the correct opposite direction.
\edef\array
@OppositeDirection
{
\array
@SaveOppositeDirection
}
\pgfmathtruncatemacro
{
\array
@Index
}{
\array
@Index + 1
}
%
...
...
@@ -785,7 +785,7 @@
down/.initial = north,
}
\newcommand
{
\drawarray
@Element
}
[
2
][
\ExpandWithSpaceBetween
{
\array
@Name
}{
\array
@PrevIndex
}
.
\array
@Direction]
{
%
\newcommand
{
\drawarray
@Element
}
[
3
][
\ExpandWithSpaceBetween
{
\array
@Name
}{
\array
@PrevIndex
}
.
\array
@Direction]
{
%
%% Save the nodes in a list so that we can pass to fit later
\xdef\array
@Nodes
{
\array
@Nodes(
\ExpandWithSpaceBetween
{
\array
@Name
}{
\array
@Index
}
)
}
%
\pgfmathtruncatemacro
{
\array
@PrevIndex
}{
\array
@Index - 1
}
%
...
...
@@ -795,7 +795,7 @@
yshift=
{
\array
@ShiftY
\pgflinewidth
}
,
%
fill=
\array
@Fill,
%
rectangle, draw=black, anchor=
\array
@OppositeDirection,
%
array element]
%
array element
, #3
]
%
(
\ExpandWithSpaceBetween
{
\array
@Name
}{
\array
@Index
}
)
%
at (#1)
{
#2
}
;
%
\ifx\array
@ShowIndex
\undefined
%
...
...
@@ -815,18 +815,23 @@
\@
ifnextchar
\bgroup
{
%
\drawarray
@GobbleArg
%
}{
%
\@
ifnextchar[
{
%
\drawarray
@GobbleArg
%
}{
%
\node
[inner sep=0, outer sep=0,
%
array container, fit=
\array
@Nodes] (
\array
@Name)
{}
;
%
array container, fit=
\array
@Nodes] (
\array
@Name)
{}
;
%
}
%
}
%
}
%
%% Draw the next array element and then recurse via
%% \drawarray@NextArg
\newcommand
{
\drawarray
@GobbleArg
}
[
1
]
{
%
\drawarray
@Element
{
#1
}
%
\newcommand
{
\drawarray
@GobbleArg
}
[
2][
]
{
%
\drawarray
@Element
{
#
2
}{
#
1
}
%
\pgfmathtruncatemacro
{
\array
@Index
}{
\array
@Index + 1
}
%
\drawarray
@NextArg
}
\makeatother
%%%% draw list %%%%
...
...
@@ -913,7 +918,7 @@
% Once the initial position is set, undef it so that it is
% not defined for the next \drawlist
\undef\list
@Position
\drawlist
@Element[list origin]
{
#3
}
%
\drawlist
@Element[list origin]
{
#3
}
{}
%
\pgfmathtruncatemacro
{
\list
@Index
}{
\list
@Index + 1
}
%
%% Goto next argument
...
...
@@ -1013,7 +1018,7 @@
down/.initial = north
}
\newcommand
{
\drawlist
@Element
}
[
2
][
$
(
\ExpandWithSpaceBetween
{
\list
@Name
}{
\list
@PrevIndex
}
.east
)
+
(
\list
@Offset,
0
)
$
]
{
%
\newcommand
{
\drawlist
@Element
}
[
3
][
$
(
\ExpandWithSpaceBetween
{
\list
@Name
}{
\list
@PrevIndex
}
.east
)
+
(
\list
@Offset,
0
)
$
]
{
%
%% Save the nodes in a list so that we can pass to fit later
\xdef\list
@Nodes
{
\list
@Nodes(
\ExpandWithSpaceBetween
{
\list
@Name
}{
\list
@Index
}
)
}
%
\edef\list
@CurrentValue
{
\ExpandWithSpaceBetween
{
\ExpandWithSpaceBetween
{
\list
@Name
}{
value
}}{
\list
@Index
}}
...
...
@@ -1023,7 +1028,7 @@
minimum height=
\list
@ElementSize,
%
fill=
\list
@Fill,
%
rectangle, draw=black, anchor=west,
%
list element]
%
list element
, #3
]
%
(
\list
@CurrentValue)
%
at (#1)
{
#2
}
;
%
\node
[minimum width=
\list
@ElementSize,
%
...
...
@@ -1031,7 +1036,7 @@
xshift=-
\pgflinewidth
,
%
fill=
\list
@Fill,
%
rectangle, draw=black, anchor=west,
%
list element]
%
list element
, #3
]
%
(
\list
@CurrentNext)
%
at (
\list
@CurrentValue.east)
{}
;
%
\node
[inner sep=0, outer sep=0, fit=(\list@CurrentValue)(\list@CurrentNext)]
%
...
...
@@ -1053,13 +1058,17 @@
\@
ifnextchar
\bgroup
{
%
\drawlist
@GobbleArg
%
}{
%
\node
[inner sep=0, outer sep=0,
%
\@
ifnextchar[
{
%
\drawlist
@GobbleArg
%
}{
%
\node
[inner sep=0, outer sep=0,
%
list container, fit=
\list
@Nodes] (
\list
@Name)
{}
;
%
}
%
}
%
}
%
\newcommand
{
\drawlist
@GobbleArg
}
[
1
]
{
%
\drawlist
@Element
{
#1
}
%
\newcommand
{
\drawlist
@GobbleArg
}
[
2][
]
{
%
\drawlist
@Element
{
#
2
}{
#
1
}
%
\draw
[->]
(
\ExpandWithSpaceBetween
{
\ExpandWithSpaceBetween
{
\list
@Name
}{
next
}}{
\list
@PrevIndex
}
.center) -- (
\ExpandWithSpaceBetween
{
\list
@Name
}{
\list
@Index
}
);
\pgfmathtruncatemacro
{
\list
@Index
}{
\list
@Index + 1
}
%
\drawlist
@NextArg
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment