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

learn more… | top users | synonyms

10
votes
1answer
273 views

Porting LaTeX packages to ConTeXt modules

From seeing quite a few questions here, it seems ConTeXt is often able to easily address problems that LaTeX has a hard time with. I'd be willing to give it a try, but there is one package that I ...
5
votes
1answer
126 views

Handle class options in the order they're given

How can I pass options of my package in a specific order to another loaded package? \ProvidesPackage{L10n} \DeclareOption{english}{\PassOptionsToPackage{\CurrentOption}{babel}} ...
6
votes
1answer
791 views

Creating a package of custom-made commands

I tend to use the \mathbb{...} command a lot, so I have made some commands to ease the amount of typing I have to do when I use LaTeX: \newcommand{\R}{\ensuremath{\mathbb{R}}} ...
2
votes
1answer
779 views

Extending the faktor package

I'm writing a script (topic ring theory) where I have to set lots of quotients of algebraic objects. Usually I simply write M/N. However there are some cases where this is no easy to read (M+N/N or ...
12
votes
1answer
301 views

CLI tool to upload to CTAN

This question led to a new package: ctanupload sty2dtx and ctanify are useful tools to prepare clean packages to CTAN. Is there also a tool to upload the package from a terminal?
6
votes
3answers
269 views

How to remove all dashes (-) using a macro?

In a package, I'm building macro names from the values of options passed to a function. Now, the values should also allow a - inside, but the command names I'm building with \csname do not. So, I need ...
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 ...
28
votes
2answers
795 views

Moving to LaTeX3 for package authors

I would like to write a package using as much of LaTeX3 stuff as possible (in particular expl3, xparse and xtemplate). What should I read to learn these? In particular: I know that there are good ...
3
votes
2answers
219 views

Structuring a collection of patches for various classes and packages

I develop a package whose main part consists of fixes and patches to other document classes and packages. Naturally, I only want to apply a patch if the class or package in question has been loaded. ...
25
votes
3answers
3k views

Create a symbol font from SVG symbols

Is it possible to create an own scalable font from a set of symbols (~700), all in SVG format. All of them are symbols (like Zapf Dingbats), so there would be no need for special settings like ...
9
votes
3answers
506 views

Mutually exclusive options in packages

Is there a standard way to define mutually exclusive options in a package? Could someone provide a simple example? Currently I am mostly intrested in LaTeX2e but it would be nice to see a LaTeX3 ...
7
votes
2answers
1k views

Can I specify that I only want the .sty file from a .dtx?

I've been trying to be good and make my proto-packages .dtx files (in particular, the files in the TeX-SX Package but that's not particularly relevant). My workflow goes a bit like this: Hack a few ...
25
votes
5answers
1k views

Side-by-side source and output when documenting a style file

When documenting a style file, it would be nice to be able to easily put side by side different examples of code, side-by-side with the output they produce. What recommendations to people have to do ...
8
votes
1answer
210 views

LaTeX3: \ProcessKeysOptions hangs while processing global (class) option

The code of the trivial package mypkg.sty below defines key draft. If draft is given as a class option, LaTeX hangs at the command \ProcessKeysOptions. This seems to be a bug. Or is there something ...
6
votes
4answers
405 views

Signalling error in “expandable context”

I'm reviewing a few old macros of mine to make them fully expandable. One of the macros takes one argument, which should either be a two-digit or a four-digit integer (>1955). The macro then converts ...
33
votes
1answer
4k views

Test if a package (or package option) is loaded

[french]{babel} (aka frenchb) is incompatible with some other packages, such as tikz, since it tries to insert \thinspace before semi-colons. In order to make these two play nice, you have to call ...
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 ...
15
votes
3answers
3k views

A package template using xkeyval?

I would like to write a package offering a number of commands. The package should accept options, and some of these options should be available as command options. Usage should be as follows: ... ...
3
votes
1answer
1k views

LaTeX doesn't pick up changes to style file

I installed the widetext package and was happily using it until I decided to edit the style file widetext.sty. Happily, LaTeX immediately picked up the changes and compiled correctly. I then decided ...
3
votes
1answer
271 views

`hyperref` weirdness with simple custom package

Trying to retroactively get hyperref working for my thesis. Fun. Encountered the following weirdness... I have the following (hard earned) minimal-ish working example: \documentclass{article} ...
4
votes
2answers
398 views

Defining (optional) data in a class

I'm trying to learn how to write latex classes and am using my resume as a toy example. I am trying to separate style from content as much as possible so I am trying to define data fields such as ...
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 ...
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 ...
28
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
265 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
762 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
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 ...
16
votes
2answers
609 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
149 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: ...
22
votes
2answers
6k 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
1k 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 ...
6
votes
2answers
358 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
225 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 ...
12
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
785 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
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 ...
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 ...
8
votes
2answers
933 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 ...
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?