# wrong page size using LyX and Koma Script

First of all I am new to using Tex so please excuse any obvious things which will not be included in this question. But to the point:

I am using LyX 2.0.6 (with Miktex 2.9). I am writing a thesis in polish language. I use Koma Script book class. And I base my thesis on an example thesis included with Lyx. Each chapter is on a different branch and in a different file which is then included to the master file.

The problem is: When i create a pdf from a "chapter file" everything is ok but when I create it from a master file, the page size is visibly smaller (there is a lot more space between the text and page borders on each side). I am aiming for A4 paper size.

As far as I can see there are no differences in preamble of a single chapter and the whole thesis.

I tried specifying paper size in document class and using geometry package. Nothing helps.

I am aware that above information may be not enough to help so if anything is missing please write what and I will add it.

Single chapter preamble example here paper size is ok:

%% LyX 2.0.6 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[12pt,czech,greek,italian,polish,intoc,bibliography=totoc,index=totoc,BCOR10mm,captions=tableheading,titlepage,fleqn,pagesize,a4paper]{scrbook}
\usepackage{lmodern}
\renewcommand{\sfdefault}{lmss}
\renewcommand{\ttdefault}{lmtt}
\usepackage[LGR,T1]{fontenc}
\usepackage[iso-8859-7,latin9,latin2]{inputenc}
\usepackage{listings}

\lstset{captionpos=b,
frame=single}
\usepackage{fancyhdr}
\pagestyle{fancy}
\setcounter{secnumdepth}{3}
\usepackage{amssymb}\usepackage{babel}
\usepackage{array}
\usepackage{float}
\usepackage{calc}
\usepackage{textcomp}
\usepackage{ifsym}
\usepackage{marvosym}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{setspace}
\onehalfspacing
\usepackage[unicode=true,
bookmarks=true,bookmarksnumbered=true,bookmarksopen=true,bookmarksopenlevel=1,
breaklinks=false,pdfborder={0 0 0},backref=false,colorlinks=false]
{hyperref}
\hypersetup{pdftitle={Your title},
pdfauthor={Your name},
pdfpagelayout=OneColumn, pdfnewwindow=true, pdfstartview=XYZ, plainpages=false}
\usepackage{breakurl}

