more functionality to tikz - position + style

This commit is contained in:
EvilMuffinHa 2022-06-23 20:21:38 -04:00
parent a48ba5f467
commit 7e5f5526bc
4 changed files with 21 additions and 3 deletions

View File

@ -104,4 +104,9 @@ The `katex()` shortcode can be used to render katex without autorender. This can
The `image()` shortcode can be used to embed images in markdown as follows:
`{{ image(src="/ferris.png", alt="Alternate text", position="left", style="width: 20%; height: 20%;") }}`
Position can be either `left`, `center`, or `right`. Style allows you to embed css for the image.
Position can be either `left`, `center`, or `right`. Style allows you to embed css for the image.
The `tikz()` shortcode can be used to embed tikzpicture code in latex. For example:
`{{ tikz(style="width: 20%; height: 20%;" position="center" body="\begin{tikzpicture}\draw (0,0) circle (1in);\end{tikzpicture}") }}`
Position works the same way as `image`. Style allows you to embed css for the `div` holding the tikz svg.

View File

@ -79,4 +79,4 @@ Images:
Tikz:
{{ tikz(body="\begin{tikzpicture}\draw (0,0) circle (1in);\end{tikzpicture}") }}
{{ tikz(style="width: 20%; height: 20%;" position="center" body="\begin{tikzpicture}\draw (0,0) circle (1in);\end{tikzpicture}") }}

View File

@ -260,6 +260,19 @@
margin-left: auto;
}
.post_contents .tikz-left {
margin-right: auto;
}
.post_contents .tikz-center {
margin-left: auto;
margin-right: auto;
}
.post_contents .tikz-right {
margin-left: auto;
}
.post_contents blockquote {
{%- if config.extra.base09 %}
border-left: 3px solid {{ config.extra.base09 }};

View File

@ -1 +1 @@
<script type="text/tikz">{{body | safe}}</script>
<div class="tikz-{% if position %}{{ position }}{% else -%}center{%- endif %}" {%- if style %} style="{{ style | safe }}" {%- endif %}><script type="text/tikz">{{body | safe}}</script></div>