8

Preamble

I recently started the "custom package writing" path, which at first I found very interesting because it helped me to define standard callings of packages/commands that would have occupied thousands of lines of preamble code.

Main Question

The first lines of code written inside any pkgname.sty file should be the following:

% This is my first package.
% 
% (c) <authorname>
% LPPL LaTeX Public Project License
% 
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{<pkgname>}[yyyy/mm/dd Custom Package]
%

Following the instructions, I created and inserted correctly the package inside the C:\Local TeX Files\tex\latex\custompkgs folder synchronized with MiKTeX 2.9. The problem arose when I tried to define the package name, knowing that it could be anything I wanted, because observing other package names I found some defined, sistematic events.

Packages whose name is written with:

  • More than one uppercase letter
  • Normal letters but more than three numbers
  • More than two words separated by a white space

are extremely rare.

From this data, I certainly won't name my package Super Duper Cool pkg.sty in the first place, because I have good taste and because it seems that there are certain rules that have to be applied in order to obtain the results observed above.

From the references I haven't found any link to this strange behaviour on package names; although I think that these rules have to be written somewhere, I couldn't find them. Is it true that package names in fact do follow a specific formatting rule?

References

1 Answer 1

9

Package names (almost) have to be filenames, and at the time conventions for LaTeX2e were formed it was important for portability that filenames were legal on MSDOS (or, if you prefer, ISO format CDs). That is, they had to work on case insensitive filesystems with at most 8 letters for the base name. The fact that I was using sunos at the time and called longtable longtable with 9 letters caused no end of pain. That is why you see packages with compressed names like fancyhdr or multicol.

These days the 8 letter restriction is not there in any real sense, but avoiding mixed case is probably a good idea as it is always a good idea to avoid spaces in filenames, even though that probably works as well.

8
  • Interesting... Basically there is a (I'd say old-new habit) correlation between filenames formatting and package names; for example there will be no errors if <pkgname>=LyXbasic.
    – TheVal
    Commented Oct 13, 2013 at 11:50
  • @AndreaL. That is correct. Commented Oct 13, 2013 at 12:09
  • Well, thanks for your answer, I now solved one of my not-causing-imminent-death (La)TeXing problems; maybe we'll see again on the next one...
    – TheVal
    Commented Oct 13, 2013 at 12:11
  • 3
    A good source of confusion are case insensitive file systems; we often see things like \documentclass{Book} or \usepackage[English]{babel} that work if the file system is case insensitive, but are bound to failure if the file is used with another system
    – egreg
    Commented Oct 13, 2013 at 12:51
  • @egreg that was really the main motivation for \ProvidesClass{book} so you do get a warning if you use Book Commented Oct 13, 2013 at 13:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .