snippets/latexpic

31 lines
497 B
Plaintext
Raw Normal View History

2020-11-23 17:14:08 +01:00
#!/bin/bash
set -e
color=$1
input=$2
outpdf="/tmp/latexpic.pdf"
outpng="/tmp/latexpic.png"
cat <<EOF | pdflatex --output-directory /tmp --jobname latexpic --
\documentclass[12pt,varwidth]{standalone}
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage{xcolor}
\usepackage{pagecolor}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{graphicx}
\color{$1}
\begin{document}
$input
\end{document}
EOF
convert -density 600 "$outpdf" -quality 90 "$outpng"
xdg-open "$outpng"