Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I need to write a document class or template, as for an article, letter, etc. Is there software for this? How do I set it up so that anyone can use my class just like \documentclass{article}?

share|improve this question
    
Welcome to TeX.SE](meta.tex.stackexchange.com/questions/1436/welcome-to-tex-sx). –  Peter Grill Jul 15 '12 at 6:41
4  
How much experience do you have with LaTeX? Writing a documentclass can be very intricate. Is this an actual design project, or do you simply need a class to produce a particular result, like a letter? If the latter, you should search on CTAN to see if an existing one will work. Otherwise, could you give some detail on what you want to accomplish? –  Ryan Reich Jul 15 '12 at 6:52
    
I've edited your question for style; I hope you don't mind. I hope I didn't remove anything that needed to be there! –  Ryan Reich Jul 15 '12 at 7:03
    
thank you for your response. :) its ok i dont mind if you edited my question. Anyway, This is perhaps my first time to make a document class. I simply need to make a class in making an exam template. This template would include a customized names of the types questions. I read some tutorials on making one but i don't know where to make it? should be in windows? or Ubuntu? what software i should use for my project to function? hmmmm –  Kayla Jul 15 '12 at 7:37
    
@Kayla You say in your other comment that you don't have TeX Live. Do you have MikTeX, then? I ask because it sounds like you are a beginner, in which case you shouldn't try to write a documentclass. Have you looked at the exam class? –  Ryan Reich Jul 15 '12 at 7:48

2 Answers 2

Based on my comments, here is an answer. To write a document class, all you need (really) is to create a file, say, myclass.cls, and put it in the same place as your document; then it can be loaded with \documentclass{myclass} and any macros defined in it will be available to the document. The document clsguide.pdf that Higgs Boson linked describes all the various structured commands you ought to put in your class in order to give it a standardized appearance. For example, you can declare its version and the version of LaTeX you need it to use, load other packages or classes in it, and accept options in the form \documentclass[option,option2]{myclass}.

As far as creating a class, no special software is needed. A .cls file is exactly the same as any .tex file and you can write it in whatever text editor you normally write LaTeX documents in (perhaps you are using WinEdt, for example?). There are a few questions around this site about what editors are recommended; this one is a pretty big list.

If you are a beginner, you can look at existing classes for inspiration. For example, since you are building an exam class, you might look at exam.cls, which (though quite complex) is well-written and well-commented, so you might learn something about what a document class typically does. Also see their documentation.

I should say that if you are really a beginner, you should not be writing a class at all, and this example of a real documentclass will probably make no sense to you. Start out by defining some new commands and environments in the default article class. You can spin them off into an independent package later.

share|improve this answer
    
Thank you so much. Since this is a given project to us, i have no more options of changing it. I know it is quite complicated for me to create a new class rather than modifying an existing one as a beginner. But it is also a part of a beginner to learn what and how should it be done. That's what i am actually doing right now. Searching and Asking the veterans of the LaTeX world to have a more specified idea about the question i raised a while ago. Thank you! It really helped me. :P Good Day. –  Kayla Jul 15 '12 at 9:14

If you have TeXLive installed, type texdoc clsguide as follows.

enter image description here

Pressing enter will open a manual for writing document class.

Or you can download it from CTAN, here clsguide.pdf.

share|improve this answer
3  
texdoc clsguide works with MiKTeX as well. +1 for the screenshot, executing texdoc right from the search box is a nice tip. (Boo for IE and Chrome though) –  doncherry Jul 15 '12 at 11:02
3  
@Kayla: our friend Stefan Kottwitz has a dedicated server for querying and browing TeX and LaTeX package information and general documentation, based on texdoc: texdoc.net You can type clsguide in the search box and get the documentation. :) –  Paulo Cereda Jul 15 '12 at 14:26
    
@doncherry: I removed IE from the screenshot but let Chrome stay intact. –  stalking is prohibited Jul 15 '12 at 14:39

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.