I have been trying to draw the Kasteleyn orientation for a 4 by 4 square lattice. I aim to draw a figure like the one (given for 6 by 4) below.
The code I have written is given below.
\documentclass{article}
\usepackage{calligra}
\usepackage[T1]{fontenc}
%\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{geometry}
\usepackage{marginnote}
\geometry{a4paper,total={170mm,257mm},left=10mm,right=15mm,top=15mm,bottom=15mm}
\usepackage{ulem}
\usepackage{simpler-wick}
\usepackage{amsmath}
\usepackage{xcolor}
\usepackage{amssymb}
\usepackage{bbold}
\usepackage{empheq}
\usepackage{lscape}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{relsize}
\usepackage{cjhebrew}
\usepackage{amsfonts}
\usepackage{esvect}
\usepackage{esint}
\usepackage{braket}
\usepackage{mathrsfs}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usepackage[compat=1.0.0]{tikz-feynman}
\usetikzlibrary{arrows,decorations.markings}
\usepackage[autostyle]{csquotes}
\usepackage{siunitx}
%----------------------------------------Frame--------------
\usepackage{framed} % or, "mdframed"
\usepackage[framed]{ntheorem}
\newframedtheorem{frm-thm}{Theorem}
%----------------------------------------------------------
\usepackage{marvosym}
%--------------------------------------------------------------
\usepackage{scalerel,amssymb}
\def\mcirc{\mathbin{\scalerel*{\circ}{j}}}
\def\msquare{\mathord{\scalerel*{\Box}{gX}}}
%--------------------------------------------------------------
\newcommand*\widefbox[1]{\fbox{\hspace{2em}#1\hspace{2em}}}
\newcommand{\be}{\begin{equation}}
\newcommand{\ee}{\end{equation}}
\newcommand{\ba}{\begin{eqnarray}}
\newcommand{\ea}{\end{eqnarray}}
\newcommand{\tr}{\mathrm{Tr}}
\newcommand{\D}{\int\mathcal{D}}
\newcommand{\bigzero}{\mbox{\normalfont\Large\bfseries 0}}
\newcommand{\mc}{\mathcal}
\newcommand{\vn}{\beta|\varepsilon_{n_{2}}|^{2/3}}
\newcommand{\vm}{\beta|\varepsilon_{m_{2}}|^{2/3}}
\newcommand{\cl}{\calligra}
\tikzstyle{ks} = [thick,
postaction={decorate},
decoration={
markings,
mark=at position 0.6 with {\arrow[thick, scale = 2, color = blue]{stealth}
}}
]
\setcounter{MaxMatrixCols}{16}
\begin{document}
\begin{center}
\begin{tikzpicture}[scale=2]
\draw [help lines] (1,1) grid (4,4);
%%%%%%%%%%%%%% coordinates %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\foreach \x in {1,2,3,4}
%\foreach \y in {1,...,4}
%{
%\draw (\x,\y) +(1,1);
%\draw (\x,\y) node{(\x,\y)};
%}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\foreach \x in {1,3}
\foreach \y in {1,3}
{
\draw[fill=black] (\x,\y) circle (.3ex) +(1,1);
};
\foreach \x in {2,4}
\foreach \y in {2,4}
{
\draw[fill=black] (\x,\y) circle (.3ex) +(1,1);
};
%%%% draw red circles
\foreach \x in {1,3}
\foreach \y in {2,4}
{
\draw[fill=red] (\x,\y) circle (.3ex) +(1,1);
};
\foreach \x in {2,4}
\foreach \y in {1,3}
{
\draw[fill=red] (\x,\y) circle (.3ex) +(1,1);
};
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%% vertical arrows %%%%%%%%%%%%%%%%%%%%%%%
\draw[ks] (1,1) -- (1,2); \draw[ks] (1,2) -- (1,3);\draw[ks] (1,3) -- (1,4);
\draw[ks] (2,1) -- (2,2); \draw[ks] (2,2) -- (2,3);\draw[ks] (2,3) -- (2,4);
\draw[ks] (3,1) -- (3,2); \draw[ks] (3,2) -- (3,3);\draw[ks] (3,3) -- (3,4);
\draw[ks] (4,1) -- (4,2); \draw[ks] (4,2) -- (4,3);\draw[ks] (4,3) -- (4,4);
%%%%%%%%%%%%%%%% horizontal arrows %%%%%%%%%%%%%%%%%%%%%%%
\draw[ks] (4,1) -- (3,1); \draw[ks] (3,1) -- (2,1);\draw[ks] (2,1) -- (1,1);
\draw[ks] (1,2) -- (2,2); \draw[ks] (2,2) -- (3,2);\draw[ks] (3,2) -- (4,2);
\draw[ks] (4,3) -- (3,3); \draw[ks] (3,3) -- (2,3);\draw[ks] (2,3) -- (1,3);
\draw[ks] (1,4) -- (2,4); \draw[ks] (2,4) -- (3,4);\draw[ks] (3,4) -- (4,4);
\end{tikzpicture}
\end{center}
\end{document}
There are a few issues with the code:
- I used the for loop to generate the coordinates of the vertices. These coordinates need to be translated to a certain amount to get one similar to the picture. How can this be done?
- The arrows are double periodic in the horizontal direction. Given I have drawn the arrows by brute force, is there any way to generate the arrows by for loop? The same question goes for the vertical arrows.
The general rule for drawing the Kasteleyn orientation for a square lattice is to draw arrows for each square such that they are clockwise odd. For larger lattices, my method of drawing arrows is very cumbersome. Is there any way we can generate it with a minimal amount codes? I hope people in our community can resolve this problem. Thanks in advance.


chainslibrary this can be very short code as well. – Qrrbrbirlbel Aug 07 '23 at 02:11