Compare commits
No commits in common. "58082795483603a148179e438d65c9ebbdaa5fa8" and "cb2305496e10c7d9bfa21cb9607e139e04370545" have entirely different histories.
5808279548
...
cb2305496e
@ -25,7 +25,7 @@ endsnippet
|
|||||||
|
|
||||||
snippet fig "create new figure" bi
|
snippet fig "create new figure" bi
|
||||||
#figure(
|
#figure(
|
||||||
image("fig/`!v expand("%:r")`/$1.svg"),
|
image("fig/${0:name}.svg"),
|
||||||
caption: [$2],
|
caption: [$2],
|
||||||
) <$1>
|
) <${3:identifier}>
|
||||||
endsnippet
|
endsnippet
|
||||||
|
51
src/.local/bin/svg-typst
Executable file
51
src/.local/bin/svg-typst
Executable file
@ -0,0 +1,51 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Write Typst markup, then copy it as an SVG.
|
||||||
|
# This can be used to paste math labels in Inkscape.
|
||||||
|
|
||||||
|
# Requires
|
||||||
|
# --------
|
||||||
|
# pdf2svg
|
||||||
|
# typst
|
||||||
|
# xclip
|
||||||
|
# $EDITOR set to an editor (prefer nvim)
|
||||||
|
|
||||||
|
# create temp files
|
||||||
|
TMP_SRC="$(mktemp --suffix=.typ)"
|
||||||
|
TMP_PDF="$(mktemp --suffix=.pdf)"
|
||||||
|
TMP_SVG="$(mktemp --suffix=.svg)"
|
||||||
|
|
||||||
|
# Typst template
|
||||||
|
cat <<'EOF' > "$TMP_SRC"
|
||||||
|
#set page(
|
||||||
|
width: 10cm,
|
||||||
|
height: auto,
|
||||||
|
margin: (x: 1cm, y: 1cm)
|
||||||
|
)
|
||||||
|
|
||||||
|
#show math.equation: eq => scale(x: 150%, y: 150%, text(font: "Fira Math", size: 17pt, eq))
|
||||||
|
#show text: set text(font: "Fira Math", size: 25pt)
|
||||||
|
|
||||||
|
$ $
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# edit Typst source
|
||||||
|
if [ "$EDITOR" = "nvim" ] || [ "$EDITOR" = "vim" ]; then
|
||||||
|
# if we're using vim we can jump to the end of the template
|
||||||
|
$EDITOR -c "normal Gll" -c "startinsert" "$TMP_SRC"
|
||||||
|
else
|
||||||
|
$EDITOR "$TMP_SRC"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# compile to pdf
|
||||||
|
typst c "$TMP_SRC" "$TMP_PDF"
|
||||||
|
|
||||||
|
# convert to svg
|
||||||
|
pdf2svg "$TMP_PDF" "$TMP_SVG"
|
||||||
|
|
||||||
|
# copy (x-inkscape-svg necessary otherwise it rasterizes the image when pasting)
|
||||||
|
xclip -selection clipboard -t image/x-inkscape-svg -i "$TMP_SVG"
|
||||||
|
|
||||||
|
# clean up
|
||||||
|
rm "$TMP_SRC"
|
||||||
|
rm "$TMP_PDF"
|
||||||
|
rm "$TMP_SVG"
|
@ -3,9 +3,9 @@
|
|||||||
# Run this from Vim and it will edit a figure with the given filename in Inkscape.
|
# Run this from Vim and it will edit a figure with the given filename in Inkscape.
|
||||||
|
|
||||||
SVG_PATH="$1"
|
SVG_PATH="$1"
|
||||||
mkdir -p "$(dirname "$SVG_PATH")"
|
mkdir -p fig/
|
||||||
|
|
||||||
if [ -e "$SVG_PATH" ]; then
|
if [ -e fig/"$1" ]; then
|
||||||
# just edit it
|
# just edit it
|
||||||
inkscape "$SVG_PATH" &
|
inkscape "$SVG_PATH" &
|
||||||
else
|
else
|
||||||
@ -15,9 +15,9 @@ else
|
|||||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||||
|
|
||||||
<svg
|
<svg
|
||||||
width="100mm"
|
width="300mm"
|
||||||
height="100mm"
|
height="300mm"
|
||||||
viewBox="0 0 100 100"
|
viewBox="0 0 300 300"
|
||||||
version="1.1"
|
version="1.1"
|
||||||
id="svg5"
|
id="svg5"
|
||||||
inkscape:version="1.2.2 (b0a8486541, 2022-12-01)"
|
inkscape:version="1.2.2 (b0a8486541, 2022-12-01)"
|
||||||
|
@ -16,9 +16,7 @@ wallpaper
|
|||||||
xss-lock -- slock &
|
xss-lock -- slock &
|
||||||
dunst &
|
dunst &
|
||||||
xrdb .Xresources
|
xrdb .Xresources
|
||||||
if ! pgrep pipewire; then
|
|
||||||
gentoo-pipewire-launcher &
|
gentoo-pipewire-launcher &
|
||||||
fi
|
|
||||||
|
|
||||||
# DBus
|
# DBus
|
||||||
export NO_AT_BRIDGE=1
|
export NO_AT_BRIDGE=1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user