{documentclass-writing} is about writing document classes. If your question is about choosing, installing, or using document classes, choose {documentclass} instead.

learn more… | top users | synonyms

101
votes
3answers
13k views

Where do I start LaTeX programming?

I'm interested in writing packages for TeX/LaTeX/XeLaTeX. I googled around, but all I found was guides or tutorials about how to prepare documents using LaTeX. I want to know how LaTeX works and how ...
86
votes
6answers
24k views

Style/class tutorials

What are some good tutorials on writing custom styles (classes) that clearly explain commands used and some of the features that TeX has to offer in the way of styles?
55
votes
4answers
1k views

What is good practice when preparing a package for CTAN?

I'm thinking of submitting a package to CTAN, and would like some hints which will help keep the path as smooth as possible for me, the CTAN administators, and the final users. Please tell me what I ...
48
votes
4answers
6k views

Reference guide to begin writing a class and/or a package

Once a LaTeX user gets more and more skilled, and writes his/her own code, the question "Should I make a package (or a class) out of it?" will probably arise. My question is (you catch me: I'm one of ...
45
votes
5answers
9k views

A cookbook in LaTeX?

I am interested in making a cookbook in LaTeX. Each page will contain a recipe, including ingredients, instructions, and a photo of the finished food. Has this been done previously? Where do I ...
36
votes
2answers
663 views

When or why should I use %% as opposed to %?

I've noticed that many (all?) style and class files have "documentation blocks" with a double comment character at the beginning of the line, %% like so instead of the usual style of comments, % ...
29
votes
1answer
678 views

Macro naming best practice?

Is there a preferred or generally accepted idiom for naming user defined macros? I notice that in the change from Tufte 3.5.0 to 3.5.2, for example, the names of the debugging macros have change, for ...
28
votes
2answers
3k views

\newcommand vs \DeclareRobustCommand

I sort of understand the difference between the two. But that's not what I'm interested in—I just want to know, which one should I use? In general, when I'm creating commands in a package or class, ...
26
votes
7answers
2k views

What's a good editor for (La)TeX programming?

I've found several questions about editors for writing LaTeX documents ( LaTeX Editors/IDEs seems to be the definitive one). But I'd like to know which editors are out there that help you develop ...
25
votes
5answers
7k views

How to write a LaTeX class file for my thesis

I want to design a new LaTeX for my college thesis, so that all students could use it. I have decent understanding of how LaTeX works. I am looking for some nice article explaining how to write a ...
21
votes
1answer
520 views

When to use “.sty” extension and when to use “.def”

I'm new to this forum and a recent LaTeX user. I state that, before posting here, I searched all the web through, but I was not succeeded to solve a doubt. I'm writing my own class (myclass.cls), ...
21
votes
1answer
850 views

How do I document my style files?

I have many style files (and one or two class files) that I've written in my local texmf tree. Most were simple things that got me out of some trouble and which I put in to a style file in case I ...
19
votes
1answer
282 views

When should I upload my new style?

I've been working lately in a new style for my university, which is heavily influenced by a pre-existing style (feupteses). However, feupteses was never meant for PhD dissertations, so I decided to ...
18
votes
3answers
1k views

Customizing LaTeX - create a document class or a package?

Are there general rules for when to create a document class vs. creating a package to customize LaTeX? Does one have benefits over the other? My specific need is to create a customized page layout, ...
17
votes
2answers
552 views

Write new package with LaTeX2e or LaTeX3

I’m planning to create a package and I wonder if it’s better do do this with LaTeX3 syntax or the „old“ LaTeX2e, which is the one I know. Will LaTeX2e packages be supported by LaTeX3? I can give ...
16
votes
3answers
868 views

what TeX package(s) should I use for a Church Bulletin

I create Sunday Bulletins (aka service leaflets) for an Episcopal Church each week. Currently, I use the MS Publisher (PITA) I also do some web design using Ruby. While a physics undergrad, I ...
15
votes
1answer
183 views

What are the established methods for filing and tracking bugs in packages?

My particular concern is in finding Polyglossia's author, Francois Charette, whose email address I could not find in Google. However, I think the issue is much more general. If you encounter a bug in ...
15
votes
1answer
1k views

Creating new class file: Where to start?

Recently, a journal I have some editorial involvement with has decided that for its 'rapid publication' outlet, it will no longer accept submissions where LaTeX has been used to format the document. ...
14
votes
3answers
388 views

Advantages of a custom class over a package and environment

What are the advantages/disadvantages of defining a class over a package and environment? I have recently started to clean up some of the cruft in the preamble of my letters. The simplest solution ...
14
votes
3answers
655 views

LaTeX document without \documentclass

I need to create a really simple document template for other people to fill in and compile (e.g., they need to provide a name and email address). I could distribute it as a .cls file and a template ...
14
votes
3answers
1k views

Macro for Declaring Variables in Class Files

I'm designing a new LaTeX class, and trying to write a convenient helper command for declaring new 'variables' for use in the class. Specifically, say I want to use a variable called \foo. I'd like ...
14
votes
2answers
597 views

Defining a wrapper class for a set of document classes

Until now, I have been collecting my "frequently used packages", custom macros, and configurations in a personal style file. However, some of those configurations depend on the use of one of the ...
14
votes
1answer
146 views

Should I use packages when writing a class

I am trying to write a class based on the book class (a thesis class for my department). My question is: is it bad for some reason (or, is it considered bad) to use packages in the class files ...
14
votes
1answer
748 views

How does “missing \begin{document}” work?

I would like to know how does LaTeX invoke the error Missing \begin{document}. I would like to reproduce it in the sense of the following MWE (it will become a part of my own document class): ...
13
votes
3answers
3k views

Possibility to pass options to packages

I am searching for a possibility to give additional options to another package. I have tried it with \PassOptionsToPackage. My idea was that I can use something like ...
13
votes
3answers
930 views

How can I word-wrap LaTeX warning/error output?

This question led to a new package: hardwrap In writing error messages and warnings for a package/class, I find it a pain to manually insert \MessageBreaks so that words don't get cruelly ...
11
votes
3answers
396 views

When writing a class/package, how can I run code if/when another package is loaded? [duplicate]

I'm writing a thesis class file and I'd like to delay the running of code to after a specific package is loaded: \AtEndOfOtherPackage{listings}{% \lstset{language=Python}} Is there a command that ...
11
votes
1answer
270 views

Is TeX necessary if using LaTeX?

I have been using LaTeX for a little over two years now. I mostly use it to prepare homework solutions in mathematics and engineering coursework. I also use it to document my research and writing some ...
11
votes
2answers
200 views

What is the best practice for arithmetic operations specially for package/class writing?

There are some possibilities to execute arithmetic operations inside a package or class. TeX TeX supports \advance, \multiply or \divide to execute arithmetic operations. However the syntax is more ...
11
votes
1answer
111 views

Processing document class options with l3keys

How can I parse (that is, access) the entire option list given to the current document class with l3keys? This would obviously need some sort of \keys_define:nn { document-class-?? } { default ...
10
votes
2answers
160 views

article wrapper class that locks down some options, passes others through

I'm writing a wrapper document class that starts with article and adds a bunch of customizations (required for a particular journal style). One of the requirements is to lock down certain options: ...
10
votes
1answer
125 views

How do I use l3docstrip?

I've got a bundle I'd like to properly document (and begin to release) that uses expl3 intimately, and it should be documented similarly to expl3 itself (as seen in texdoc interface3. I did a little ...
10
votes
1answer
356 views

Developing a document class using a Writer2LaTeX-generated document as a starting point

Background My university is finally starting to become more LaTeX-aware and has developed and published a document class for theses and memoirs. This class is based on the memoir class and is now ...
10
votes
1answer
1k views

Changing the default options of a document class?

I would like to define some base-class.cls, with some options and their defaults, and then provide some mechanism so that other derived classes can reuse the existing options and change the defaults. ...
9
votes
3answers
202 views

Backward compatibility for command names

I have made a class file. It defines commands for use in document files. I want to change some of the command names, but I also want old document files to work without changing them. Here's an ...
9
votes
1answer
474 views

Write a class with language dependent strings

I am unable to make my class strings language dependent using babel. I have the following minimal example: file test-babel.cls \NeedsTeXFormat{LaTeX2e}[1999/12/01] ...
9
votes
2answers
4k views

How to set default font size in latex cls file?

I am using a custom LaTeX document class for my thesis which is derived from the report class. I'd like to set the default size of the font to 12pt, and still have the option to change it (to 10pt) ...
9
votes
1answer
248 views

How to detect whether “I'm on arXiv.org”?

I write a class. I'm interested in having a different page headers (and eventually make some other small differences) based on whether the class is used on the site arXiv.org or not. Minimal example ...
8
votes
2answers
221 views

Base a class on another class [duplicate]

Possible Duplicate: Defining a wrapper class for a set of document classes When writing a new class (say, journal), how can I base it on an existing class (say, scrbook)?
8
votes
3answers
916 views

How to write a class that accepts an optional key-value pair?

a user-defined class: \ProvidesClass{preview}[2012/12/15 v 0.01 class for creating a tight PSTricks diagram] \DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}} \ProcessOptions\relax ...
8
votes
2answers
549 views

Loading package twice with \RequirePackage causes “option clash”

I thought that loading a package twice with the same options cannot lead to option clash, still I get a clash in the following simple example: \documentclass{article} ...
8
votes
2answers
85 views

How can I prevent LGR encoding from switching font size?

I am using 12pt fonts with what is essentially the article class. (That is, I'm using a custom class which is parasitic on article.cls.) In order to set an appropriate headheight for fancyhdr using ...
8
votes
1answer
1k views

Using of \usetikzlibrary in an expl3 package fails

In the example below I provided a small test package mytestpackage.sty which uses the syntax of expl3. If I use the command \usetikzlibrary inside the package I will get the error: Runaway argument? ...
8
votes
1answer
90 views

How to access \@title from a custom class

I was trying to write a custom LaTeX class where I need to access the value of \@title. I wrote \newcommand{\makeack}{Hello World \@title World} But the value of \@title is not printed when I use ...
8
votes
1answer
903 views

New options and loaded class options bug?

I found some odd behavior that I can't seem to get around. I'm writing a new version of a class file I did a while ago that is based on the memoir class. Now, the memoir class has two mutually ...
8
votes
1answer
82 views

Why are these options passed to \LoadClass ignored?

Consider the following simple example: % === this is simple.tex === \documentclass[paper=a5,pagesize]{scrbook} \usepackage{lipsum} \begin{document} \lipsum{1-10} \end{document} When processing this ...
8
votes
1answer
216 views

Beginner needing help to create simple documentclass for traditional printed Tibetan manuscripts (Pecha)

I am delighted to see how well XeLaTeX can handle Tibetan script and want to use it for the typesetting engine for my software. The first thing I want to do is to create a simple documentclass, ...
8
votes
1answer
83 views

How to use a string in an auxiliary file to update the header?

A document (typical of many) has a header which displays a timestamp in the form of a text string (“25 December 2013”). The timestamp string originates in a file "update" which is loaded with \input. ...
7
votes
2answers
186 views

How to make certain macros defined in document class inaccessible from within an input file using it?

In C#, we can specify certain properties of a class to be private, read only, etc. I want to apply this methodology in writing LaTeX document class if it is possible. I can find articles pertaining ...
7
votes
2answers
166 views

Where can I find definition of starred version of \chapter command to redefine it

General question I need to redefine how starred version of \chapter command (that is \chapter*) works in book class. I found definition of not-starred version of \chapter command in book class: ...