This practice sheet is a TeX document for the ConTeXt Mark IV typesetting engine.
In order to compile it to a PDF file you need to have a ConTeXt installation and to use it in Mark IV which is still beta and therefore needs to be used explicitly.
For correct representation of the Chinese Hanzi you will also need to install a suitable TrueType font containing these characters. The example font used by default in this sheet is STKaiti which could be acquired using a web search engine if you have not installed it in your system.
Font installation can be done by using the command line interface. Remember that you have to set the environment variable OSFONTDIR according to the paths where your fonts can be found. This can be done on Windows somewhere on the 'My Computer' settings, if I remember correctly.
For the ConTeXt Standalone version (on Windows) the packages simplefonts and filter need to be installed.
Python version 3 is required for the filter which generates the content from an Anki export. The default configuration of ConTeXt has to be changed to allow running external programs.
To generate practice sheets you can provide your own Anki export file and point to it by exchanging the file name used at the bottom of the TeX document.
The export file is required to have lines with fields separated by either a tabulator character or one or more <br /> tags in this form:
你 nǐ<br /><br /><br />du
Compile the document using this commandline:
context hanzi-sheet.tex
You can use the LuaTeX function userdata.readhanzi() for generating simple practice sheets using a source file with one character per line.
An example source file is included in this repository: hanzi.txt.
The python script filter.py can be used to generate such a newline-separated symbol file from an Anki export:
python filter.py zhongwen.txt hanzi.txt
Install Git for Windows on your system.
- Open a Git Bash from your Start Menu
- Run
git clone [email protected]:aniederl/hanzi-sheet.git
Install ConTeXt Standalone for Windows:
- Extract context-setup-mswin.zip into your user directory
- Open cmd.exe and change into the extracted directory (e.g. C:\Users\Hugo\context)
- Run
first-setup.bat --modules=all
- Open the Properties window for Computer in your Start Menu (or your Desktop)
- Open extended system properties
- Go to Advanced
- Click on Environment Variables (on the bottom)
- In System Variables lookup the variable Path
- Click on Edit
- Go to the end of the variable value, enter a semicolon (;)
- Append the path to the context binary directory tex\texmf-mswin\bin, e.g.
...SVN/bin;C:\Users\Hugo\context\tex\texmf-mswin\bin
- Open a Git Bash from your Start Menu
- Run
mtxrun --generate context --make
- Go the the System Variables as before
- Create a new System Variable named OSFONTDIR
- Set its value to
c:/windows/fonts/
- Note that normal slashes (/) are used here in contrast to the backslashes (\) before
- Lookup the font STKaiti on the Internet and download it
- Right-Click on the font file and select Install
- Open a Git Bash from your Start Menu
- Run
mtxrun --script fonts --reload
Install Python version 3 for your Windows version. Add the Python binary to your Path variable:
- Go to the System Environment Variable Path as before in section ConTeXt
- Go to the end of the variable value, enter a semicolon (;)
- Append the path to the python directory C:\Python32, e.g.
...\texmf-mswin\bin;C:\Python32
- Open a Git Bash from your Start Menu
- Change directory to this repository
cd hanzi-sheet/
- Generate the sheet PDF with this command:
context hanzi-sheet.tex
- Open hanzi-sheet.pdf in Windows Explorer