\makeatletter

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
\DeclareRobustCommand{\greektext}{%
\fontencoding{LGR}\selectfont\def\encodingdefault{LGR}}
\DeclareRobustCommand{\textgreek}[1]{\leavevmode{\greektext #1}}
\DeclareFontEncoding{LGR}{}{}
\DeclareTextSymbol{\~}{LGR}{126}
%% Because html converters don't know tabularnewline
\providecommand{\tabularnewline}{\\}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
% in case somebody want to have the label "Equation"
%\renewcommand{\eqref}[1]{Equation~(\negthinspace\autoref{#1})}

% that links to image floats jumps to the beginning
% of the float and not to its caption
\usepackage[figure]{hypcap}

\usepackage[paper=A4,pagesize]{typearea}

% the pages of the TOC is numbered roman
% and a pdf-bookmark for the TOC is added
\let\myTOC\tableofcontents
\renewcommand\tableofcontents{%
\frontmatter
\pdfbookmark[1]{\contentsname}{}
\myTOC
\mainmatter }

%------------caption handling---------------------
\usepackage[font={it}]{caption}

\renewcommand{\fnum@lstlisting}{Przykład kodu~\thefigure}
\renewcommand{\fnum@figure}{Ilustracja~\thefigure}

%   makes caption labels bold
%   for more info about these settings, see
%   http://mirrors.ctan.org/macros/latex/contrib/koma-script/doc/scrguien.pdf
\setkomafont{captionlabel}{\bfseries}
\setcapindent{1em}

%--------------------------------------------------
% enables calculations
\usepackage{calc}

%indent for the first paragraph after a title
\usepackage{indentfirst}

%enables dingbat symbols
\usepackage{pifont}

%centruje zawarto¶ć tabeli w przypadku laczonych wierszy
%\renewcommand{\multirowsetup}{\centering}

% fancy page header/footer settings
% for more information see section 9 of
% ftp://www.ctan.org/pub/tex-archive/macros/latex2e/contrib/fancyhdr/fancyhdr.pdf
\renewcommand{\chaptermark}[1]{\markboth{#1}{#1}}
\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}}

% increases the bottom float placement fraction
\renewcommand{\bottomfraction}{0.5}

% avoids that floats are placed above its sections
\let\mySection\section\renewcommand{\section}{\suppressfloats[t]\mySection}

\makeatother

\begin{document}
...
\end{document}


Master document, here paper size is not ok:

%% LyX 2.0.6 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[11pt,a4paper,czech,english,greek,italian,polish,intoc,bibliography=totoc,index=totoc,BCOR10mm,captions=tableheading,titlepage,fleqn,pagesize,a4paper]{scrbook}
\usepackage{lmodern}
\renewcommand{\sfdefault}{lmss}
\renewcommand{\ttdefault}{lmtt}
\usepackage[LGR,T1]{fontenc}
\usepackage[iso-8859-7,latin9,latin2]{inputenc}
\usepackage{listings}
\lstset{captionpos=b,
frame=single}
\usepackage{fancyhdr}
\pagestyle{fancy}
\setcounter{secnumdepth}{3}
\usepackage{amssymb}\usepackage{babel}
\usepackage{array}
\usepackage{float}
\usepackage{calc}
\usepackage{textcomp}
\usepackage{ifsym}
\usepackage{marvosym}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{setspace}
\usepackage{nomencl}
% the following is useful when we have the old nomencl.sty package
\providecommand{\printnomenclature}{\printglossary}
\providecommand{\makenomenclature}{\makeglossary}
\makenomenclature
\onehalfspacing
\usepackage[unicode=true,pdfusetitle,
bookmarks=true,bookmarksnumbered=true,bookmarksopen=true,bookmarksopenlevel=1,
breaklinks=false,pdfborder={0 0 0},backref=false,colorlinks=false]
{hyperref}
\hypersetup{
pdfpagelayout=OneColumn, pdfnewwindow=true, pdfstartview=XYZ, plainpages=false}
\usepackage{breakurl}

\makeatletter

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
\special{papersize=\the\paperwidth,\the\paperheight}

\DeclareRobustCommand{\greektext}{%
\fontencoding{LGR}\selectfont\def\encodingdefault{LGR}}
\DeclareRobustCommand{\textgreek}[1]{\leavevmode{\greektext #1}}
\DeclareFontEncoding{LGR}{}{}
\DeclareTextSymbol{\~}{LGR}{126}
%% Because html converters don't know tabularnewline
\providecommand{\tabularnewline}{\\}

\@ifundefined{date}{}{\date{}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
% in case somebody want to have the label "Equation"
%\renewcommand{\eqref}[1]{Equation~(\negthinspace\autoref{#1})}

% that links to image floats jumps to the beginning
% of the float and not to its caption
\usepackage[figure]{hypcap}

\usepackage[pass]{geometry}

% the pages of the TOC is numbered roman
% and a pdf-bookmark for the TOC is added
\let\myTOC\tableofcontents
\renewcommand\tableofcontents{%
\frontmatter
\pdfbookmark[1]{\contentsname}{}
\myTOC
\mainmatter }

%------------caption handling---------------------
\usepackage[font={it}]{caption}

\renewcommand{\fnum@lstlisting}{Przykład kodu~\thefigure}
\renewcommand{\fnum@figure}{Ilustracja~\thefigure}

%   makes caption labels bold
%   for more info about these settings, see
%   http://mirrors.ctan.org/macros/latex/contrib/koma-script/doc/scrguien.pdf
\setkomafont{captionlabel}{\bfseries}
\setcapindent{1em}

%--------------------------------------------------
% enables calculations
\usepackage{calc}

%indent for the first paragraph after a title
\usepackage{indentfirst}

%enables dingbat symbols
\usepackage{pifont}

%centruje zawarto¶ć tabeli w przypadku laczonych wierszy
%\renewcommand{\multirowsetup}{\centering}

% fancy page header/footer settings
% for more information see section 9 of
% ftp://www.ctan.org/pub/tex-archive/macros/latex2e/contrib/fancyhdr/fancyhdr.pdf
\renewcommand{\chaptermark}[1]{\markboth{#1}{#1}}
\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}}

% increases the bottom float placement fraction
\renewcommand{\bottomfraction}{0.5}

% avoids that floats are placed above its sections
\let\mySection\section\renewcommand{\section}{\suppressfloats[t]\mySection}

\makeatother

\begin{document}

\publishers{\noindent ...\\
...\\
...\\
\inputencoding{latin9}\foreignlanguage{english}{\vspace{-3cm}
}}

\author{...}

\title{...}

\begin{onehalfspace}

\lowertitleback{\noindent ...\\
...\\
...}
\end{onehalfspace}

\date{...}

\maketitle
\cleardoublepage{}

\lhead{\rightmark}

\rhead[\leftmark]{}

\lfoot[\thepage]{}

\cfoot{}

\rfoot[]{\thepage}

\tableofcontents{}

\cleardoublepage{}

\pagestyle{plain}

\include{Summary}

\cleardoublepage{}

\pagestyle{fancy}

\lhead[\chaptername~\thechapter]{\rightmark}

\include{chapter-1}
\include{chapter-2}
\include{chapter-3}
\include{chapter-4}

\cleardoublepage{}

\lhead[]{Acknowledgments}

\rhead[Acknowledgments]{}

\cleardoublepage{}

\lhead[]{\rightmark}

\rhead[\leftmark]{}

\bibliographystyle{alpha}
\bibliography{bibliography}

\cleardoublepage{}

\lhead[]{Nomenclature}

\rhead[Nomenclature]{}

\printnomenclature[2.5cm]{}
\end{document}


NEW: After adding this to the chapter preamble:

\documentclass[11pt,a4paper,czech,english,greek,italian,polish,intoc,bibliography=totoc,index=totoc,BCOR10mm,captions=tableheading,titlepage,fleqn,pagesize,a4paper]{scrbook}
\usepackage{geometry}
\usepackage{hyperref}

\setlength{\pdfpagewidth}{\paperwidth}
\setlength{\pdfpageheight}{\paperheight}


this single chapter now looks like the master document. So now I don't know which is correct A4 format. I likeed the old chapter size better.

paper dimensions are 210mm x 297mm, master document (and now single chapter) has text area : ~136mm x 227mm, old single chapter text area: ~152mm x ~253mm

• Welcome to TeX.SX! Please show us the complete document code that LyX creates for you, as otherwise it is a bit hard to tell what is going on. – mafp Sep 1 '13 at 19:29
• done as requested – Groszeq Sep 1 '13 at 19:53

## 1 Answer

It seams that I just managed to solve my own problem. The difference was the font size. Koma Script calculates text area size automatically based on paper size and font size. Root document had font size 11pl and a single chapter had 12pt. After making root document font size bigger the text area size increased to much closer to the size I was hoping. I'm am completely green when it comes to typography and have no aesthetic sens what so ever, but it seems that if I want a smaller font, I will just have to set the margins by hand and hope for the best.