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

learn more… | top users | synonyms

79
votes
2answers
9k 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 ...
68
votes
6answers
17k 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?
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 ...
44
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 ...
53
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 ...
21
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 ...
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 ...
17
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 ...
25
votes
1answer
573 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
2k views

What does \z@ do?

in parcolumns it has \z@ all over the space. I don't see it define it anywhere so I assume it is some internal command or something? I can't really make heads or tails of it though and I can't really ...
28
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 ...
25
votes
1answer
2k 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 ...
13
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
941 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 ...
15
votes
1answer
219 views

What are best practices for package authors to deal with package conflicts?

One occasionally encountered problem with LaTeX is incompatibility between packages. What are best practices for package authors to deal with package conflicts? For example: What is the best way to ...
27
votes
2answers
726 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 ...
20
votes
1answer
1k 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 ...
25
votes
4answers
500 views

Any suggestions/requests for features for a new package that allows disabling ligatures for (pre)selected words?

I'm starting to put together a LaTeX package, which I hope to distribute broadly, that provides lualatex code to disable ligation of character pairs and triplets for selected words (globally within ...
21
votes
1answer
465 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), ...
19
votes
1answer
271 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 ...
7
votes
1answer
118 views

What are the pros and cons of packages versus \input for a preamble?

For a some simple cases it seems to me that there would be no important difference between putting some code in a file preamble.tex and having \input{preamble.tex} in the main .tex file putting it ...
36
votes
3answers
2k views

Is it really bad to use \makeatletter and \makeatother in a package or class file?

In my answer to this question What do \makeatletter and \makeatother do? I apparently wrote: The commands should not be used within .sty and .cls files themselves as they may conflict with the ...
7
votes
2answers
237 views

Emulate a “tuple” data structure (when you are free to choose the syntax)

How can a "tuple" data structure be implemented in LaTeX? The idea is to store several elements (possibly a predefined number) in one macro and then be able to extract each of these elements by index ...
30
votes
2answers
1k views

TeX assistance in writing hidden acrostics

Here's a fun challenge. Try to come up with (and code) techniques through which (La)TeX can help authors to incorporate acrostics in their writing. The definition from Wikipedia: An acrostic is a ...
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 ...
20
votes
1answer
447 views

How would one design a math font?

There are (some very nice) text fonts which do not have math support. Though there are ways to 'remedy' this, such as the mathastext package and some others, these are hardly satisfactory. All accents ...
21
votes
1answer
722 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 ...
16
votes
2answers
546 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 ...
23
votes
3answers
553 views

When is it better to use \par than \endgraf?

Just yesterday I had to patch a package file (changing the description to indicate that the file had changed) to replace some \par to \endgraf because the code had bad interactions with non-\long ...
13
votes
2answers
750 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 ...
10
votes
1answer
611 views

How to extend the \lstinputlisting command

With the answer from autogobble for lstinputlistings I've managed to create a command that gobbles \lstinputlisting and makes firstnumber to start by firstline. I would like to rewrite it as a ...
13
votes
1answer
193 views

Dos and Don'ts of \countdef\mycount=<number> and \newcount vs \newcounter{} in LaTeX

Let's clarify that countdef\mycount=<number> is a bad idea in LaTeX, then clarify appropriate usage of \newcount\mycount vs \newcounter{mycount} in LaTeX. Background: I only started with TeX ...
12
votes
1answer
279 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?
7
votes
1answer
368 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 ...
18
votes
3answers
985 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, ...
12
votes
3answers
146 views

Executing a command after a package has been loaded

In my previous question I ended up with \DeclareMathSymbol{:}{\mathpunct}{operators}{"3A} But now I'm using the fontspec package which redefines : with \AtBeginDocument itself. So as my own ...
8
votes
2answers
211 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 ...
4
votes
1answer
148 views

How to count the number of authors of a document?

I need to make a change to a Latex style (.sty) which contains the following line: {\large {\boldCondensed\color{corporate3Color}\raggedright AUTHORS: \MakeUppercase \@author\par}} The problem is ...
4
votes
1answer
78 views

Spaces in pfgopts options

Is there a simple way to allow spaces in the options of a package using pgfopts to process them, which is local to that package i.e. I don't have to include some package in the main document before ...
35
votes
4answers
2k views

Has the time come for a LaTeX3 successor to 'listings'?

I'm currently looking for a nice and challenging open-source project to work/collaborate on after my thesis. I don't have a Comp. Sci. background, but I'd like to learn more about compiler ...
14
votes
1answer
465 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 ...
24
votes
1answer
306 views

Wrote a new package. Is there some standard place to share?

So I finished writing my package for typesetting Begriffsschrift. I think it marks a marked improvement over the package begriff, which is the only other package for the same purpose, that I can find ...
12
votes
5answers
384 views

Parsing hexadecimal numbers to binary and iterating over bits

I'm currently working on a software for an graphic display, so I recreated it in TikZ for documentation purposes: I currently use this to set individual pixels on the display: \setpixel{x}{y} ...
4
votes
4answers
258 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 ...
20
votes
2answers
483 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 ...
8
votes
2answers
828 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 ...
17
votes
1answer
594 views

How to write overlay-specification–aware macros that work w/o the beamer class

The LaTeX beamer class provides with \newcommand<> and \newenvironment<> an interface to define own commands that can deal with beamer's overlay specifications. Internally, commands ...
14
votes
1answer
679 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. ...
13
votes
3answers
885 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
2answers
156 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 ...