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

emf aspect ratio unequally scaled to 1.2 w: 1 h in docx (pandoc 1.16.0.2, Mac OS X) #2720

Closed
rfhb opened this issue Feb 17, 2016 · 5 comments

Comments

@rfhb
Copy link

rfhb commented Feb 17, 2016

When rendering a R markdown document with plots using device='emf' into a docx document, all plots in the docx file are scaled to 69% height and 83% width. This does not depend on any setting of figure width or height in R. The rendering results in an undesirable aspect ratio, distorting the plots. In a word processor, the scaling would need to be reset for every plot manually. This is the command line:

pandoc Report.md --to docx --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output Report.docx

There is no relevant output using --verbose. Could this be a problem with the image size detection? Using pandoc 1.15, the type and size of emf files was not detected at all by pandoc (the error message was pandoc: Could not determine image size in 'RMarkdownReport_files/figure-docx/figure-1.emf': could not determine image type.

In any case it would be preferred if the docx writer would not set any image size for the emf file. Thanks.

@jgm
Copy link
Owner

jgm commented Feb 17, 2016 via email

@mb21
Copy link
Collaborator

mb21 commented Feb 17, 2016

Pandoc currently can't determine the dimensions of emf / Windows Metafile images. I'm not sure whether it's unusual that RMarkdown produces an emf file, or that the output format (docx in this case) requires the dimensions to be read out, but I suspect it's the latter. Can you configure RMarkdown somehow to generate Png, Gif, Jpeg, Pdf or Eps? as they are supported by Pandoc..

@rfhb
Copy link
Author

rfhb commented Feb 17, 2016

A minimal example is in Archiv.zip (Report.md, without size information; the EMF graphic and the rendered docx file; also a screen shot for the formatting window of the word processor is included showing the unequal scaling).

I understand that EMF is not supported and have switched to postscript / EPS. Sorry for raising this; I was intrigued by the error message disappearing when updating to 1.16 and did not check for supported formats.

Archiv.zip

@mb21
Copy link
Collaborator

mb21 commented Feb 17, 2016

pandoc 1.16 doesn't emit the Could not determine image size error anymore? interesting... I think that's due to the either (const def) in the Docx writer, which @jgm introduced in 622f096

@rfhb
Copy link
Author

rfhb commented Mar 13, 2016

Have documented a work around which works for me to use EMF graphics from Rmarkdown rendered into docx: https://github.com/rfhb/rmarkdownknitrpandocemf.

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

3 participants