Is there a way to create something that looks like this?
I have looked at the \rotatebox
command, but that will not get the same "jagged" edges on the bottom, and looked at How to draw a diagonally-split grid with TikZ? which seems applicable (especially in conjunction with the \rotatebox
).
I was able to make this:
With code adapted from the link, but I have no idea how to customize it.
\documentclass[12pt]{article}
\usepackage[english]{babel}
\usepackage{amsfonts}
\usepackage{tikz}
\usepackage{rotating}
\usetikzlibrary{calc,decorations.shapes}
\tikzset{
decorate with/.style args={#1 separated by #2}{
fill,
decorate,decoration={shape backgrounds,shape=#1,shape size=1.5mm,
shape sep={#2, between borders}}
}
}
\pgfkeys{/tikz/.cd,
num quad/.initial=5,
num quad/.get=\numquad,
num quad/.store in=\numquad,
}
\begin{document}
\usetikzlibrary{calc,decorations.shapes}
\rotatebox{315}{\begin{tikzpicture}[x=0.5025cm,y=0.5025cm,line cap=round]
\foreach \x [count=\xi] in {1,...,\numquad}{
\foreach \y [count=\yi] in {\x,...,\numquad}{
\node [draw, minimum size=0.5cm,outer sep=0pt,inner sep=0pt] (u-\xi\yi) at (\xi,-\yi) {};
}
}
\end{tikzpicture}
}
\end{document}
Best Answer
The
diamond
shape is only there for drawing and filling, the text is actually only a label (which is actually a node too) to the diamond node.This works
bestonly with an angle of 45.One could also solve this with a custom coordinate system (x going ↗, y going ↘) instead of rotation, the squares/diamonds could have been drawn also with a rectangular path.
The size of the shape is manually set to
The co-efficient of
\pgflinewidth
is found empirical and is chosen so that the lines overdraw eachother, as agrid
would do that.Update:
The macro that is used by
remember
isn't remembered anymore after the loops. I'm usingglobal remember
for this. (The keyremember=\macro
is still needed sinceglobal remember
doesn't apply the same parsing thatremember
does.)To add j → and m → I've used my custom
/utils/exec={<cond>}{<true keys>}{<false keys>}
key to add a label to a label. (We could've used\ifnum
here, too, or we could also replace the\ifnum
s by/utils/if
s.)The
mathtools
package is loaded for\mathrlap
to easily place the →-labels.Code
Output