Skip to content

figures.ahk

bloodbornebi edited this page Dec 4, 2020 · 4 revisions

Requirements

This one requires Inkscape. It also requires you to have a bit more patience with configuration. It is recommended you read the original article because it has some important information re. packages, etc.

Organization set-up

This script requires you to have a very specific organization set-up for your notes. Because of issues with how AHK pulls a directory, I wasn't able to get it to look at the directory of the file you're writing. So it expects a file structure like this:

..\notes\
|--- figures\
|    |--- template.svg
|--- math.tex
|--- math2.tex

Which is definitely awkward. (On the other hand, this does let you reuse figures, etc., so maybe it's not terrible?)

Configuration

You'll need to check all of the directories to make sure they're correct, since they're mostly hard-coded in. Additionally, this one requires the same code that Castel has in his preamble.

Set-up

Load into AHK, change requisite files and run script. (If you're unsure of exactly how to do that, I wrote more detailed instructions here. You'll also need to find the directories (mine all start with C:, and yours probably do too) and replace them with your personal directories.

Differences/Usage

This is run with two separate hotkeys: first, alt p starts the figure process, then once you're done with the figure in Inkscape, alt s saves it, then recompiles your latex document. So your workflow should look like this:

  1. alt p
  2. type your file name (you won't see it, but it will be recorded).
  3. tab
  4. wait for inkscape to load
  5. make figure
  6. alt s
  7. back to writing

The alt s command is always active in Inkscape, so if you (for some reason) are using alt s to mean something else sometimes, make sure you end this script when you're not writing.

Issues

If you're getting issues, first, make sure the directories are right. Writing this, that was what gave me the biggest trouble.

After that, the saving code for Inkscape is the buggiest part. If it's really giving you trouble in the moment, just manually save - you don't break anything by not hitting alt s, since it's two different hotkeys.

Clone this wiki locally