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

learn more… | top users | synonyms

3
votes
1answer
42 views

Checking the mainmatter

I need to check where the text (from package .sty), if it is in the mainmatter section, then include some headers \pagestyle{LL}, if the other then \pagestyle{plain} or some other. Construction ...
4
votes
1answer
35 views

Macro call from options declaring part of the package

I need to call my macro inside DeclareOption, but my macro is defined later (this is the main condition). \NeedsTeXFormat{LaTeX2e}[1994/06/01] \ProvidesPackage{MyBook}[2014/12/12] ...
3
votes
1answer
35 views

How to include package by some condition in custom package

I have my custom made package. I need to include (or activate) other package by some condition. \NeedsTeXFormat{LaTeX2e}[1994/06/01] \ProvidesPackage{MyPackage}[2005/01/22] ...
2
votes
1answer
33 views

Converting preamble file to the package .sty-file

I have a preamble.tex file which I use for my purposes in different documents. %description: Basic Article in Cyrilics % Based on a TeXnicCenter-Template by Gyorgy SZEIDL. ...
2
votes
1answer
47 views

Using Babel inside my own package produces option-clash error

I want to write my own package which provides an \affidavit command which produces some standard text in two languages (ngerman and english). Minimal working example of this package: ...
6
votes
1answer
54 views

Package versioning and backward compatibility

The third major curse of computer programming is backward compatibility. You have to fix bugs which will unavoidably be found. Some syntax is not really a good idea, and has to be modified to be less ...
2
votes
0answers
35 views

Creating an .sty file that is equivalent to \input{file}?

I'm trying to get the flashcard program Anki to accept my LaTeX shortcuts that I always include in the preamble through \input{...}. It seems like the software has now forbidden this practice as you ...
14
votes
1answer
208 views

What is the recommended way to respond to bug reports for font packages where the bug is caused by characters missing from fonts?

I received a bug report for ebgaramond-maths. Although the issue is clearly caused by my package in one sense, it is not clear to me whether there is anything which I should do about it beyond ...
18
votes
2answers
845 views

Kleinberg-Tardos style of book writing

I recently read a book Algorithm Design by Jon Kleinberg and Eva Tardos, which is written in a very unique style. This book doesn't have any typical LaTeX environments such as theorem, lemma, and ...
2
votes
1answer
36 views

Package Keyval Error: allcolors undefined

I am using the following template for writing a document in Latex but i am getting an error Package Keyval Error: allcolors undefined.. ...
4
votes
1answer
69 views

How to create a a package that can be installed by tlmgr?

I want to be able to use a proprietary font on a number of Linux machines for which TeXLive is installed locally (not through the package manager). I have followed How do I use TrueType Fonts with ...
1
vote
0answers
19 views

Where do I put custom packages in a directory structure for a large document? [duplicate]

I am writing a large document (thesis proposal) that I would like to break into separate files, with the following directory structure: . |-- ch/ | |-- chapter1.tex | |-- chapter2.tex | |-- ...
29
votes
2answers
249 views

How do I gracefully retire a package?

I maintain a LaTeX package which is obsolete. All its useful commands are provided by other packages, possibly with different syntax, but still the point is there is no reason for anyone to use my ...
3
votes
1answer
43 views

Something wrong with subscript code in sty file

Consider the following .sty file: % Den krævede LaTeX-version. \NeedsTeXFormat{LaTeX2e}[2014/05/01] % Pakkens navn. \ProvidesPackage{standardopsaetning}[2014/10/16 standardopsaetning] ...
3
votes
2answers
52 views

Command not 'legale' in .sty file

