# Drawing a Hodge diamond using Tikz

I've been stuck trying to draw a Hodge diamond using Tikz (they appear in the context of Kähler gometry). I've already got the following

However, I'd like to get something like this (namely, I want to add these nice Serre, Hodge and conjugation labels along with their arrows). Moreover, I'd like to add a vertical column of Betti numbers representing the sum of the diamond's rows.

EDIT. I got it, however I ran into another problem. I'm using MathTimePro 2 fonts, so this doesn't look exactly as intended using these fonts because of their own arrows and sizes. So, I'm only asking for a solution that looks like the following BUT using tikzcd for the arrows and labels (and not things such as \longleftrightarrow). Here is the result, it looks perfectly fine using computer modern/AMS, so I'll left its code below, but is not as nice with MathTime, that's why I need to do the arrows with Tikz-cd so they end behaving the same despite the main font...

\documentclass{article}
\usepackage{amsmath, amssymb, amsfonts, graphicx, pgfplots, tikz, tikz-cd, stmaryrd}
\begin{document}

$\begin{tikzcd}[row sep=small, column sep=tiny] & &&&&h^{0,0}&&&& && b_0 \\ & &&&h^{1,0}&&h^{0,1}&&&&& b_1 \\ & &&h^{2,0}&&h^{1, 1}&&h^{0,2}&&&& b_2 \\ & &\reflectbox{\ddots} &&&\vdots &&&\ddots&&& \vdots \\ \mathrm{Hodge}\enspace\rotatebox[origin=c]{90}{\longleftrightarrow} & h^{n,0}& &\cdots && \underset{\textstyle\mathrm{Serre}}{ \scalebox{1.5}{ \curvearrowleft } } &&\cdots&&h^{0, n}&& b_n\\ & &\ddots &&&\vdots &&&\reflectbox{\ddots}&&& \vdots \\ & &&h^{n, n-2}&&h^{n-1,n-1}&&h^{n-2,n}&& && b_{2n-2}\\ & &&&h^{n,n-1}&&h^{n-1,n}&& &&& b_{2n-1}\\ & &&&&h^{n,n}&&&&&& b_{2n} \\ & &&&& \underset{\textstyle\mathrm{conjugation}}{\longleftrightarrow} &&&&&&\\ \end{tikzcd}$

\end{document}

• with same background colors? Aug 24, 2021 at 10:03
• @BlackMild without background colors at all, they just made its way into there hehe. Aug 24, 2021 at 14:53

## 1 Answer

Probably not helpful in the general case, but manually positioning the nodes makes things quite easy. It is possible to cheat a bit by defining a constant (i.e., a function of zero arity) to aid position/lab of elements.

\documentclass[tikz,border=10pt]{standalone}
\usepackage{amsmath,amssymb}
\pgfmathdeclarefunction{n}{0}{\def\pgfmathresult{4}}
\def\rdots{\reflectbox{$\ddots$}}
\begin{document}
\begin{tikzpicture}
\begin{scope}[x={(-1.25cm,-.75cm)},y={(1.25cm,-.75cm)}]
\foreach \i/\j/\k in {
0/0, 0/1, 0/2, 0/n, 1/0, 2/0, n/0, n/n-2,
n/n-1, n/n, n-2/n, n-1/n, 1/1, n-1/n-1,
0/3/\ddots, n/1/\ddots, 3/0/\rdots, 1/n/\rdots,
3/1/\dots, 1/3/\dots,
1.5/1.5/\vdots, 2.5/2.5/\vdots}
\node at (\i, \j) {\ifx\j\k$h^{\i,\j}$\else$\k$\fi };
\node [label=below:Serre]       at (2, 2)           {$\curvearrowleft$};
\node [label=below:conjugation] at (n + .5, n + .5) {$\leftrightarrow$};
\node [label=right:Hodge]       at (-.5, n + .5)    {$\updownarrow$};
\end{scope}
\foreach \i/\j in {0/b_0, 1/b_1, 2/b_2,
3/\vdots, 4/b_n, 5/\vdots,
6/b_{2n-2}, 7/b_{2n-1}, 8/b_{2n}}
\node[y=0.75cm] at (9, -\i) {$\j$};
\end{tikzpicture}
\end{document}


• nice code! I like this way of writing code: \path (2,2) node{$\curvearrowleft$} node[below]{Serre}; Aug 26, 2021 at 0:58