mirror of
https://github.com/Pantonius/pantosite-astro.git
synced 2026-04-26 09:24:38 +00:00
Added blog post, updated projects
This commit is contained in:
69
src/content/blog/tikz-svg.mdx
Normal file
69
src/content/blog/tikz-svg.mdx
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
---
|
||||||
|
title: TikZ
|
||||||
|
pubDate: 2025-02-06T19:00:00Z
|
||||||
|
description: Converting TikZ graphics into svg graphics.
|
||||||
|
---
|
||||||
|
At some point a man has to realize that they went down a rabbit-hole without any way to escape it. TikZ is one such rabbit-hole and, yes, I am that man.
|
||||||
|
|
||||||
|
In broad terms [TikZ](https://tikz.dev/) is a programming language within [LaTeX](https://www.latex-project.org/), to generate graphics from code.
|
||||||
|
|
||||||
|
# Standalone TikZ
|
||||||
|
The [standalone package](https://ctan.org/pkg/standalone) for LaTeX is inteded as a way to put graphics such as those generated by TikZ into a standalone document to be included in other documents. We are going to use it to generate a pdf with the TikZ graphic.
|
||||||
|
```latex
|
||||||
|
% graphic.tex
|
||||||
|
\documentclass[border=0pt, tikz]{standalone}
|
||||||
|
|
||||||
|
\begin{document}
|
||||||
|
\begin{tikzpicture}
|
||||||
|
|
||||||
|
\end{tikzpicture}
|
||||||
|
\end{document}
|
||||||
|
```
|
||||||
|
|
||||||
|
To compile we simply run:
|
||||||
|
```shell
|
||||||
|
pdflatex graphic.tex
|
||||||
|
```
|
||||||
|
|
||||||
|
# Convert to SVG
|
||||||
|
To convert this pdf into a svg file we are going to use the [pdf2svg](https://cityinthesky.co.uk/opensource/pdf2svg/) command-line converter:
|
||||||
|
```shell
|
||||||
|
pdf2svg graphic.tex
|
||||||
|
```
|
||||||
|
Et voilà! We produced an svg file from TikZ Source Code.
|
||||||
|
|
||||||
|
# Quick and Easy
|
||||||
|
Consider the following script for quick compilation:
|
||||||
|
```bash
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# check for input file
|
||||||
|
input="$1"
|
||||||
|
|
||||||
|
if [ -z "$input" ]; then
|
||||||
|
echo "Usage: $0 <input>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -f "$1.tex" ]; then
|
||||||
|
echo "File not found: $1.tex"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# compile
|
||||||
|
echo "Compiling $1.tex..."
|
||||||
|
pdflatex -interaction=batchmode "$1.tex" > /dev/null
|
||||||
|
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "Error: pdflatex failed!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Converting to $1.svg..."
|
||||||
|
pdf2svg "$1.pdf" "$1.svg"
|
||||||
|
|
||||||
|
echo "Done!"
|
||||||
|
|
||||||
|
# cleanup
|
||||||
|
rm "$1.aux" "$1.log"
|
||||||
|
```
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: Engagement Wegweiser
|
title: Engagement Wegweiser
|
||||||
pubDate: 2024-12-26T22:00:00Z
|
pubDate: 2024-12-26T22:00:00Z
|
||||||
description: Engagement Wegweiser
|
description: Engagement Wegweiser is a tool developed by me for the Student Representation of the University of Konstanz to help students find committees and university groups that best suit their particular interests.
|
||||||
heroImage: /images/posts/engagement-wegweiser/homepage.png
|
heroImage: /images/posts/engagement-wegweiser/homepage.png
|
||||||
---
|
---
|
||||||
The [Engagement Wegweiser](https://engagement.stuve-uni-kn.de) was originally a tool for students to find committees and university groups that best suit their particular interests. Since then it has become a centrepiece of the Student Representation's campaign to encourage more involvement from the student body at the University of Konstanz.
|
The [Engagement Wegweiser](https://engagement.stuve-uni-kn.de) was originally a tool for students to find committees and university groups that best suit their particular interests. Since then it has become a centrepiece of the Student Representation's campaign to encourage more involvement from the student body at the University of Konstanz.
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: Frag Wahltraut
|
title: Frag Wahltraut
|
||||||
pubDate: 2024-12-26T22:00:00Z
|
pubDate: 2024-12-26T22:00:00Z
|
||||||
description: Frag Wahltraut
|
description: Frag Wahltraut is a tool developed by me for the Student Representation of the University of Konstanz to help students find out which party best represents their own political views in the upcoming university elections.
|
||||||
heroImage: /images/posts/frag-wahltraut/homepage.png
|
heroImage: /images/posts/frag-wahltraut/homepage.png
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user