Consider the following style file goat.sty: \NeedsTeXFormat{LaTeX2e}[2014/05/01] \ProvidesPackage{goat}[2014/10/16 goat] \DeclareOption{mammalbirdfish}{ \makeatletter \begingroup ...
8
votes
2answers
85 views

How can I prevent LGR encoding from switching font size?

I am using 12pt fonts with what is essentially the article class. (That is, I'm using a custom class which is parasitic on article.cls.) In order to set an appropriate headheight for fancyhdr using ...
4
votes
1answer
35 views

Declare package options and loading packages leads to “options section” error

I'm trying to create a package with some options. However, whenever I declare options and load other packages, I receive the following error: LaTeX Error: \RequirePackage or \LoadClass in Options ...
3
votes
1answer
42 views

Add newcommands to a package with arguments

I want to make a package that has a bunch of commands that I define in all of my Problem Sets. I'm running into an issue where the compiler does not recognize commands that I define that have an ...
5
votes
1answer
68 views

In a package or parasitic class, when is it better to redefine a command and when is it better to define a new one?

When I'm working on a document for which I need special layout, I tend initially to accumulate a very long preamble. At some point, if I need to reuse similar layout regularly, I decide that I really ...
3
votes
1answer
84 views

\usepackage for \newenvironment

I am trying to create a package called lessonPlanner in which I declare some new environments via \newenvironment So I have something like ... mwe.tex \usepackage{lessonPlanner} \begin{document} ...
3
votes
0answers
29 views

How can solides3d know when one object is behind another?

pst-solides3d has an impressive graphics engine behind its design. I'm interested in knowing how it is able to know when an object is behind another object. Disclaimer: I am not sure this is an ...
0
votes
0answers
60 views

ComplexTable of Contents

Id like to create a table structure within my document based upon a \newlesson command for example. \newcommand{\newlesson}[1]{ \newpage \addtocounter{LessonNumber}{1}\subsubsection{{Lesson ...
7
votes
0answers
58 views

Determine File Name and Line Number Where a Macro is Invoked From

Wondering if there is any way to print out (for debugging purposes) the file name and the line number from where a macro is invoked (not where it is defined). My attempt to use the currfile package ...
3
votes
1answer
118 views

\usepackage's phantom \ifnum [duplicate]

So I'm trying my hand at creating some packages (on WriteLaTeX, because my Surface can't run TeX1), and have run into a rather fascinating problem. My packages just won't load; they complain about ...
16
votes
1answer
214 views

Write a package that is aware of the mainlanguage selected in babel or polyglossia

How can I make my package aware of the language choosen with babel or polyglossia, so that some auto-generated strings can be generated in respect to the current language? As an example, I have a ...
10
votes
0answers
102 views

Customizing names of auxiliary file: safe practices?

I maintain a package (morewrites) which requires a temporary auxiliary file to function (written and read right away). This auxiliary file is currently named \jobname.mw, and a user has asked me to ...
5
votes
1answer
56 views

Having multiple contradictory options, how to handle them?

Lets say you are writing a package, which has the usual pair of draft and final-mode. But how should I handle, if this package gets the global option final and the local draft? Consider the ...
2
votes
2answers
166 views

Strange errors while writing a package

This short document: \documentclass[a4paper]{report} \usepackage{gnu} \begin{document} \end{document} with the following package: %!TEX encoding = UTF-8 Unicode \def\fileversion{2.7} ...
0
votes
0answers
17 views

Testing if XeTeX is being used [duplicate]

I'm writing a package. One of its options is supposed to do some font selection. However, the commands it uses are XeTeX-specific, as far as I know: \newfontfamily, \setromanfont and so forth. So I ...
1
vote
1answer
53 views

Trouble with using Biblatex with self-made package for my thesis

I have been working on a package in which to place all layout codes for my thesis. Here I also define the Biblatex codes. I am, however, having some trouble with getting biblatex to function properly. ...
2
votes
0answers
34 views

How to display the dates in the \PrintChanges' changes?

An information I'm often missing when I have a look at the "Change History" of a package/classe is the dates of the changes because, IMHO, just the version number is not informative enough: if I could ...
2
votes
1answer
58 views

Is it possible to collect hyperref's \hypersetup argument?

Suppose you want to set, in a .sty or .cls file, some hyperref's options in case the end user loads this package. Because that's only at the begin of the document you know if hyperref has been loaded, ...
2
votes
0answers
43 views

Preventing automatic Hy@writebookmark in \addcontentsline

As a result of my (yet to be published ;-) package with questions and solutions I came across some problems, that are connected to sectioning of a document, say, a book with ...
6
votes
2answers
143 views

Creating a custom character that automatically adjusts size in math mode? [duplicate]

After a lot of searching, I finally found the .pdf's for the elusive Griffiths script r character used in his ubiquitous undergraduate electrodynamics book. I made a simple package that allows me to ...
4
votes
2answers
94 views

Generate file write handles on the fly

I am experimenting a little bit with automatic generation of file handles via \newwrite. I want to achieve following behaviour: A user provides a list of file categories, for example Hints, ...
6
votes
2answers
100 views

Keyvalue argument and non key argument conflict

Many classes provide \part, \chapter, \section and even more deeply nested sectioning levels. All of them allow three forms of usage (I restrict for sake of simplicity to \section, it just stands ...
3
votes
1answer
66 views

Issue with custom styles

I am in the middle of writing a much needed report template and have hit more than a wall and cannot seem to figure out why some of the macros aren't loading. The two main files are massive and I ...
3
votes
1answer
30 views

How can I control which file errors are reported in?

Here is a class that can generate errors in two ways. It yields an error unless given one of two options, and also it has a command that always yields an error. \NeedsTeXFormat{LaTeX2e} ...
6
votes
1answer
258 views

'Unknown option' for my own package

I create a package: one common file that includes others. In common package file (russian_post.sty) I define options: \DeclareOption{times}{\@seriffalse} \DeclareOption{landscape}{\@lscapetrue} ...
4
votes
1answer
51 views

How to make a package to ignore parameters it doesn't know when loading in a class?

I'm defining a class that extends article that loads a package inside (automultiplechoice). I'm trying to configure the package and the class using the parameters of the \documentclass command. When ...
5
votes
1answer
192 views

Splitting a huge `.tex` file to chapter files on TeX/LaTeX level [closed]

Inspired by (although a possible duplicate) Outputting each chapter of a LaTeX document to a separate PDF, I wonder whether there is a possibility to extract the chapter (or whatever sectioning level) ...
7
votes
1answer
117 views

Splitting a CSV list from a xkeyval key argument into parts

Is it possible to store the key value argument (a cvs list) to a macro (via \def) and split/further process the content of that macro with \forcsvlist command from etoolbox package? I want to ...
7
votes
1answer
91 views

Conflict between verbatim.sty and ltxdoc.cls

I am writing a package which uses the verbatim package. \RequirePackage{verbatim} For the documentation I'm using the ltxdoc class. So I have to put an % character before every line of the ...
4
votes
1answer
90 views

Create a package with optional mode and key values

I'm trying to create a package with three options as follows: \usepackage[swpl]{mypack} swpl option provides the environment \begin{myexample}[forced bracketed options]...\end{myexample} ...
3
votes
0answers
53 views

Legal concerns in using/modifying/releasing codes [closed]

In order to meet my needs, I copied 2+62 lines from a .sty file available from the Internet, and removed 10 lines, and added 12+18 lines of codes, resulting in a total of 84 lines in a new .sty file. ...
1
vote
1answer
107 views

Strange error with `thmtools` styling in a package

I'm writing a package. Here is a part of it which should be enough for people to try reproducing my problem: %[…] \ProvidesPackage{mworks} %[…] \RequirePackage{amsmath,amssymb,amsfonts,nicefrac} ...
2
votes
2answers
2k views

LaTeX Error: \mathbb allowed only in math mode.

I'm writing a package which, among other things, gives abbreviations for \mathbb, as follows: \newcommand{\A}{\mathbb A} \def\B{\mathbb B} \def\C{\mathbb C} \newcommand{\D}{\mathbb D} ...
3
votes
1answer
59 views

Package option won't do what it has to

I'm writing a package but I'm having a little trouble. Right now, the package goes: %!TEX encoding = UTF-8 Unicode \def\fileversion{0.2} \def\filedate{% Mon 2014-04-01 } ...
4
votes
0answers
35 views

Is there a good reason to define helper macros second? [duplicate]

As a mathematician, my training is to define my terms before I use them. As a computer programmer, I recognize that there are sometimes good reasons to call a method/function/procedure before its full ...
11
votes
1answer
165 views

Storing environment arguments by \immediate\write

As I have stated already in other questions I am writing a problem/solution package. There are many of them, for sure, I have made much progress, using it in 'everydays' productivity for my needs, but ...