Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert tiktz plot to png #20

Open
cderv opened this issue Nov 17, 2018 · 0 comments
Open

Convert tiktz plot to png #20

cderv opened this issue Nov 17, 2018 · 0 comments

Comments

@cderv
Copy link

cderv commented Nov 17, 2018

Another hook found in knitr example
https://github.com/yihui/knitr-examples/blob/master/047-tikz-png.Rnw

knit_hooks$set(tikz2png = function(before, options, envir) {
  # use this hook only for dev='tikz' and externalized tikz graphics
  if (before || options$dev != 'tikz' || !options$external || options$fig.num == 0) return()
  figs = knitr:::all_figs(options, ext = 'pdf')  # all figure names
  # note the tikz2png option is the extra parameters passed to 'convert'
  for (fig in figs) {
    system(sprintf('convert %s %s %s', options$tikz2png, fig, sub('\\.pdf$', '.png', fig)))
  }
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant