# How to write a LaTeX package that bundles not only .sty and .cls files but also some logos in .pdf or .eps formats?

I would like to make a LaTeX package with the following subdirs:

• tex/latex/common (a common .tex file shared among beamer and letter)
• tex/latex/resources (lots of pdf and eps files with graphical resources)
• tex/latex/mybeamer (a custom beamer theme with 5 .sty files)
• tex/latex/myletter (a .cls file for a letter template)

I would like to package these files into a single LaTeX package that users could install in an easy way. I read about the .ins and .dtx files and I can see how to pack the .sty and .cls files but what about the extra graphics - the resources folder which contains several PDF and .eps files?

-
Welcome to TeX.sx! I am using ctanify. Here you can see my makefile: github.com/marcodaniel/mdframed/blob/master/Makefile#L222 –  Marco Daniel Apr 12 '13 at 10:44
Depends exactly what you want to do. As .eps files are ASCII, you can include them in a .dtx (I do in chemstyle, for example). –  Joseph Wright Apr 12 '13 at 10:49
If you look at the beamer core, you'll see it's subdivided within tex/latex/beamer, but that is because there are lots of files. You don't necessarily need to do that for a smaller bundle. –  Joseph Wright Apr 12 '13 at 11:26

## TDS structure

Assuming your LaTeX package is called foobar. Then according to TDS (A Directory Structure for TeX files) the files would go below the following Directories:

• TDS:tex/latex/foobar/ (for TeX files: .tex, .sty, images)
• TDS:doc/latex/foobar/ (for documentation files)
• TDS:source/latex/foobar/ (for source files .dtx, .ins)

Further subdirectories are up to you. I would avoid them, if there are few files only. If there are many files, then further directory levels might help to organize the files.

Example:

• TDS:doc/latex/foobar/foobar.pdf
• TDS:source/latex/foobar/foobar.dtx
• TDS:source/latex/foobar/foobar.ins
• Other source files that are not provided in the .dtx file can be given in:
TDS:source/latex/foobar/ or
TDS:source/latex/foobar/resources/
• TDS:tex/latex/foobar/foobar.cls
• TDS:tex/latex/foobar/foobar-common.sty (The TeX file for the letter class and beamer templates)
• TDS:tex/latex/foobar/<foobar beamer file 1>,
TDS:tex/latex/foobar/<foobar beamer file 2>,
...,
TDS:tex/latex/foobar/<foobar beamer file 5>
• TDS:tex/latex/foobar/resources/<.eps/.pdf image files>

If you additionally provide a README file, then I would use this name exactly (AFAIK CTAN convention) and put it in the doc or source subtree, depending on the contents of the file.

## Distribution form

For the distribution I would put these files including the directory structure in a .zip file foobar.tds.zip (without the TDS:/temxf root). Then the installation is quite easy for the user, who can easily install by unzipping. Installation example for default home tree in Linux/TeX Live:

\$ unzip foobar.tds.zip -d ~/texmf/

In case the package is installed in a system wide local texmf tree, the file name database needs to be updated (under root):

\$ texhash

or

\$ mktexlsr

## CTAN

A suggestion for the CTAN form, if you want to provide it there:

• CTAN:macros/latex/foobar/foobar.dtx
• CTAN:macros/latex/foobar/foobar.ins
• CTAN:macros/latex/foobar/foobar.pdf (documentation)
• CTAN:macros/latex/foobar/resources.zip (or unzipped in directory resources/)
• CTAN:install/macros/latex/foobar.tds.zip
-
Hi, I tried to zip a TDS folder with zip foo.tds.zip foo, where foo has the TDS sub directories, and got foo.tds.zip. But when I unzip this to the TEXMF-tree I get TEXMF/foo/…, i.e. the files aren’t out in the existing sub directories of TEXMF/. What’s wrong here? –  Tobi May 10 at 14:43
@Tobi: cd foo and then zip ../foo.tds.zip *. –  Heiko Oberdiek May 10 at 14:44
Thanks, I had to add -r to make it work. Now everything is installed as desired but with \includegraphics{img} I can’t access the file stored in TEXMF/generic/images/foo/img.pdf isn’t that part of LaTeXs search scope? (It’s what @MatthewLeingang suggested.) –  Tobi May 10 at 15:39
Oops … it was my fault. I missed the tex/ in the path :-) –  Tobi May 10 at 16:24

In the TeX Directory Structure (TDS) the directory names under tex/latex are a global shared resource so you need to not take too many and choose names that are unique to your package. So tex/latex/resources and tex/latex/common would not be good names (and I suspect wouldn't be accepted if you were to try to get the package included into a distribution such as texlive).

beamer and letter both share the same input path for tex files so there is no need to separate your beamer and letter files.

-
Yes. I agree - I will fix the folder names and make them quite unique to avoid any clashes with other packages. –  remus Apr 12 '13 at 11:09

Here is the TeX Directory Structure way. Pick a name for your bundle.

• Put TeX files that could be used in any format in tex/generic/bundlename
• Put LaTeX files like classes and packages in tex/latex/bundlename
• Put graphics resources in tex/generic/images/bundlename
• Put documentation in doc/latex/bundlename
• Put docstrip sources in source/latex/bundlename

You'll see a lot of these in use if you look inside, for instance, the pgf distribution. Then the install process is just to cp -R the directories into a texmf tree.

-