Skip to content

Instantly share code, notes, and snippets.

@stared
Created April 22, 2014 16:12
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save stared/11185110 to your computer and use it in GitHub Desktop.
Save stared/11185110 to your computer and use it in GitHub Desktop.
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