3

The following code works fine and gives expected output.

\documentclass[fontsize=14pt,twoside,a4paper]{book}
\usepackage[T1]{fontenc}
\usepackage[none]{hyphenat}
\usepackage{scrextend}
\usepackage{wordlike}
\usepackage{blindtext,setspace}
\geometry{hmargin=2.54cm,vmargin=2.54cm}
\setstretch{1.09}
\begin{document}
\noindent\blindtext[9]
\end{document}

I want to convert it to class file. Following is the class-file based on above code.

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{myclass}
\LoadClass[fontsize=14pt,twoside,a4paper]{book}
\RequirePackage[T1]{fontenc}
\RequirePackage[none]{hyphenat}
\RequirePackage{scrextend}
\RequirePackage{wordlike}
\RequirePackage{blindtext,setspace}
\geometry{hmargin=2.54cm,vmargin=2.54cm}
\setstretch{1.09} 

When I compile the code in my.tex file (given below), it gets compiled.

\documentclass{myclass}
\begin{document}
\noindent\blindtext[9]
\end{document}

However the options fontsize=14pt and probably other options are not passed. So the problem is that \LoacClass doesn't seem to pass options to tex file. How can this issue be addressed? I also found that if I use \documentclass[fontsize=14pt,twoside,a4paper]{myclass}, the issue gets solved. But I want to load myclass with options specified. Is it possible?

1 Answer 1

4

In the case of using the code 'directly', the option fontsize=14bp isn't recognised by the book class, but as you are giving it as a global option (the optional argument to \documentclass), it is available to all of the packages you load. It is recognised by scrextend, so it gets applied.

In contrast, when you make a class, the option fontsize=14pt is no longer on the global list, it's now purely passed to book, which doesn't recognise it, and as a result a warning is issued. You need to pass the option here to the package that actually needs it, so

\RequirePackage[fontsize=14pt]{scrextend}
2
  • BTW, you are mixing up 14pt and 14bp: these are not the same
    – Joseph Wright
    Apr 17, 2023 at 9:20
  • Thanks for answering. I made14pt everywhere.
    – user61681
    Apr 17, 2023 at 9:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .