LyXMemoir doesn't print in A4 when making PDF

Information and discussion about LyX, a WYSIWYM editor, available for Linux, Windows and Mac OS X systems.
Post Reply
Fed89
Posts: 21
Joined: Thu May 16, 2013 3:01 pm

Memoir doesn't print in A4 when making PDF

Post by Fed89 »

Hello everyone,
i am using lyx to write my thesis.
I use LyX Version 2.2.2 and AdobeAcrobat. Document class is memoir and page format is A4.
However, when i compile it the pdf is always a US letter, regardless that i put A4 or US letter in teh Page Format.
Only the margins seem to be different in the two cases...
Has anyone experienced this problem? how can i fix it?

If of any use, below is the preamble of the source code.

Thanks in advance ;-)

Code: Select all

% Preview source code

%% LyX 2.2.2 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[11pt,english]{memoir}
\usepackage{mathpazo}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[a4paper]{geometry}
\geometry{verbose,lmargin=3.5cm,rmargin=4cm}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}
\usepackage{color}
\usepackage{babel}
\usepackage{array}
\usepackage{longtable}
\usepackage{textcomp}
\usepackage{pdfpages}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage[unicode=true,
 bookmarks=true,bookmarksnumbered=false,bookmarksopen=false,
 breaklinks=false,pdfborder={0 0 0},pdfborderstyle={},backref=false,colorlinks=true]
 {hyperref}
\hypersetup{pdftitle={MasterThesis},
 pdfauthor={Federico\_Bava},
 pdftex,pdffitwindow=true, linkcolor=black, urlcolor=blue, citecolor=black, pdfstartview={FitH}, hyperfootnotes=false, unicode=true}

\makeatletter

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
\newcommand{\noun}[1]{\textsc{#1}}
\newcommand{\lyxmathsym}[1]{\ifmmode\begingroup\def\b@ld{bold}
  \text{\ifx\math@version\b@ld\bfseries\fi#1}\endgroup\else#1\fi}

%% Because html converters don't know tabularnewline
\providecommand{\tabularnewline}{\\}
%% A simple dot to overcome graphicx limitations
\newcommand{\lyxdot}{.}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands.
\numberwithin{equation}{section}
\numberwithin{figure}{section}
\newenvironment{lyxlist}[1]
{\begin{list}{}
{\settowidth{\labelwidth}{#1}
 \setlength{\leftmargin}{\labelwidth}
 \addtolength{\leftmargin}{\labelsep}
 \renewcommand{\makelabel}[1]{##1\hfil}}}
{\end{list}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
%\usepackage{palatino}%font name, other 
\usepackage[numbered,autolinebreaks]{mcode}% allows to add matlab code to the LaTeX
\usepackage{textcomp} %necessary for Matlab code
\usepackage{xcolor}   %necessary for Matlab code
\definecolor{green}{RGB}{34, 139, 34} % to define the same green as Matlab
\usepackage{geometry} %to change single pages margins
\usepackage{booktabs}
\usepackage{array}
\usepackage{url} % to have url address in the references
\usepackage{hyperref}

\setlength\tabcolsep{0pt} 	% space between table columns
\setlength{\extrarowheight}{4pt} % space between table rows

%\makeatletter
\g@addto@macro{\UrlBreaks}{\UrlOrds} % to break URL in bibliography
%\makeatother

\usepackage{scrpage2}
\pagestyle{scrheadings}
\ofoot{\pagemark} % \ofoot{\arabic{page}}
\ohead{}

\aliaspagestyle{part}{empty} % to hide page number in Part page

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

roby92ita
Posts: 10
Joined: Mon Feb 13, 2017 11:32 am

Memoir doesn't print in A4 when making PDF

Post by roby92ita »

Hi,
LyX automatically use the package geometry
\usepackage[a4paper]{geometry}
) I think you put a \usepackage{geometry} in your Preamble that reset the LyX setting and put the page back to the default style (the default style for memoir is letterpaper).
If you need to change the geometry of a page just use /geometry, see geometry
Fed89
Posts: 21
Joined: Thu May 16, 2013 3:01 pm

Memoir doesn't print in A4 when making PDF

Post by Fed89 »

Thanks roby!
unfortunately also commenting the \usepackage{geometry} line, it still gives the same output...
In the text i had for the cover page \newgeometry{...} and then \restoregeometry, but also commenting those does not make any difference...
roby92ita
Posts: 10
Joined: Mon Feb 13, 2017 11:32 am

Memoir doesn't print in A4 when making PDF

Post by roby92ita »

I tried the memoir and I have the same problem, put this in the Preamble:

\setstocksize{297mm}{210mm}

it worked for me.
Fed89
Posts: 21
Joined: Thu May 16, 2013 3:01 pm

Memoir doesn't print in A4 when making PDF

Post by Fed89 »

Thanks a lot! it works ;-)
Post Reply