{package-writing} is about writing packages. If your question is about choosing, installing, or using packages, choose {package} instead.

learn more… | top users | synonyms

86
votes
2answers
11k 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 ...
27
votes
1answer
3k views

How can I make a package that accepts an optional argument?

I am writing a package that has a bunch of values that are going to be the same most of the time, but that I might want to change in select cases. I want to do this by giving this package an optional ...
4
votes
4answers
261 views

Is it feasible to create a standalone package for fonts / styles / layouts?

For many of my recent documents, I have started using a rather specific set of packages, settings, fonts and configuration. In one rare case, I even adapted one of the included fonts (in my opinion ...
9
votes
2answers
677 views

How do I detect the options passed to the documentclass from my own style?

In the listings package, they note that "a global \documentclass-option draft is recognized, so you don’t need to repeat it as a package option" I tried looking into its source to see how it ...
15
votes
1answer
182 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 ...
16
votes
2answers
571 views

How does one publish/promote a new package?

I just took all the wonderful information supplied here, and wrote a small package that makes it possible to use Unicode characters for section, subsection, subsubsection, paragraph, subparagraph and ...
5
votes
1answer
146 views

Is using `\input{}` in a user defined package to partition it into smaller ones a correct way?

I am writing my own package called mylisting.sty to format code inclusion for languanges: LaTeX, PSTricks, C#, and XML. To maintain mylisting.sty cleaner, I make a separate file for each language: ...
20
votes
2answers
5k views

Make your own .sty files

Sorry to start a subjective question, but want to understand "own.sty" file. Other than all \usepackage{} what sort of other commands can be added to the makeyourown.sty file. Can you include \let ...
4
votes
1answer
906 views

Use \newcommand with a variable inside a style file

I have the following code which I put inside the preamble of my LaTeX documents: \newcommand{\modulecode}{SESG6025} \newcommand{\lecturetitle}{Interpolation} In this case, that means that when I'm ...
5
votes
2answers
341 views

Processing the body of an environment multiple times

Dear all, I am new to package writing (LaTeX2e) and to this forum, and I probably read to much of the TeXBook and not enough on LaTeX. My package works, except that verbatim is verboten. Given a user ...
6
votes
1answer
217 views

When writing a user defined package, how can I decide whether the \documentclass using it is book or article?

I want to write my own package as a collection of other packages I often use. Some declarations in my package only work for book, some for article, and the remaining work for both. In (La)TeX, how ...
11
votes
2answers
2k views

How do I declare an option that takes an input value?

I know I can declare and execute an option for my package using \DeclareOption{myoption}{\typeout{I did it!}} \ProcessOptions but now I'd like to give the option a value: ...
13
votes
2answers
764 views

Multilingual class/style file?

I'm writing some templates and class files that need to use some strings of text, say names for theorems, lemmas, etc., and I would like to provide the ability to easily switch the language in which ...
13
votes
3answers
909 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 ...
46
votes
4answers
5k 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 ...
8
votes
2answers
874 views

Using non-ASCII characters in packages

What is the best way to use non-ASCII (say, Cyrillic) characters in a .sty file? If it's used in a LaTeX file that uses \inputenc[utf8]{inputenc}, than one can just use utf8 encoding in the .sty file ...
73
votes
6answers
19k 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?