Create a gist now

Instantly share code, notes, and snippets.

Embed
TikZ code drawing Matrix Product State in tensor diagram notation (i.e. Penrose graphical notation). Get pdf, ps or svg.
\documentclass{standalone}
%% for compilation with htlatex (to produce svg image),
%% uncomment the line below:
% \def\pgfsysdriver{pgfsys-tex4ht.def}
\usepackage{tikz}
\tikzstyle{tensor}=[rectangle,draw=blue!50,fill=blue!20,thick]
\begin{document}
\begin{tikzpicture}[inner sep=1mm]
\foreach \i in {1,...,5} {
\node[tensor] (\i) at (\i, 0) {$A_\i$};
\node (\i spin) at (\i, -0.7) {$s_\i$};
\draw[-] (\i) -- (\i spin);
};
\foreach \i in {1,...,4} {
\pgfmathtruncatemacro{\iplusone}{\i + 1};
\draw[-] (\i) -- (\iplusone);
};
\draw[-] (1.west) .. controls +(-1.5, 1) and +(1.5, 1) .. (5.east);
\end{tikzpicture}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment