3

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,%
   headinclude, footinclude, BCOR5mm,%
   numbers=noenddot, cleardoublepage=empty,%
   ]{scrreprt}

\usepackage[catalan]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[export]{adjustbox}
\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
\pagestyle{scrheadings}
\Blinddocument
\end{document}

which produces

enter image description here

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]

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

\RequirePackage[english,spanish,catalan]{babel}
\RequirePackage[utf8]{inputenc}
\RequirePackage[T1]{fontenc}
\RequirePackage[export]{adjustbox}
\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
\pagestyle{scrheadings}
\Blinddocument

\end{document}

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

enter image description here

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
5

The key is looking in the log file where

LaTeX Warning: Unused global option(s):
    [headinclude,footinclude].

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]

\PassOptionsToPackage{headinclude,footinclude,BCOR=5mm}{typearea}

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

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

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

\RequirePackage{arsclassica}

\endinput

enter image description here

  • 1
    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
  • @Johannes_B Thanks, I'm no expert in KOMA classes. – egreg Jul 30 '15 at 14:16

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.