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

memoir documentclass ignoring geometry when including an image #3975

Closed
ubitux opened this issue Oct 16, 2017 · 8 comments
Closed

memoir documentclass ignoring geometry when including an image #3975

ubitux opened this issue Oct 16, 2017 · 8 comments

Comments

@ubitux
Copy link

@ubitux ubitux commented Oct 16, 2017

Steps to reproduce:

  • create a small 100x100 image: convert -size 100x100 canvas:khaki img.png (convert is from the ImageMagick project but you can use any other tool)
  • create a markdown document with that image: echo '![Hello World](img.png)' > bug.mkd
  • try to generate a 5x8 inches memoir from this: pandoc -V geometry:paperwidth=5in -V geometry:paperheight=8in -V documentclass=memoir bug.mkd -o bug.pdf

Opening bug.pdf will show a document much larger than expected (even though the image is pretty small).

This is not reproducible with text only or documentclass=book, revealing that something is probably wrong in the handling of dimensions in the memoir documentclass when inserting images.

% pandoc --version
pandoc 1.19.2.1
Compiled with pandoc-types 1.17.2, texmath 0.9.4.4, skylighting 0.1.1.5
Default user data directory: /home/ux/.pandoc
Copyright (C) 2006-2016 John MacFarlane
Web:  http://pandoc.org
This is free software; see the source for copying conditions.
There is no warranty, not even for merchantability or fitness
for a particular purpose.
@mb21
Copy link
Collaborator

@mb21 mb21 commented Oct 16, 2017

It's always helpful to post the LaTeX pandoc generates and what you expected it to generate (via pandoc bug.mkd -o bug.tex)...

Loading

@ubitux
Copy link
Author

@ubitux ubitux commented Oct 16, 2017

The generated code doesn't change between -V documentclass=memoir and -V documentclass=book; but the overall template is probably different. My guess is that memoir doesn't support to be mixed with the geometry package and we should be using other variables such as stockwidth and stockheight, but I wasn't able to make it work out.

Loading

@ubitux
Copy link
Author

@ubitux ubitux commented Oct 16, 2017

I found a workaround: -V header-includes="\\setstocksize{8in}{5in}". I don't know if it's a safe fix, but for now it seems to work properly.

Loading

@jgm
Copy link
Owner

@jgm jgm commented Oct 16, 2017

Loading

@jgm jgm closed this Oct 16, 2017
@ubitux
Copy link
Author

@ubitux ubitux commented Oct 16, 2017

I think the real problem is that memoir has its own built-in ways to specify document dimensions (see the memoir manual).

Yes that's how I found out about \setstocksize, but it's not documented in the pandoc documentation where memoir is supposed to be supported.

I don't think using geometry with memoir is recommended.

Well, isn't it the only way to specify dimensions in pandoc? What else am I supposed to use? BTW, the memoir documentation says that you can use it, and I actually do need both geometry and the stock size to be set (to the same values) to get a proper output.

Loading

@jgm
Copy link
Owner

@jgm jgm commented Oct 16, 2017

Loading

@ubitux
Copy link
Author

@ubitux ubitux commented Oct 16, 2017

My policy is this: if you use pandoc defaults (normal documentclasses), things will work as documented. If you use a special documentclass, then it's your responsibility to figure out what it requires.

But memoir is in the "normal" documentclasses that pandoc documents (it's one of the 4 documented twice).

Loading

@jgm
Copy link
Owner

@jgm jgm commented Oct 16, 2017

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants