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

learn more… | top users | synonyms

66
votes
5answers
1k views

How do package authors find the time?

Not sure if this question belongs here, on the main site, or not on TeX.SX at all. Let me know if it belongs somewhere else. I have recently made some leaps in my knowledge of LaTeX, in particular ...
4
votes
2answers
135 views

Recreate the conditions of the document preamble while loading a file in the document body

While in the document body I like to temporary switch back to the mode active in the LaTeX preamble, i.e. spaces between macros should be ignored. I don't mind whether I get the ! LaTeX Error: Missing ...
8
votes
1answer
485 views

Do any of the LaTeX variants support namespaces?

The scenario is that I'm writing a book and it looks like I'm going to need to do some munging as the document class Memoir has some wonderful features but Octavio has the presentation. Now, one of ...
17
votes
2answers
521 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 ...
3
votes
1answer
970 views

\RequirePackage without option clashes because of the package loading order?

I am writing a package which requires the xcolor package with table option. It is loaded in the package with \PassOptionsToPackage{table}{xcolor} \RequirePackage{xcolor} which works if my package ...
6
votes
1answer
546 views

Argument of setkeys

My motivation bases on the package listings (also my package mdframed). The package allows to define a style via \lstset{foo}{options}. Now I want to create a macro to expand the style foo. For ...
14
votes
2answers
270 views

Write to /dev/null?

I'm working on package that (among other things) writes an external file during compilation. I'd like to provide an option to the package to not write the external file. I know I can set up a ...
32
votes
1answer
4k views

How do I create a LaTeX package?

I would like to jump into the cold waters of LaTeX package creation, mostly for procrastination reasons...but I haven't a clue how to start. For example, a previous question of mine got some nice ...
14
votes
1answer
489 views

Automatic linking (aka code highlight) in Till Tantau's `codeexample`

I am writing docs for a tikz-based package, and I am trying to reuse Till Tantau's codeexample environment to output source code along with its output. However, I cannot manage to get syntax ...
4
votes
1answer
570 views

Create package with C/C++

How can I build a new LaTeX package written in C or C++? I'd like to add some new commands to LaTeX, but LaTeX is not for advanced programming, so I should write my commands in another language.
9
votes
2answers
221 views

Is it possible to abort loading a package if it's too old?

I'm working on a package that has to work on both TeXlive 2009 (Ubuntu, so updating TeXlive is a nonstarter) and later versions, and I'd like to be able to use fontspec with LuaLaTeX if we're on ...
7
votes
1answer
391 views

Disabling the draft option in a package

Within a package I'm making, I want ignore the default draft behavior and write my own. I have tried: \DeclareOption{draft}{ MYCOMMANDS ... \OptionNotUsed } \ProcessOptions If draft is used, my ...
8
votes
1answer
197 views

How to place a # character in a message?

How can I place a # symbol inside of a \PackageWarning inside of a macro definition? I tried: \PackageWarning{package}{# or \# or \string# or \hash} but either ## or unknown (for \hash) or Illegal ...
20
votes
2answers
504 views

What is the gold standard of package documentation?

When writing documentation for a package aimed at CTAN, what should every manual contain? Specific examples of concise yet complete documentation are valued. This is one of those (hopefully) big list ...
10
votes
2answers
344 views

How to specify an optional final argument with \newcommand?

I'm writing my first package, and I'm trying to work out how to create a new command with an optional final argument. In this instance, if an argument is omitted, it defaults to blank. This is ...
22
votes
1answer
2k views

tutorial for making tikz/pgf library

I am very impressed with the tikz/pgf libraries created by this community at http://launchpad.net/tex-sx. I would like to create my own too, but don't know where to start. I have tried to reverse ...
6
votes
3answers
132 views

Class/package for German documentation

I’m writing the musuos class and I’m writing the documentation with ltxdoc.cls and doc.sty which seems to work. But the documentation is in German so it’s not very nice to get (environment) in the ...
11
votes
2answers
252 views

hyperref causes problem with doc.sty

Try the following code. Without hyperref everything is fine and there’s the right entry in the index. With hyperref this entry disappears. (The codeline entries which are not shown here ar not touched ...
14
votes
2answers
351 views

Multiple documents from a single dtx

The DTX format allows to generate both the package code (.sty file) and documentation (.pdf file) from a single dtx file. Is it possible to generate several PDFs (for example for different languages) ...
10
votes
1answer
268 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
121 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
681 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
671 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
286 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
264 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 ...
54
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
746 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
212 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. ...
24
votes
2answers
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
462 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 ...
21
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
200 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
353 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 ...
32
votes
1answer
3k 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
198 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 ...
14
votes
3answers
2k 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
263 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
391 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
772 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 ...
86
votes
2answers
10k 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 ...
26
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
260 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
668 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
568 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: ...
19
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
895 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 ...