-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlatex-pic
executable file
·66 lines (57 loc) · 1.84 KB
/
latex-pic
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/env bash
# deps: bspwm or sway, texlive, alacritty, neovim, pdflatex, catdvi, xclip or wl-clipboard
case "$1" in
discord)
foreground=DCDDDE
background=36393F
;;
light)
foreground=000000
background=FFFFFF
;;
*|dark)
foreground=1E2127
backgroud=DFDFDF
;;
esac
echo $background
cd /tmp
rm /tmp/latex-pic*
bspc rule -a Alacritty --one-shot state=floating
echo "\(\displaystyle{}
\)" > /tmp/latex-copy.tex
# emacsclient -c -a 'emacs' /tmp/latex-copy.tex
alacritty -e "zsh" -c "nvim /tmp/latex-copy.tex"
echo "\documentclass[border=0.2cm]{standalone}
\usepackage{amsmath, amsthm, amssymb, graphicx, multicol, array, xcolor, pagecolor, mathtools}
\definecolor{background}{HTML}{${background}}
\definecolor{foreground}{HTML}{${foreground}}
\newcommand{\br}[1]{\left(#1\right)}
\newcommand{\sbr}[1]{\left[#1\right]}
\newcommand{\cbr}[1]{\left\{#1\right\}}
\newcommand{\norm}[1]{\left\|#1\right\|}
\newcommand{\abs}[1]{\left|#1\right|}
\newcommand{\ceil}[1]{\left\lceil#1\right\rceil}
\newcommand{\floor}[1]{\left\lfloor#1\right\rfloor}
\newcommand{\st}{\text{ s.t. }}
\newcommand{\tand}{\text{ and }}
\newcommand{\tor}{\text{ or }}
\newcommand{\R}{\mathbb{R}}
\newcommand{\Z}{\mathbb{Z}}
\newcommand{\N}{\mathbb{N}}
\newcommand{\Q}{\mathbb{Q}}
\newcommand{\C}{\mathbb{C}}
\newcommand{\DS}{\displaystyle}
\newcommand{\bigo}{\mathcal{O}}
\renewcommand{\qedsymbol}{(\blacksquare)}
\pagestyle{empty}
\title{TITLE}
\author{Hisbaan Noorani}
\date{DATE}
\begin{document}
\color{foreground}
$(cat /tmp/latex-copy.tex)
\end{document}" > /tmp/latex-pic.tex
pdflatex -shell-escape -interaction nonstopmode /tmp/latex-pic.tex
[ -f /tmp/latex-pic.pdf ] && convert -density 3000 /tmp/latex-pic.pdf /tmp/latex-pic.png
[ -f /tmp/latex-pic.png ] && xclip -selection clipboard -t image/png -i /tmp/latex-pic.png