Questions tagged [documentclass-writing]

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

Filter by
Sorted by
Tagged with
215 votes
6 answers
43k 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 ...
sorush-r's user avatar
  • 2,687
162 votes
7 answers
82k 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?
91 votes
5 answers
46k 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 ...
Justin J Stark's user avatar
72 votes
4 answers
3k 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 ...
Brent.Longborough's user avatar
65 votes
4 answers
14k 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 ...
Alessandro Cuttin's user avatar
60 votes
3 answers
17k 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, ...
mk12's user avatar
  • 1,847
44 votes
1 answer
3k 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 ...
orome's user avatar
  • 10.5k
39 votes
2 answers
863 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, % ...
einpoklum's user avatar
  • 12.3k
39 votes
2 answers
84k views

how to create a template or document class for latex?

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}?
Kayla's user avatar
  • 1,655
36 votes
4 answers
14k 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 ...
tex's user avatar
  • 3,445
32 votes
7 answers
3k 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 ...
29 votes
4 answers
3k views

Creating a class file vs using packages

In my limited LaTeX experience, I've always found that I can accomplish what I want by just using the relevant set of packages, even for more complex formatting. If I were to try and create a ...
Vyas's user avatar
  • 1,385
25 votes
6 answers
3k views

Holiday present-ation vs. content contest

Need something to do during holiday break? Enter this holiday contest! Your challenge is to write a happyholidays class that will compile the following input document in the most creative, ...
musarithmia's user avatar
  • 12.5k
25 votes
3 answers
3k 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, ...
andykee's user avatar
  • 253
25 votes
1 answer
3k 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 ...
Andrew Stacey's user avatar
23 votes
1 answer
10k 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. ...
Johnny Canuck's user avatar
22 votes
1 answer
2k 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), ...
andrea's user avatar
  • 221
21 votes
3 answers
1k 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 ...
Tobi's user avatar
  • 56.3k
21 votes
3 answers
2k 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 ...
John F. Miller's user avatar
18 votes
3 answers
735 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 ...
StrongBad's user avatar
  • 20.5k
18 votes
3 answers
18k 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 \documentclass[hyperref={...
CSchulz's user avatar
  • 1,915
18 votes
1 answer
363 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 ...
Mario S. E.'s user avatar
  • 18.6k
17 votes
3 answers
3k 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 ...
Michael Tingley's user avatar
17 votes
2 answers
1k 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 KOMA-...
lockstep's user avatar
  • 250k
16 votes
2 answers
13k views

Where can I find the article.cls class file of texlive-2016 on my pc?

I want to study the source code of article.cls so I can create macros of my own. If anybody can tell me the location of article.cls document class file, that will be highly appreciated.
Jiapan's user avatar
  • 731
16 votes
1 answer
206 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 ...
Yossi Gil's user avatar
  • 16k
15 votes
2 answers
10k views

ProcessOptions and ProcessKeyvalOptions

\ProcessOptions and \ProcessKeyvalOptions Which comes first? Does it matter? \ProcessOptions\relax or \ProcessOptions* What's the difference? Apparently for keyval there is only the starred version. ...
mk12's user avatar
  • 1,847
15 votes
3 answers
4k 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 \...
kiss my armpit's user avatar
15 votes
1 answer
219 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 ...
nplatis's user avatar
  • 2,090
15 votes
1 answer
2k 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): \...
yo''s user avatar
  • 51.3k
14 votes
3 answers
6k 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 ....
StrongBad's user avatar
  • 20.5k
14 votes
2 answers
22k views

LaTeX "Variables" - \@varname

I'm currently in the process of writing my first document class file (a personalized resume class), and I want to get a better understanding of what exactly I'm doing. So, right now I'm setting up ...
Kevin's user avatar
  • 279
14 votes
3 answers
2k 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 bisected ...
godbyk's user avatar
  • 7,737
14 votes
2 answers
18k 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) ...
user1145885's user avatar
13 votes
7 answers
2k views

Remove leading zeroes from an integer

In the documentclass I am writing, the user will input an integer such as \lessonnumber as an integer with possibly a number of leading zeroes, e.g. 4 as 04. At some places in the document I will need ...
Simon Kuang's user avatar
  • 1,861
13 votes
2 answers
413 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 ...
yo''s user avatar
  • 51.3k
13 votes
1 answer
4k 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. ...
Juan A. Navarro's user avatar
12 votes
1 answer
406 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 ...
Carl Morris's user avatar
12 votes
2 answers
275 views

The following code compiles without error. How can I change that?

Unlike most questions on this site, my problem is that my code compiles without error and I do not want it to. I want to be able the check whether \command is defined and to do something if it is ...
cfr's user avatar
  • 198k
12 votes
2 answers
713 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 ...
Marco Daniel's user avatar
  • 95.7k
12 votes
1 answer
2k 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? ...
Marco Daniel's user avatar
  • 95.7k
12 votes
1 answer
313 views

What happens when a package patches another, and then the original one is reloaded?

I'm in the process of cleaning up my class file and I'm unclear as for the proper order of some lines. For example (replacing \RequirePackage with \usepackage and putting this in a MWE): \...
Miyase's user avatar
  • 2,544
12 votes
2 answers
2k views

What is the difference between \@@par and \par?

In LaTeX internal code I came accross \@@par. How is this different from \par or \newline. When should I use \@@par if I am writing a package or class file? In general, there are so many other ...
RavBell's user avatar
  • 165
11 votes
3 answers
545 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 ...
Sean Allred's user avatar
  • 27.4k
11 votes
2 answers
19k views

How to adjust the size and placement of chapter heading in report class

How could I adjust the size and placement of chapter heading in my custom class? I am using report class as my base. When I used titlesec package inside my custom class, it threw error ! Package ...
tex's user avatar
  • 3,445
11 votes
1 answer
1k views

\PassOptionsToClass does not work

I am trying to create my own class, inheriting from extarticle. I want to still be able to use the options of this class, so I found a way to do it in most of the docs I read : \DeclareOption*{\...
Sylver's user avatar
  • 254
11 votes
3 answers
1k views

When/How should a class load biblatex

I would like to write a custom class that loads the biblatex package, but I am having trouble with option clashes. For example, the following MWE gives me an error % arara: pdflatex % arara: biber % ...
StrongBad's user avatar
  • 20.5k
11 votes
1 answer
2k 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] \ProvidesPackage{test-babel}[2012/...
TeXtnik's user avatar
  • 5,843
11 votes
1 answer
1k views

What is the minimal codes to create my own \documentclass derived from LaTeX's book?

I want to invoke my document class as follows: \documentclass[cymk,dvips,dvipsnames]{mybook} Internally mybook.cls includes my own packages such as mytables.sty, mypstricks.sty, etc. What is the ...
Display Name's user avatar
  • 46.9k
11 votes
1 answer
647 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 ....
Sean Allred's user avatar
  • 27.4k

1
2 3 4 5
10