# Converting preamble into a new class changes margins

I'm trying to convert a preamble into a new class file.

This is a simplfied version of the original file: testdoc.tex

\documentclass[%
11pt, a4paper, twoside, openright, titlepage, fleqn,%
numbers=noenddot, cleardoublepage=empty,%
]{scrreprt}

\usepackage[catalan]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{fixltx2e}

\usepackage{amsmath,amsthm,amssymb}

\usepackage[eulerchapternumbers,beramono,listings,%
eulermath,pdfspacing]{classicthesis}

\usepackage{arsclassica}

\title{Pràctiques de laboratori\\ Wireshark}
\author{Fonaments de xarxes de telecomunicació}
\date{Curs 15/16}

\usepackage{blindtext}

\begin{document}
%\maketitle
%\tableofcontents
\Blinddocument
\end{document}


which produces

Then the whole preamble is converted into testclass.cls file:

\NeedsTeXFormat{LaTeX2e}[1994/06/01]%
\ProvidesClass{FXTWShark}[2015/07/30 Format Enunciat Pràctiques FXT]

11pt, a4paper, twoside, openright, titlepage, fleqn,%
numbers=noenddot, cleardoublepage=empty,%
]{scrreprt}

\RequirePackage[english,spanish,catalan]{babel}
\RequirePackage[utf8]{inputenc}
\RequirePackage[T1]{fontenc}
\RequirePackage{fixltx2e}
\RequirePackage{amsmath,amsthm,amssymb}

\RequirePackage[eulerchapternumbers,beramono,listings,%
eulermath,pdfspacing]{classicthesis}

\RequirePackage{arsclassica}


which is used as document class in testclass.tex

\documentclass{testclass}

\title{Title}
\author{Author}
\date{\today}

\usepackage{blindtext}

\begin{document}

\maketitle

\tableofcontents
\Blinddocument

\end{document}


Once compiled the result is a layout with different header and footer margins

Do you know why?

May be the problem is related with Defined a new class verbatim from my preamble, but resulting document does not have identical layout but the answer there or egreg's cited answer to How can I prevent LGR encoding from switching font size? doesn't help me. I'm not sure about the relation and I if they are, I don't know how to apply it to my problem.

• don't forgget \ProvidesClass{testclass} and \endinput see egreg answer – touhami Jul 30 '15 at 14:52

The key is looking in the log file where

LaTeX Warning: Unused global option(s):


is found. The two options pertain to typearea and not to scrreprt. With the first example code, they are global options, because they are passed to \documentclass, in the second case they aren't and so typearea doesn't see them.

Solution: use \PassOptionsToPackage.

\NeedsTeXFormat{LaTeX2e}[1994/06/01]
\ProvidesClass{testclass}[2015/07/30 Format Enunciat Pràctiques FXT]

11pt, a4paper, twoside, openright, titlepage, fleqn,
numbers=noenddot, cleardoublepage=empty,
]{scrreprt}

\RequirePackage[english,spanish,catalan]{babel}
\RequirePackage[utf8]{inputenc}
\RequirePackage[T1]{fontenc}

• I think the BCOR option needs an equal sign by now, the syntax above is obsolete. Also possible and more intuitive: Give the options using KOMAoptions, maybe followed by recalctypearea. – Johannes_B Jul 30 '15 at 14:08