Reproducing the Periodic Table of Arguments in Latex
You are loading the positioning library, but not using it. Once one changes the syntax, it works out fine. In more detail, e.g. above of=Sig
has to become in positioning syntax above=<distance> of Sig
. I acknowledge a comment by Fato39 urging me to do that. This is the only change I did. There are by now some more sophisticated proposals here, among which IMHO Max' matrix approach may be the most convenient, closely followed by Zarko's chains, and of course no one has as nice colors as J. Leon V. Nox had the very first answer, and it is always easier to write something better after one sees what others did.
\documentclass[a4paper]{amsart}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric}
\usetikzlibrary{calc}
\usetikzlibrary{positioning}
% -----------------------------
\begin{document}
\begin{tikzpicture}[square/.style={regular polygon,regular polygon sides=4}]
% 1 alpha FF Sig
\node at (0.2,0.2) [square, draw, anchor=south west, minimum size=2cm, fill=blue!50] (Sig) {\verb!Sig!};
\node at (1,0.5) [draw=blue!50] {\tiny{from sign}}; % text inside Sig
\node [square, draw, minimum size=2cm, align=left, fill=blue!50, above=0pt of Sig] (Cau) {\verb!Cau!};
\node [square, draw, minimum size=2cm, fill=blue!50, above=0pt of Cau] (Ef) {\verb!Ef!};
\node [square, draw, minimum size=2cm, fill=blue!50, above=0pt of Ef](Cor){\verb!Cor!};
% 1 alpha VF
\node [square, draw, minimum size=2cm, fill=green!50, right=0pt of Sig,](Cr){\verb!Cr!};
% 1 alpha VV
\node [square, draw, minimum size=2cm, fill=yellow!50, right=0pt of Cr](St){\verb!St!};
\node [square, draw, minimum size=2cm, fill=yellow!50, above=0pt of St](Ax){\verb!Ax!};
% 1 alpha PV
\node [square, draw, minimum size=2cm, fill=purple!50, right=0pt of St](Pr){\verb!Pr!};
\node [square, draw, minimum size=2cm, fill=orange!50, right=0pt of Pr](De){\verb!De!};
% Axes
\draw [dotted,thick] (-7,0) -- (7,0);
\draw [dotted,thick] (0,-7) -- (0,7);
% The grid -- comment when ready
\draw[step=.5cm,gray,very thin] (-7,-7) grid (7,7);
\end{tikzpicture}
\end{document}
Further improvements:
- Corrected the width by taking into account thr
outer sep
. (This is not really necessary.) - Used labels to place the small texts. Specifically, defined styles
label A
(above) andlabel B
(below) for that. - Simplified the other styles to avoid unnecessary repetition.
- Set the
node distance
to-\pgflinewidth
in order to have the same thickness of the border everywhere, and also to spare you from typing0pt
.
Here is the improved code.
\documentclass[a4paper]{amsart}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric}
\usetikzlibrary{calc}
\usetikzlibrary{positioning}
% -----------------------------
\begin{document}
\begin{tikzpicture}[square/.style={minimum
size=2cm-2*\pgfkeysvalueof{/pgf/outer xsep},
draw,regular polygon,regular polygon sides=4},
label B/.style={label={[anchor=north west,font=\tiny\sffamily,yshift=16pt,
xshift=3pt,scale=0.75,align=left]below left:#1}},
label A/.style={label={[anchor=north,font=\tiny\sffamily,yshift=-2pt,scale=0.75]above:#1}},
blue square/.style={square,fill=blue!50,label A=1 pre FF},
yellow square/.style={square,fill=yellow!50,label A=1 pre W},
orange square/.style={square,fill=orange!50,label A=1 pre PV},
node distance=-\pgflinewidth
]
% 1 alpha FF Sig
\coordinate (O) at (0,0);
\node [above right= of O,blue square,label B=from sign] (Sig) {\verb!Sig!};
\node [blue square,above= of Sig,label B=from cause] (Cau) {\verb!Cau!};
\node [blue square,above= of Cau,label B=from effect] (Ef) {\verb!Ef!};
\node [blue square,above= of Ef,label B=from correlation](Cor){\verb!Cor!};
% 1 alpha VF
\node [square,fill=green!50,right= of Sig,label A=1 pre VF,label B=from
criterion](Cr){\verb!Cr!};
% 1 alpha VV
\node [yellow square,right= of Cr,label B=from standard](St){\verb!St!};
\node [yellow square,above= of St,label B=axiolic\\ argument](Ax){\verb!Ax!};
% 1 alpha PV
\node [square,fill=purple!50,right= of St,label B=pragmatic\\ argument,
label A=pre PF](Pr){\verb!Pr!};
\node [orange square,right= of Pr,label B=deontic\\ argument](De){\verb!De!};
\node [orange square,above= of De,label B=from evaluation](Ev){\verb!Ev!};
% Axes
\draw [dotted,thick] (-7,0) -- (7,0);
\draw [dotted,thick] (0,-7) -- (0,7);
% The grid -- comment when ready
\draw[step=.5cm,gray,very thin] (-7,-7) grid (7,7);
\end{tikzpicture}
\end{document}
Altough you already have two very usable answers, I wanted to show an alternative that is (arguably) more readable and easier to adjust to future changes. Using Tikz matrix of nodes
, you can assign styles to certain columns, which is very convenient in such a table. I added a sub={<text>}
, and super={<text>}
key that take care of the extra text in the cells.
The code that describes the contents of the table is a lot less cluttered by positioning settings, and only is
|[sub={from correlation}]|Cor & & & & \\
|[sub={from effect}]| Ef & & & & \\
|[sub={from cause}]| Cau & & |[sub={axiologic argument}]| Ax & & |[sub={from evaluation}]| Ev \\
|[sub={from sign}]| Sig & |[sub={from criterion}]| Cr & |[sub={from standard}]| St & |[sub={pragmatic argument}]| Pr & |[sub={deontic argument}]| De \\
Which results in:
Note that you could overwrite the additional text above the cells with the super=
key, for every cell. So the default value is the one specified for the column number, but if for some reason you want a different value for a specific cell, you can simply overwrite it.
Complete MWE:
\documentclass[tikz,margin=2mm]{standalone}
\usetikzlibrary{matrix}
\begin{document}
\begin{tikzpicture}
\matrix[
matrix of nodes,
column sep=-\pgflinewidth,
row sep=-\pgflinewidth,
nodes={
minimum size=2cm,
draw,
anchor=center,
fill,
text width=1.8cm,
inner sep=1mm,
font=\ttfamily\LARGE,
align=justify,
},
sub/.style={execute at end node={\bgroup\\[-0.65\baselineskip]\tiny #1\egroup}},
super/.style={execute at begin node={\bgroup\color{black}\footnotesize #1 \\[-0.15\baselineskip]\egroup}},
column 1/.style={fill=blue!50, super={1 Pre FF}},
column 2/.style={fill=green!50, super={1 Pre VF}},
column 3/.style={fill=yellow!50,super={1 Pre VV}},
column 4/.style={fill=purple!50,super={1 Pre PF}},
column 5/.style={fill=orange!50,super={1 Pre PV}},
]{
|[sub={from correlation}]|Cor & & & & \\
|[sub={from effect}]| Ef & & & & \\
|[sub={from cause}]| Cau & & |[sub={axiologic argument}]| Ax & & |[sub={from evaluation}]| Ev \\
|[sub={from sign}]| Sig & |[sub={from criterion}]| Cr & |[sub={from standard}]| St & |[sub={pragmatic argument}]| Pr & |[sub={deontic argument}]| De \\
};
\end{tikzpicture}
\end{document}
Edit
I changed the styles slightly to incorporate the solution for the sub and sup texts by using labels. Credits to marmot and zarko (I'm not sure who was first). I have not finished all arguments, and it's quite late here so there could be some spelling errors in there. One more edit: I added a style for the delta quadrant
. I trust you will be able to finish it:
\documentclass[tikz,margin=2mm]{standalone}
\usetikzlibrary{matrix}
\tikzset{
sup/.style={label={[minimum size=0,font=\scriptsize,anchor=north west,shift={(-10mm-0.5\pgflinewidth,-1.5mm)}]#1}},
sub/.style={label={[minimum size=0,font=\tiny,anchor=north west,shift={(-10mm-0.5\pgflinewidth,-12mm)}]#1}},
co1/.style={fill=blue!50},
co2/.style={fill=green!50},
co3/.style={fill=yellow!50},
co4/.style={fill=purple!50},
co5/.style={fill=orange!50},
co6/.style={fill=red!50},
my empty cell/.style={minimum size=2cm,fill=none,draw=none},
table of arguments/.style={
matrix of nodes,
column sep=-\pgflinewidth,
row sep=-\pgflinewidth,
inner sep=1mm,
nodes={
minimum size=2cm,
draw,
anchor=center,
fill,
text width=1.8cm,
font=\ttfamily\LARGE,
align=justify,
},
},
alpha quadrant/.style={
table of arguments,
name=alpha,
matrix anchor=south west,
co1/.append style={sup={1 Pre FF}},
co2/.append style={sup={1 Pre VF}},
co3/.append style={sup={1 Pre VV}},
co4/.append style={sup={1 Pre PF}},
co5/.append style={sup={1 Pre PV}},
},
beta quadrant/.style={
table of arguments,
name=beta,
matrix anchor=south east,
co1/.append style={sup={1 Sub FF}},
co3/.append style={sup={1 Sub VV}},
co4/.append style={sup={1 Sub PF}},
co6/.append style={sup={1 Sub PP}},
},
gamma quadrant/.style={
table of arguments,
name=gamma,
matrix anchor=north east,
co2/.append style={sup={2 Sub VF}},
co3/.append style={sup={2 Sub VV}},
co4/.append style={sup={2 Sub PF}},
},
delta quadrant/.style={
table of arguments,
name=delta,
matrix anchor=north west,
co2/.append style={sup={2 pre VF}},
co3/.append style={sup={2 pre VV}},
co4/.append style={sup={2 pre PF}},
co5/.append style={sup={2 pre PV}},
co6/.append style={sup={2 pre PP}},
},
}
\begin{document}
\begin{tikzpicture}
\matrix[alpha quadrant]{
|[co1,sub={from correlation}]|Cor & & & & & \\
|[co1,sub={from effect}]| Ef & & & & & \\
|[co1,sub={from cause}]| Cau & & |[co3,sub={axiologic argument}]| Ax & & |[co5,sub={from evaluation}]| Ev & \\
|[co1,sub={from sign}]| Sig & |[co2,sub={from criterion}]| Cr & |[co3,sub={from standard}]| St & |[co4,sub={pragmatic argument}]| Pr & |[co5,sub={deontic argument}]| De & \\
};
\matrix[beta quadrant]{
& & & & & |[co1,sub={case to case}]| Cas \\
& & & |[co3,sub={a minore}]| Min & & |[co1,sub={from example}]| Exa\\
& & |[co4,sub={from parallel}]| Pa & |[co3,sub={a manore}]| Ma & & |[co1,sub={from genus}]| G \\
|[co6,sub={from comparison}]| Comp & |[my empty cell]| & |[co4,sub={from equality}]| Eq & |[co3,sub={from analogy}]| An & |[my empty cell]| & |[co1,sub={from similarity}]| Sim \\
};
\matrix[gamma quadrant]{
|[co4,sub={from consistency}]| Con & |[co3,sub={from opposites}]| O & |[co2,sub={from tradition}]| T & |[my empty cell]| \\
& |[co3,sub={from disjunctives}]| Di & & \\
& |[co3,sub={pertitio principi}]| Pe & & \\
};
\matrix[delta quadrant]{
|[my empty cell]| & |[co2,sub={from authority}]| Au & |[co3,sub={from utility}]| U & |[co4,sub={ad baculum}]| Ba & |[co5,sub={from character}]| Ch & |[co6,sub={from emotion}]| Em \\
};
\draw[dashed] (0,8) -- (0,-8)
(-12,0) -- (12,0);
\end{tikzpicture}
\end{document}
This is a little hacky solution, but it should work, if you create the table from left to right. I corrected the offset of the lines manually and created a \lastcolor
command that colors the \nodeabove
s correctly.
\documentclass[a4paper]{amsart}
\usepackage{tikz}
\usetikzlibrary{positioning}
\newcommand{\cont}[3]{%
\parbox[t][1.5cm]{1.5cm}{%
\tiny #2\\[.4cm]%
\normalsize \texttt{#1}\\[.1cm]%
\fontsize{3}{5}\selectfont #3}%
}
\newcommand{\lastcolor}{}
\newcommand{\lastbasenode}{}
\newcommand{\lastnode}{}
\newcommand{\lastsup}{}
\newcommand{\basenode}[4]{%
\renewcommand{\lastcolor}{#4}
\renewcommand{\lastbasenode}{#1}
\renewcommand{\lastnode}{#1}
\renewcommand{\lastsup}{#2}
\node (rect) at (0.2cm,0.2cm) [draw,
thick,
minimum width=2cm,
minimum height=2cm,
anchor=south west,
fill=\lastcolor,
xshift=-.4pt,
yshift=-.4pt] (#1) {\cont{#1}{#2}{#3}};
}
\newcommand{\nodeabove}[2]{%
\node (rect) [draw,
thick,
minimum width=2cm,
minimum height=2cm,
anchor=south west,
above=of \lastnode.center,
fill=\lastcolor,
yshift=-.4pt] (#1) {\cont{#1}{\lastsup}{#2}};
\renewcommand{\lastnode}{#1}
}
\newcommand{\noderight}[4]{%
\renewcommand{\lastcolor}{#4}
\renewcommand{\lastsup}{#2}
\node (rect) [draw,
thick,
minimum width=2cm,
minimum height=2cm,
anchor=south west,
right=of \lastbasenode.center,
fill=\lastcolor,
xshift=-.4pt] (#1) {\cont{#1}{\lastsup}{#3}};
\renewcommand{\lastbasenode}{#1}
\renewcommand{\lastnode}{#1}
}
% -----------------------------
\begin{document}
\begin{tikzpicture}
% 1 alpha FF Sig
\basenode {Sig}{1 pre FF}{from sign}{blue!30}
\nodeabove{Cau} {from cause}
\nodeabove{Ef} {from effect}
%
\noderight{Cr}{1 pre VF}{from criterion}{green!30}
%
\noderight{St}{1 pre VV}{from standard}{yellow!50}
\nodeabove{Ef} {axiologic\\argument}
%
\noderight{Pr}{1 pre PF}{pragmatic\\argument}{purple!20}
\draw [dotted,thick] (-7,0) -- (7,0);
\draw [dotted,thick] (0,-7) -- (0,7);
% The grid -- comment when ready
\draw[step=.5cm,gray,very thin] (-7,-7) grid (7,7);
\end{tikzpicture}
\end{document}
edit: Cleaner code.