use knitr api to determine figure filenames