{"id":2741,"date":"2014-08-21T18:47:30","date_gmt":"2014-08-21T17:47:30","guid":{"rendered":"http:\/\/www.ojdo.de\/wp\/?p=2741"},"modified":"2014-08-21T18:47:30","modified_gmt":"2014-08-21T17:47:30","slug":"how-to-use-tikz-for-inline-polygons","status":"publish","type":"post","link":"https:\/\/www.ojdo.de\/wp\/2014\/08\/how-to-use-tikz-for-inline-polygons\/","title":{"rendered":"How to use TikZ for inline polygons"},"content":{"rendered":"<p>The trick is to define <code>inner sep=0pt<\/code> when beginning the tikzpicture environment, as I learned from pgf bug report <a href=\"http:\/\/sourceforge.net\/p\/pgf\/bugs\/172\/\">#172 minimum size in regular polygon fails for small length<\/a> from last year. Here is a minimum working example, adapted to my use case of inline polygon symbols with roughly text height, i.e. <code>2ex<\/code> in my case:<\/p>\n<pre class=\"brush: latex; title: ; notranslate\" title=\"\">\r\n\\documentclass{article}\r\n\\usepackage{tikz}\r\n\\usetikzlibrary{shapes}\r\n\r\n\\newcommand{\\poly}&#x5B;2]{\\tikz&#x5B;inner sep=0pt] {%\r\n\\node&#x5B;regular polygon,%\r\nregular polygon sides=#1,%\r\nregular polygon rotate=#2,%\r\nminimum size=2ex, fill] (0,0) {};}}\r\n\r\n\\begin{document}\r\nTriangle upwards \\poly{3}{0}, \r\ntriangle downward \\poly{3}{180} \r\nand diamond \\poly{4}{45}.\r\n\\end{document}\r\n<\/pre>\n<p>This snippet yields the following result:<\/p>\n<p><a href=\"https:\/\/www.ojdo.de\/wp\/wp-content\/uploads\/2014\/08\/tikz-poly.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.ojdo.de\/wp\/wp-content\/uploads\/2014\/08\/tikz-poly-500x31.png\" alt=\"tikz-poly\" width=\"474\" height=\"29\" class=\"aligncenter size-large wp-image-2744\" srcset=\"https:\/\/www.ojdo.de\/wp\/wp-content\/uploads\/2014\/08\/tikz-poly-500x31.png 500w, https:\/\/www.ojdo.de\/wp\/wp-content\/uploads\/2014\/08\/tikz-poly-300x18.png 300w, https:\/\/www.ojdo.de\/wp\/wp-content\/uploads\/2014\/08\/tikz-poly.png 707w\" sizes=\"auto, (max-width: 474px) 100vw, 474px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The trick is to define inner sep=0pt when beginning the tikzpicture environment, as I learned from pgf bug report #172 minimum size in regular polygon fails for small length from last year. Here is a minimum working example, adapted to my use case of inline polygon symbols with roughly text height, i.e. 2ex in my [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":2744,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11,92],"tags":[],"class_list":["post-2741","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-how-tos","category-latex"],"_links":{"self":[{"href":"https:\/\/www.ojdo.de\/wp\/wp-json\/wp\/v2\/posts\/2741","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ojdo.de\/wp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ojdo.de\/wp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ojdo.de\/wp\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ojdo.de\/wp\/wp-json\/wp\/v2\/comments?post=2741"}],"version-history":[{"count":6,"href":"https:\/\/www.ojdo.de\/wp\/wp-json\/wp\/v2\/posts\/2741\/revisions"}],"predecessor-version":[{"id":2748,"href":"https:\/\/www.ojdo.de\/wp\/wp-json\/wp\/v2\/posts\/2741\/revisions\/2748"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ojdo.de\/wp\/wp-json\/wp\/v2\/media\/2744"}],"wp:attachment":[{"href":"https:\/\/www.ojdo.de\/wp\/wp-json\/wp\/v2\/media?parent=2741"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ojdo.de\/wp\/wp-json\/wp\/v2\/categories?post=2741"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ojdo.de\/wp\/wp-json\/wp\/v2\/tags?post=2741"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}