Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [package-writing]

{package-writing} is about writing packages. If your question is about choosing, installing, or using packages, choose {package} instead. If your question is related to package options, use {package-options} as tag.

2
votes
1answer
58 views
+100

Conditionally add options to tcolorbox highlight math style

I have defined the following package: % Configuration \NeedsTeXFormat{LaTeX2e}[1994/06/01] \ProvidesPackage{eqbox}[2018/01/01 Boxed Equations] \RequirePackage{xcolor} \RequirePackage{pgfopts} \...
1
vote
1answer
27 views

Local variable to a package

I am defining my own latex package mypackage.sty. How to define a local command such that: mycommand If mycommand is already defined elsewhere it will be locally redefined just inside the package If ...
3
votes
1answer
51 views

Standard test documents for new packages

I'm putting together a package that offers general functionality that I think would be helpful for lots of LaTeX users and in lots of documents. I've rolled my own test cases, but I can't help but ...
0
votes
0answers
17 views

How to document LaTeX custom packages and document classes? [duplicate]

While I can use something like Doxygen to document a C library (functions, constants and structures defined/written by me), I couldn't find something equivalent in LaTeX to document \newcommand(s) \...
4
votes
2answers
44 views

How to resolve clashing definitions of \comment in comment.sty and changes.sty without affecting either's interface?

I'm writing a package that uses both changes (v3.1.2) and comment (v3.8), and I'd like to expose their functionality to consumers of my package without having to modify either one's interface. The ...
0
votes
0answers
46 views

Commands vs keys/values for setting up a document: what an own document class should provide?

This question somehow extends the question "Package option vs setup command". I'm currently writing a class dedicated to students reports for both academic projects and internships. This class ...
1
vote
0answers
24 views

`\show` for macro arguments

