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

learn more… | top users | synonyms

4
votes
1answer
70 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
47 views

Legal concerns in using/modifying/releasing codes [on hold]

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
29 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
171 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
46 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
34 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 ...
9
votes
1answer
98 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
123 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
364 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
70 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
150 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
40 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
60 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
117 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
172 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
67 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
26 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
56 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
44 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
121 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 ...
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 ...
5
votes
2answers
88 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
82 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
100 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
21 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
96 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
105 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 ...
13
votes
1answer
196 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 ...
30
votes
2answers
354 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. ...
4
votes
1answer
64 views

\includeonlyproblems{}

I have a collection of problems which I use to make tests, homeworks, etc. All problems are in one LaTeX file each problem is in it's own \begin{problem}\end{problem} environment. Every time I need to ...
7
votes
2answers
90 views

Providing graphics with own package

Is it possible to provide graphics with own packages? I have modified a beamer style and added a graphic to each page by using \includegraphics: \addtobeamertemplate{frametitle}{}{ ...
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 ...
18
votes
1answer
462 views

I have a dream: Using CSS to style a TeX document

I have no clue in LaTeX package developing but I have a dream! Consider following two files: % A LaTeX file \documentclass{article} \usepackage[style.css]{css} \begin{document} \begin{abstract} ...
6
votes
1answer
102 views

Is there a specific rule on how to choose package/class names?

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 ...
8
votes
1answer
76 views

Maintainance of boites in CTAN

I have done some fixes and enhancements to the boites LaTeX package and I would like to have them integrated to the version in CTAN. In the last time I have contacted the current maintainer (on Apr ...
3
votes
0answers
87 views

Where can I share useful but unpolished code / hacks?

During the course of writing my thesis I've come up with loads of useful macros and hacks and implemented them for my own use. For a few of them I've actually written and published packages. But ...
0
votes
0answers
57 views

Is there / should there be a naming convention for expl3 extensions?

In other programming languages, there is a (sometimes pretty loose) standard on how to name modules / packages / etc. Does expl3 have such a convention in place or, if not, what should it be? Say you ...
2
votes
0answers
45 views

Is there a `sty2dtx` for LaTeX3 syntax?

sty2dtx is a CLI tool to convert a commented style file into a Documented TeX file (dtx). It was written and works wonderfully for LaTeX2e packages, but expl3 offers a lot of happy times for package ...
10
votes
1answer
176 views

Directory structure for a large CTAN package upload

I'm going to upload my first package to CTAN. But after reading all the upload guides from CTAN and TeXLive I'm still feeling daunted by the directory structure. My package is rather complex and by ...
7
votes
1answer
141 views

How do I edit a package?

I downloaded a package from an article template. The thing is that I want to edit it, but don´t know how to do it.
6
votes
1answer
167 views

Including tikzlibrary in .sty file

This might be a silly question, but I know that there is \RequirePackage{} for writing a .sty file. Is there something like this for requiring the inclusion of a TikZ library in a .sty file? I ...
30
votes
2answers
790 views

Equation connected by lines

I have written a code that defines a new environment in which aligned equation are connected by lines as in the image: I think it is useful when, inside the align environment, there is the need of ...
6
votes
1answer
94 views

Commands with Capital letters in their name

A topic that appear over and over is to explain the difference about commands such as \operatorname vs. \DeclareMathOperator. So far I've seen discussions about using one or the other, but no one ...
10
votes
1answer
169 views

Tweak with '%' (percent) symbol's catcode

I have the following code in my main.tex \catcode`\%=11 \immediate\write18{git log -1 --pretty=format:"%h%x3b%ad" --date=short > \jobname.info} \catcode`\%=14 which extracts the version ...
3
votes
1answer
87 views

How to send a package to CTAN with ctanupload? (I get an error)

Im trying to send a new package to CTAN and I wanted to use the makefile given in the manual of ctanupload. This is how my file looks CONTRIBUTION = metrix NAME = Tobias Weh EMAIL = mail@tweh.de ...
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 ...
3
votes
1answer
72 views

l3doc in combination with minted

The following question is related: How to add listings environment to DTX files I want to use the document class l3doc in combination with minted. However I am not able to get a nice result. If I ...
14
votes
2answers
511 views

Creating plasmid diagrams in TeX

I need to create a diagram of plasmid in TeX, which looks like that: The images above are slightly different but show pretty much the same thing so it would be great if I could create any of them ...
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 ...
7
votes
1answer
88 views

Difference between 11 and 12 catcodes

I can only define commands, consisting of catcode-11 symbols or single catcode-12. What is the point of this limitation? It would be convient for me to define commands, that include following, not ...