Hi! This is a pair of scripts to easily embed LaTeX figures in Markdown documents.
Before using them, please
- modify
TEX_DIRto be the folder where you want to keep the LaTeX stuff (./attachments/diagramswill be fine if you're using Obsidian); - modify
PREAMBLEandPOSTAMBLEthe LaTeX code to sandwitch the code of your figures before compilation; - carefully read the scripts, as you're running Bash given to you by a stranger.
Then, you can use them like this:
# Extract figures from all your source files and update them
for file in **/*.md; do
# This is overwriting the old files!
cat file | ./diag-pluck.sh > diag-temp.md
mv diag-temp.md file
done
# Check into your TEX_DIR
cd "./attachments/diagrams"
# Compile everything
latexmkFrom time to time, you'll want to unclog your TEX_DIR by running something like
./diag-flush.sh **/*.mdEnjoy!