Created
October 28, 2015 06:24
-
-
Save wchargin/364f9abeeb70cf831466 to your computer and use it in GitHub Desktop.
paths and polygons on a lattice (or in general, I guess)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\documentclass{article} | |
\usepackage{wcsetup} % github:wchargin/wclatex | |
\usepackage{tikz} | |
\begin{document} | |
\tikzset{ | |
latticept/.style={ | |
red, | |
}, | |
latticepath/.style={ | |
blue, | |
}, | |
} | |
% usage: \latticepath{(x0, y0){(x1, y1), (x2, y2), ...} | |
% (the points can actually be any TikZ coordinates) | |
\newcommand\latticepath[2]{% | |
\draw[latticepath] #1 \foreach \point in {#2} {-- \point }; | |
\foreach \point in {#1, #2} \filldraw[latticept] \point circle[radius=2pt]; | |
} | |
% like \latticepath, but will automatically close the path | |
\newcommand\latticegon[2]{\latticepath{#1}{#2, #1}} | |
\begin{tikzpicture} | |
\latticepath{(-1, 0)}{(0, 3), (1, 0), (-1.5, 2), (1.5, 2), (-1, 0)} | |
% | |
% works with all your usual commands... | |
\begin{scope}[ | |
opacity=0.8, transparency group, | |
xshift=5cm, | |
latticept/.style={orange,fill=white}, | |
latticepath/.append style={thick,dotted}, | |
] | |
\latticegon{(-1, 0)}{(0, 3), (1, 0), (-1.5, 2), (1.5, 2)} | |
\end{scope} | |
\end{tikzpicture} | |
\end{document} |
Author
wchargin
commented
Oct 28, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment