README.md (4282B)
1 # Flashcard Tools 2 3 ## Tools for working with LaTeX flashcards 4 5 ### Directory structure 6 7 * `defs.tex` - Contains all `\usepackage` statements and commands needed for the 8 LaTeX in the flashcards. This should *not* include `\documentclass` since that 9 is added automatically by the rendering scripts (it is different for different 10 scripts, so it can't be included in `defs.tex`). 11 * `flashcards/` - Contains the actual flashcard files. 12 13 ### Flashcard structure: 14 15 * Line 1 - Contains a "theorem number" or something similar. This is what the 16 file is named after when using `addcard.pl`. 17 If this line contains '|' anywhere, the text after it is taken to be the 18 name of another flashcard that must be displayed before this one when it 19 is displayed using a viewer that supports this notation (useful for 20 splitting cards into smaller parts). Note that I am not aware of any viewer 21 which supports a feature like this, so I guess it's useless unless someone 22 wants to add that feature. 23 * Line 2 - Contains the front side of the card. 24 * Rest of the file - Contains the back side of the card. 25 26 ### Helper Scripts 27 28 * addcard.pl <initials> <card number> - Adds a card with the given number and 29 initials to the directory `flashcards` and opens it with `vi`. The file 30 name is based on the number and initials, so `./addcard.pl xx 1.2.3` will 31 open the file `flashcards/01-02-03_00xx`. The extra number after the underscore 32 is increased if the file already exists. The argument <card number> is pasted 33 into the first line of the file automatically. Additionally, `addcard.pl` 34 writes the file of the current card into `.cur_card` so that it can be 35 read by a Makefile (see 'Sample Workflow' below). 36 * tmp_compile.sh <card name> - Compiles the given card in `flashcards/` to the 37 file `tmp_compile.pdf`. 38 * compile_all.sh - Compiles all flashcards in `flashcards/` into one big file. 39 * mnemosyne.sh - Generates a TSV file suitable for importing into Mnemosyne. 40 Note that you still need to add the definitions (`defs.tex`) for the project 41 into the Mnemosyne config. 42 Note that Mnemosyne doesn't seem to allow updating existing flashcards when 43 importing a file, so it isn't possible to edit notes and then re-import to 44 apply the changes. 45 Note also that this script isn't tested because I updated it for the changes 46 to the flashcard format after I stopped using Mnemosyne and was too lazy to 47 test if it still worked properly. Please report any bugs you find. 48 * anki.sh - Generates a TSV file suitable for importing into Anki. 49 Note that you still need to add the definitions (`defs.tex`) for the project 50 into the Anki config. See the section on Anki below for more information. 51 * notes_compile.sh <file> - Generates a regular PDF document from the LaTeX file 52 given as an argument, including all the definitions from `defs.tex`. This 53 is useful when some extra information is needed to understand the cards, 54 for instance when each chapter has a set of conventions that apply to the 55 whole chapter and can't be repeated on each card. 56 57 ### Sample Workflow 58 59 Just add a new card with `addcard.pl`. When you're done editing it, run `make` 60 (assuming you have the sample Makefile in the directory). I usually just type 61 `!make` in vi or vim. This compiles the card to `tmp_compile.pdf`. If your PDF 62 viewer supports reloading documents, you can just leave it open and reload 63 every time you create a new card. 64 65 Once you're done adding all cards, you can use any of the other helper scripts 66 to compile the cards to one big file or do whatever. 67 68 ### Anki 69 70 In order to use the TSV file in Anki, first create a new note type and add three 71 fields to it: "ID", "Front", and "Back". 72 73 Edit the options for the note type and add the following header, replacing 74 `[defs.tex]` with the contents of `defs.tex`: 75 76 ``` 77 \documentclass[12pt]{article} 78 \special{papersize=3in,5in} 79 \pagestyle{empty} 80 \setlength{\parindent}{0in} 81 [defs.tex] 82 \begin{document} 83 ``` 84 85 Then add the following footer: 86 87 ``` 88 \end{document} 89 ``` 90 91 The TSV file contains the card ID as the first field, so when importing the file, 92 the option "Update existing notes when first field matches" can be used. 93 94 ### License 95 96 CC0 (I mean, it's not like I care what people do with this) 97 98 Report bugs to nobody@lumidify.org