9

In LaTeX, we modify a predefined documentclass to fit our need. I wonder how we can edit the original documentclass (e.g. article) to have our customized properties? I mean which file is responsible for the article documentclass and should be edited to be customized?

I've seen some customized templates (.cls files), but they are indeed templates NOT class, as they somehow use the original class by \LoadClass.

NOTE: The tag documentclass-writing was very useful for finding interesting questions/answers, but the case is not what I meant to customize an original class of LaTeX.

5
  • 1
    Would this answer your question? Style/class tutorials
    – ArTourter
    Commented Apr 16, 2012 at 9:02
  • @ArTourter the main answer is based on \LoadClass{article}. Am I wrong or missed something?
    – Googlebot
    Commented Apr 16, 2012 at 9:05
  • 4
    .cls files are indeed class files, i.e. article is provided by article.cls and \documentclass{foo} always loads foo.cls. Never ever edit existing class or package files. It is a mess and even against the license. Instead make a copy (e.g. myarticle.cls) and modify that one. Commented Apr 16, 2012 at 9:06
  • 2
    There are no "templates" with LaTeX. A class can be based on another class (and modified classes should be most the time!) by loading the base class using \LoadClass. That's perfectly fine! Commented Apr 16, 2012 at 9:07
  • also in that same page there is an answer linking to the cls guide that may be of some help.
    – ArTourter
    Commented Apr 16, 2012 at 9:11

1 Answer 1

14

You seem to confuse some things and terms here.

You should never edit existing class or package files, at least not without changing the file name. This is a major point of the LPPL license. If you want to customize a class rename it and make your changes there. Even better would be to load the existing class using \LoadClass or \LoadClassWithOptions and then (re-)define all macros and settings the way you want it.

Every class files is located in <name>.cls file, if it is an "original" class or a derived class (i.e. based on another class). There are no "templates" in LaTeX. People keep using this expression and keep confusing it with class files.

5
  • 1
    Strictly speaking, the LPPL license doesn't prohibit changing a class/style keeping the same name. But this is discouraged by the community.
    – egreg
    Commented Apr 16, 2012 at 11:15
  • @egreg: Wasn't this part of the older versions but was changed to allow distributions like Debian to make minor changes to the code? I can remember that the Debian people didn't regarded the license as free enough because of that before. Commented Apr 16, 2012 at 11:20
  • @MartinScharrer My question was if this is possible. Regarding the terminology, I meant creating an independent class which does not rely on an available class (with \LoadClass). You idea for copying the class to a new independent one is practical enough!
    – Googlebot
    Commented Apr 16, 2012 at 11:23
  • 1
    @MartinScharrer Yes, the "change the name if you modify" clause was weakened to get LPPL recognized as a free license.
    – egreg
    Commented Apr 16, 2012 at 12:34
  • 7
    @Ali -- the downside to copying, renaming and modifying an existing .cls file is that when/if bugs are corrected in that file, these corrections will not be reflected in the modified file -- a maintenance nightmare. using \LoadClass gives the advantage of someone else doing the maintenance, although of course it's necessary to understand the original .cls file in any event. Commented Apr 16, 2012 at 14:36

You must log in to answer this question.

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