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

learn more… | top users | synonyms

16
votes
1answer
157 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 ...
6
votes
0answers
54 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 ...
4
votes
1answer
48 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
127 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
35 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. ...
0
votes
0answers
34 views

is there a synonyms package in LaTex (something like MS Word right-click option) or in TexStudio editor? [closed]

This is probably very simple, but I was wondering if there is a synonyms package I can use to replicate what I used to use in MS Word to find synonyms (ie., right-clik option). I normally use WordWeb ...
2
votes
0answers
23 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
30 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
26 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
111 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
74 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, ...
5
votes
2answers
82 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
54 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 ...
0
votes
0answers
91 views

interference listings styles in tcolorbox

I'm trying to create a package to encapsulate pstricks examples using tcolorbox and showexpl. Defined a new environment PSTexample and style for listings (mystyle) that does not interfere with ...
3
votes
1answer
29 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
132 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
43 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
160 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) ...
6
votes
1answer
91 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
70 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
81 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
52 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
644 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
50 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 ...
10
votes
1answer
130 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 ...
1
vote
1answer
143 views

Help to change svg package to include a 600dpi pdf instead of creating huge pdf with vector graphic. (Downgrade PDF)

I am using the svg package to include an svg file with transparent 3D graphic and latex code to be set at the right label positions. I tried many different methods to do that (matlab->eps+tex file) ...
11
votes
3answers
380 views

When writing a class/package, how can I run code if/when another package is loaded? [duplicate]

I'm writing a thesis class file and I'd like to delay the running of code to after a specific package is loaded: \AtEndOfOtherPackage{listings}{% \lstset{language=Python}} Is there a command that ...
3
votes
1answer
90 views

Generate .1 files from MetaUML .mp files automatically with latexmk

I'm currently creating a personal LaTeX package and base .tex document that I can use to typeset my Computer Science reports at my university. One of the features I would like to have is to make UML ...
9
votes
3answers
157 views

How to make or add options for packages or functions

I'm using at this moment the Piano Package. This Package is a little limited so I want to change a few things. The standard color of the dots is orange. I want to change this in different situations. ...
5
votes
1answer
47 views

Why does compiling this .dtx produce a blank page at the beginning?

This is my first time using docstrip. I've written the attempt.dtx file shown below. However, if I compile attempt.dtx using pdflatex attempt.dtx the generated documentation starts by a blank page ...
2
votes
1answer
69 views

Changing Font Size globally via package

I'd like to write a package that performs the following tasks (it's essentially reformatting the document to make it suitable for being printed 2-pages-side-by-side on a printer): - adjust the margins ...
8
votes
0answers
170 views

Why should \lst@definelanguage be preferred over \lstdefinelanguage in a style file? [closed]

The listings manual (v1.5b, subsection 4.18) recommends using \lst@definelanguage instead of \lstdefinelanguage in a style file: Where should I put my language definition? If you need the language ...
20
votes
1answer
218 views

What date should I specify in the optional argument of \NeedsTeXFormat?

Subsection 4.1 of LaTeX2e for class and package writers contains the following passage: \NeedsTeXFormat {⟨format-name⟩} [⟨release-date⟩] This command tells TeX that this file should be ...
4
votes
1answer
74 views

When to use % after a command [duplicate]

I am writing my own class file and when I am browsing through code developed by others I see % sign popping up at the end of command lines while other authors do not use it. Consider the following ...
2
votes
0answers
33 views

Installation of LaTeX package: fetch external resources

I am writing a LaTeX class and aim to bundle it as .dtx. My problem is that the class uses graphics that are available for download on the internet, but the license doesn't allow me to spread them ...
6
votes
0answers
80 views

Appending options to hyperref

I am trying to append options to hyperref inside a package (say append.sty) I'm writing. More precisely, in the package I load the hyperref package and I tune it: ...
6
votes
1answer
66 views

In \DeclareStringOption, what is the difference between <init> and <default>?

In the kvoptions package the following macro is defined: \DeclareStringOption [⟨init⟩] {⟨key⟩} [⟨default⟩] Following is the related documentation: A macro is created that remembers the value ...
4
votes
1answer
129 views

Does writing LaTeX packages need moderation? [closed]

30 years ago LaTeX was quite compact and observable being. Nowdays, CTAN repository counts more than 4k LaTeX packages and their number continues growing so that it is absolutely impossible to observe ...
37
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 ...
5
votes
2answers
108 views

Boolean key value in xkeyval fails

It is possible to hand over a boolean key value stored in a macro to a command such as \edef\SomeKeyValue{true}% \DummyCommand[DummyBooleanKey=\SomeKeyValue]%%% where DummyBooleanKey is a boolean ...
6
votes
2answers
100 views

\RequirePackage within \if\else\fi

Why does the package iftex have to be loaded outside of a \if...\else\fi structure? (The same goes for packages ifpdf, ifluatex, ifxetex.) Consider: ...
7
votes
1answer
101 views

How can I separate design from content?

I am new to LaTeX and have completed my first document recently, and it came out to be excellent. However, I am not going to make several more documents which shall be similar. I found that although ...
1
vote
0answers
22 views

standalone: subprambles inverse

When splitting a document with the standalone class and package, the option subpreambles causes the main document to include all the preambles of the sub-files. The other way around is more difficult. ...
2
votes
0answers
132 views

load tikz library from relative path

I recently externalized some of my often used TikZ commands into a library. This is as simple as writing the commands to a dedicated file and naming it tikzlibraryname.code.tex. Then it can be ...
8
votes
1answer
108 views

How can I distribute a sorting scheme

I have made a personal sorting scheme for my final bibliography. It's like the nty scheme but anonymous work before the non-anonymous work. As it's a usual need in my field (classical philology) I ...
14
votes
1answer
279 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 ...
31
votes
2answers
371 views

What are the standards of TeX/LaTeX coding in order to obtain robust packages?

I have posted several questions ultimately involving various aspects of robustness, that have arisen in the context of other questions in risk of clouding the main point of the question in each case. ...