For debugging purposes, I want to write to the log what is actually passed to a macro as argument. A naive \newcommand\test[1]{\show#1} obviously doesn't do the job. So how can I printout a list of ...
0
votes
0answers
24 views

Reporting LaTeX error at custom location

I'm familiar with \PackageError as a way to cause LaTeX to report a custom error message when the command is run. But I'm wondering, is there a way to cause LaTeX to report an error, with a custom ...
1
vote
0answers
30 views

Conditionally include a line based on an option with pgfpackages

I am trying to design a small package, mostly for test purpose. Currently the package looks like this: % eqbox.sty \NeedsTeXFormat{LaTeX2e}[1994/06/01] \ProvidesPackage{eqbox}[2019/01/01 Boxed ...
4
votes
2answers
52 views

Renewcommand with ensuremath and brackets

I'm making a .sty file (which is called my-macros.sty and is in my home /texmf directory) where I define some commands that I constantly use. Among these commands, there are the following \newcommand{...
22
votes
0answers
293 views

Physics replacement effort

I'm currently considering writing up some macros in order to provide a somewhat more reasonable alternative to what the physics package does. This is heavily inspired by Alternatives to the physics ...
15
votes
0answers
329 views

Alternatives to the physics package

The physics package is useful A lot of my LaTeX documents make heavy use of the physics package. Aside from it overloading several standard commands (e.g. \sin, \abs, etc.), it also makes a few ...
3
votes
1answer
64 views

Using pgfopts to set up a tcolorbox style

Consider a package file eqbox.sty: % Preamble \NeedsTeXFormat{LaTeX2e}[1994/06/01] \ProvidesPackage{eqbox}[2018/01/01 Boxed Equations] % Packages \RequirePackage{xcolor} \RequirePackage{pgfopts} \...
2
votes
1answer
40 views

Replacing ^^J with ^^J%% within DocTeX's first pass of a DocTeX document?

Question Is it possible to perform text replacement during the first pass of a document by DocTeX ? Specifically, how can I replace ^^J with ^^J%% in a \edef'd macro ? Background I had recently ...
0
votes
1answer
24 views

Isodate package: package loading vs. \AtBeginDocument

In order to have iso dates on my class-generated title page, I would have to load isodate before calling \AtBeginDocument since this MVE \documentclass{scrartcl} % ...
1
vote
1answer
47 views

How does the file name database, in MikTeX, resolve the files it catalogs?

I recently updated my MikTeX distribution (The new interface is really nice by the way, Thank You to the contributors/developers) and I got curious about the path resolution of files when compiling a ...
1
vote
1answer
28 views

Software Documentation Dot-Operator/Period Hyphenation

I'm still new-ish to latex, and I'm trying to document some software using the tool. I'm referencing local terms that are long and contain periods/dot-operators. I know how/why Latex doesn't like to ...
14
votes
1answer
274 views

Does LPPL allow package development with pull requests etc.?

Many packages are nowadays developed on github or similar platforms and if I want to contribute a bugfix to some package (of which I'm not the author), my usual workflow is to fork the repo, develop ...
2
votes
1answer
54 views

Where are basic mathmode symbols stored

What I want to do: I want to take two basic LaTeX mathmode characters, take their vector picture file, and edit them together to form a new symbol, which I want to behave as any other mathmode symbol ...
8
votes
1answer
208 views

How to check which command was used to load a .sty file?

I have a .sty file that may be loaded using the command \usepackage (in LaTeX) or the command \input (in LaTeX or Plain TeX). Is there any way that within the .sty file to check which command was ...
0
votes
1answer
39 views

Defining colors in style file by forcing immediate expansion

I am writing a template for a poster (using beamer/beamerposter) package for students that I intend to distribute as a folder. It will contain a .tex file that the students can start editing, and a ...
0
votes
3answers
100 views

How to use “Kpathsea” to open a sty file for users modifications

I have a package to create exam paper sujet.sty, in this package I have defined some commands like school which expand to the name of school. \def\school{name-of-school} I thought about using a ...
3
votes
2answers
843 views

Windows MikTeX can't find my .sty file

I posted a question like this earlier but I'm re-asking because I didn't ask properly before. I created a .sty file (preamble.sty) to help clean up my preamble but I'm having trouble actually using ...
3
votes
0answers
102 views

Software Architecture and xtemplate

When writing a package, there may be the situation that several things need to interact to make a complete product. When using xtemplate, I can define each part as an object. This means that the ...
1
vote
1answer
32 views

What do the labels (such as <*dircheck>) mean in `source2e.pdf`?

I am studying source2e.pdf and I have encountered something such as <*dircheck>, <*initex>, <*2ekernel>,<latexrelease>. I thought that they might be some sort of label to mark ...
3
votes
1answer
58 views

Trouble with newtcolorbox title positioning and optional arguments in .sty file

I'm trying to recreate this info box, but I'm having trouble making optional arguments for the title of the box and the position of the title. This is what I have so far. Aesthetically it is almost ...
2
votes
1answer
99 views

Configuring a section alias in LaTeX

Every week I produce a couple of A5 booklets (A4 folded) for my wife, an active colleague in church ministry, from which I am recently retired. I call the booklets a pulpit manuscript, as it includes ...
0
votes
0answers
26 views

Need a way to nest line breaks in tabularx environment for Calendar

I am trying to make an academic calendar package. I know there's a veritable horde of them out there and I've looked through many of them but can't seem to find one I like. Since I am (usually) pretty ...
5
votes
1answer
80 views

How to prepare two (or more) sty files for single CTAN package

I am the owner of the gurps package and recently I've been thinking of including a new sty file (called gurps-npccard.sty) which isn't full enough to be it's own package but seems too niche to be ...
2
votes
3answers
321 views

How to change the directory of my own .sty files in MacOS?

Right now, I save my own packages in the shown 'standard' directory. I can use this package in MacTeX with a simple \usepackage{} command. I want to backup my styles in iCloud without to copy it ...
4
votes
1answer
109 views

How to define a string variable with diacritics to my own package (.sty)

I try to add a variable title string to my own package 'MyStyle.sty'. 'MyStyle.sty' just contains some used packages, pdf settings and commands for a style guide / corporate identity. Document.tex \...
0
votes
1answer
39 views

Custom Package: Combine Options

Suppose I have the following custom package where I have my various titlesec setups defined: \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{mytitles}[2018/06/01 Custom Titles Package] \RequirePackage{...
2
votes
1answer
37 views

Comparing package version dates

Is it safe to use the LaTeX commands \@ifpackagelater, \@ifl@t@r and/or \@parse@version to compare/parse dates in the format used with \ProvidesPackage (YYYY/MM/DD)? Or is there a package providing ...
9
votes
1answer
137 views

Package option vs setup command

Traditionally, LaTeX packages will use package options (I mean the options in \usepackage[...]{package}) for setup. However, I have noticed in some modern packages, e.g. siunitx, unicode-math, ctex, ...
9
votes
2answers
297 views

Easiest way to create TeX macro/code to access symbols from particular font?

I would like to use CASIO fonts here. 1 - I would like to create a way to use LaTeX to get these "icon"s. For example, use \On for the ON button, and ect. Assuming we have to do some more work here ...
2
votes
0answers
104 views

Setting up kvoptions with a setup command [closed]

The hyperref package (for example) provides a \hypersetup command where key-value options can be provided as an alternative to \usepackage[key=value]{hyperref}. I'm trying to do the same, using ...
4
votes
1answer
211 views

Statistics on package usage

Is there any way I can get an overview or at least any indication on how many people downloaded/installed a package from CTAN, MiKTeX and/or TeXLive? I'm asking because I have recently made several ...
0
votes
0answers
25 views

Detect the presence of a package [duplicate]

As a package author, I need to detect the presence of a certain package. Is there a standard way to that? Some kind of \is_loaded{package_name} command? (If not, could you help me finding another way ...
1
vote
0answers
69 views

Feasibility of a Latex “Computation Verifier”

This may be more appropriate on stackoverflow, but as it pertains specifically to the existence of a utility for LaTeX, I thought I should ask it here. In my experience as an undergraduate, it's very ...
0
votes
0answers
50 views

Package to select exercises by difficulty

I'm new to this community, I'm sorry if the question is not appropriated. I'm looking for a package to create Exercise Sheets like probsoln, with exercises loaded from an outside .tex file, but that ...
7
votes
2answers
211 views

Creating package options which are mutually exclusive and choosing a default

I want to automatize some of the code that I usually include to setup my theorem environment functionality into a package. So here is what I do to control within which counter my theorems are numbered:...
1
vote
1answer
96 views

Checking if certain package option is declared inside .sty

I'm writting a package in which the user may choose between three types of documents through declared options when issuing the \usepackage command: undergraduatethesis, technicalreport and ...
1
vote
1answer
60 views

Find out the math font used in a document (so I can write a package to make adjustments depending on the math font)

This is a follow-up to this question. The problem was that if tikz-cd is used with the command \tikzcdset{arrow style=math font} in order to make the arrow heads fit the math font, the stems of the ...
2
votes
2answers
893 views

Latest MiKTeX: suggestions on how to install new fonts using the MiKTeX Console

MiKTeX has changed its look by introducing the MikTeX Console: In the past I have always updated and added fonts not included in the MikTeX distribution using the mask Settings, Update and Package ...
0
votes
1answer
219 views

'Unknown option' errors in custom package

I am playing around a little with creating a custom package for theorem environments and related functionality. Consider the following MWE: \RequirePackage{filecontents} \begin{filecontents}{test.sty}...
4
votes
1answer
126 views

Need advice for design decision: class or style

When implementing LaTeX support for company documents, a decision must be made prior to the initial release: is the support implemented as class or as style? While there is a heap of information about ...
0
votes
0answers
83 views

How to update my own packages?

At the moment I am starting to organize my documents a little bit better. For this reason I want to externalize some of my code into packages. Some of these are rather stable but some have to be ...
4
votes
1answer
523 views

key-value syntax in package options

I want to create a style file capturing my layout for theorem environments. In particular, I would like to pass an option to the package specifying the level of the theorem counter. So here is a ...
2
votes
1answer
55 views

Transfer all options of “geometry” to my package

In my package I need to use all of geometry package options, I can define one option landscape like this \DeclareOption{landscape}{ \geometry{landscape} } \ProcessOptions\relax My hope is ...
1
vote
1answer
39 views

Define a required option with pgfopts

I would like to define a required package option with pgfopts. So far I've done the following: \begin{filecontents}{\jobname.sty} \ProvidesPackage{\jobname}[2018-01-24 v1.0 Test package] \...