0

I tried to get the following example working on Windows 10 (Texmaker V5.0.1); https://gist.github.com/hsanchez/3667596

I used it for a long time on Mac OS and it worked very well. But on Windows 10 the geometry parameters seam not to work. The page is DIN A4 but not in a smaller size for kindle as I expect.

What can I do?

Thank you!

P.S.: I use MikTex 2.9 (64 bit)

P.P.S.: The minimal example:

\documentclass[8pt]{memoir} 
\usepackage[utf8]{inputenc}
\usepackage[paperwidth=9cm, paperheight=11.5cm, top=0.5cm, left=0.5cm, right=0.5cm, bottom=0.5cm]{geometry}
\usepackage{graphicx}
\usepackage{tikz, blindtext}

\makechapterstyle{box}{
  \renewcommand*{\printchaptername}{}
  \renewcommand*{\chapnumfont}{\normalfont\sffamily\huge\bfseries}
  \renewcommand*{\printchapternum}{
    \flushright
    \begin{tikzpicture}
      \draw[fill,color=black] (0,0) rectangle (2cm,2cm);
      \draw[color=white] (1cm,1cm) node { \chapnumfont\thechapter };
    \end{tikzpicture}
  }
  \renewcommand*{\chaptitlefont}{\normalfont\sffamily\Huge\bfseries}
  \renewcommand*{\printchaptertitle}[1]{\flushright\chaptitlefont##1}
}

%Begin Decorative packages
\usepackage{type1cm}
\usepackage{lettrine}
%End decorative packages

\usepackage[T1]{fontenc}
\usepackage[scaled]{helvet}
\renewcommand*\familydefault{\sfdefault}

\frenchspacing
\sloppy
\pagestyle{empty}

\chapterstyle{box}
\begin{document}

\title{Latex Template for Kindle}
\author{by YOUR NAME}
\date{}
\maketitle
\newpage

\newpage
\chapter{Preface}{}

\lettrine[lines=3,slope=4pt,findent=-3pt]{O}{nce upon} a time, lala lala lalala lalalala. 

\newpage
\chapter{Introduction}

\lettrine[lines=3,slope=4pt,findent=-3pt]{O}{nce upon} a time, lala lala lalala lalalala. 

\end{document}
  • Please make your code self-contained, i.e. by adding the code here as code, not only links. – TeXnician Aug 5 '17 at 13:17
  • Can you please edit the question to show the code in a minimal but compilable form along with the output of listfiles (main document) from the log file? – Johannes_B Aug 5 '17 at 13:17
  • You should say which engine you are using for the compilation and also show a log-file -- the version of geometry and some other files can matter. – Ulrike Fischer Aug 5 '17 at 13:21
  • 3
    Load graphicx before geometry. – Johannes_B Aug 5 '17 at 13:30
4

geometry doesn't set the memoir specific length stockwidth and stockheight. The newest version of the graphic drivers set the pdfpagesize to stockwidth if the command is defined and as it is the last package it wins. Changing the package order avoid the problem but it is safer and cleaner to set the stock size correctly:

\documentclass{memoir}
\usepackage[paperwidth=4cm, paperheight=5cm]{geometry}
\setstocksize{4cm}{5cm}
\usepackage{graphicx}

\begin{document}

page content
\end{document}

Or don't use geometry but the commands of memoir to set the page layout.

0

Load graphicx before geometry.

This was the solutions. Thanks a lot!

  • 2
    You can ask Johannes to convert his comment into an answer instead of answering yourself. That way you award credit where credit is due. It is in no way discouraged to write self-answers (in fact it is actively encouraged), but if someone else came up with the answer you might as well ask them to write it down in an answer. – moewe Aug 5 '17 at 14:16
  • @moewe: My answer came later (and the loading order was already remarked by Johannes in the chat). – Ulrike Fischer Aug 5 '17 at 14:18
  • @UlrikeFischer Indeed, I have removed the passage about you answer mentioning the loading order. Thank you for the heads-up. But I stand by the rest of my comment. – moewe Aug 5 '17 at 14:22
  • I find it strange that the solution was a loading order between packages that are completely independent... – Werner Aug 5 '17 at 14:24
  • 1
    @Werner They are in no way independant: all three (the class, geometry and graphicx) try to set \pdfpageheight at begin document. – Ulrike Fischer Aug 5 '17 at 14:25

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.