3

For a book, the printer required a paper size of 23*32 cm with margins 2cm (left/right) and 3cm (top/bottom). Before I tried to incorporate this in Latex everything was fine but with this new page size and margins (for which I had to use the geometry package, which I didn't use before), it became a mess. The text is not centered and is even running off the page.

I now try: \usepackage[total={19cm,26cm}, top=3cm, left=2cm]{geometry}, right before \begin{document}, but that doesn't work.

Does anybody know what might cause this error? See MWE below:

\documentclass[10pt, twoside, backref=page, bookmarks, urlcolor=blue, 

citecolor=blue, linkcolor=blue, colorlinks, hyperfigures]{report}
\pdfpagewidth 23cm
\pdfpageheight 32cm

\usepackage{vmargin}
\usepackage[total={19cm,26cm}, top=3cm, left=2cm]{geometry}

\begin{document}

\chapter{First chapter}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent et auctor purus. Nulla lobortis, nisi ut mollis condimentum, augue leo condimentum ante, a tincidunt velit augue quis augue. Mauris ultrices pretium molestie. Maecenas vitae velit sem. Suspendisse potenti. Aliquam imperdiet quam id velit rutrum vehicula. Phasellus rutrum mattis quam, sed finibus enim ultrices et. Nunc consectetur nisl quis tincidunt viverra. Proin pretium magna sit amet leo imperdiet sodales. Cras congue mi tellus, non viverra elit tincidunt non.

\newpage
Pellentesque auctor sagittis lacus, non posuere odio cursus eu. Fusce ac gravida turpis, nec viverra massa. Nunc tempor efficitur elit id consequat. Duis vel quam imperdiet, posuere elit in, consequat est. Fusce mauris purus, lacinia in lacus sed, sagittis vulputate sapien. In luctus nibh orci, vel congue nunc semper quis. Donec convallis felis at ligula tempor, eget vehicula tortor laoreet. Sed est ipsum, iaculis sit amet auctor et, tempus nec elit. Vestibulum sapien dui, ullamcorper id molestie et, tincidunt sed ante. Maecenas pellentesque consequat ligula eu suscipit. Etiam volutpat viverra nisi vitae dapibus. Vestibulum in eros hendrerit, mattis justo at, bibendum turpis. In risus turpis, viverra eu neque eget, consequat faucibus odio. Aenean facilisis dui mi, ut maximus ligula interdum at. Nullam libero lorem, dictum vitae dui sed, interdum eleifend dui.


\end{document}

The vmargin package plays a huge part in this problem, but even when I don't load vmargin, the margins are still not as specified.

Many thanks in advance!!

Tim

  • It would help if you reduced your answer to something minimal that exhibits the same issue. Certainly not all those packages are essential for a minimal example. – A.Ellett Sep 10 '18 at 0:09
  • Have you considered using the package geometry. It's much more intuitive in figuring out how to get the height and width constraints that you want. – A.Ellett Sep 10 '18 at 0:10
  • I understand that it's not essential for a minimal example, but it is for the document I have, and probably one of those lines of text interferes with what I actually want to achieve. I load the geometry package at last, just before begin document. – Tim van Dam Sep 10 '18 at 0:13
  • Yes indeed. But it would help us if you could reduce that list to an example that minimally reproduces the error. Once you reduce it, we can then dig in and the try to figure out what's going on. – A.Ellett Sep 10 '18 at 0:15
  • A couple things: (1) just specifying top and left will not set bottom and right to the same values, (2) odd and even pages in report will have different sized margins on the left and right to accommodate the edge of the paper taken up with binding. – A.Ellett Sep 10 '18 at 0:32
2

You're using conflicting packages: in particular vmargin is causing the problems for you. And anything that you're probably doing in vmargin is something you could do with geometry. Remove vmargin and everything works fine for me.

Here's my minimal example.

\documentclass[10pt, twoside, backref=page, bookmarks, urlcolor=blue, citecolor=blue, linkcolor=blue, colorlinks, hyperfigures]{report}
%\pdfpagewidth 23cm
%\pdfpageheight 32cm
%\usepackage{vmargin}
\usepackage[
  total={19cm,26cm}, 
  top=3cm, 
  bottom=3cm,
  left=2cm,
  right=2cm,
  paperwidth=23cm,
  paperheight=32cm,
  showframe,
  ]{geometry}

\begin{document}

\chapter{First chapter}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent et auctor purus. Nulla lobortis, nisi ut mollis condimentum, augue leo condimentum ante, a tincidunt velit augue quis augue. Mauris ultrices pretium molestie. Maecenas vitae velit sem. Suspendisse potenti. Aliquam imperdiet quam id velit rutrum vehicula. Phasellus rutrum mattis quam, sed finibus enim ultrices et. Nunc consectetur nisl quis tincidunt viverra. Proin pretium magna sit amet leo imperdiet sodales. Cras congue mi tellus, non viverra elit tincidunt non.


\newpage

Pellentesque auctor sagittis lacus, non posuere odio cursus eu. Fusce ac gravida turpis, nec viverra massa. Nunc tempor efficitur elit id consequat. Duis vel quam imperdiet, posuere elit in, consequat est. Fusce mauris purus, lacinia in lacus sed, sagittis vulputate sapien. In luctus nibh orci, vel congue nunc semper quis. Donec convallis felis at ligula tempor, eget vehicula tortor laoreet. Sed est ipsum, iaculis sit amet auctor et, tempus nec elit. Vestibulum sapien dui, ullamcorper id molestie et, tincidunt sed ante. Maecenas pellentesque consequat ligula eu suscipit. Etiam volutpat viverra nisi vitae dapibus. Vestibulum in eros hendrerit, mattis justo at, bibendum turpis. In risus turpis, viverra eu neque eget, consequat faucibus odio. Aenean facilisis dui mi, ut maximus ligula interdum at. Nullam libero lorem, dictum vitae dui sed, interdum eleifend dui.


\end{document}

If you're going to use geometry then there's no point in using \pdfpagewidth and \pdfpageheight at the top of your preamble. And with total set as you have, you don't necessarily need to specify both left and right and top and bottom. But for the purpose of reading code, I think it best to do so if that's your intent (not everyone will agree with me on that point).

Perhaps you could explain why you wanted vmargin and we could explain how to achieve the same effect with another package combo that won't make your document wonky.

It might be worth reading egreg's answer to a question about the different page setting packages. You'll get a better understanding of why your code wasn't working properly.

  • Thanks a lot! It was indeed the vmargin package. Furthermore I assumed since I specify the page width (23 cm), the text width (19cm) and the left margin (2cm), Latex knows that 23-19-2 equals 2, but appearently it does't work like that. Thanks again!! – Tim van Dam Sep 10 '18 at 0:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.