Questions tagged [package-writing]

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

Filter by
Sorted by
Tagged with
7 votes
2 answers
101 views

Use l3build to build and package a font package

I would like to use l3build to build and package a support package for a TrueType/OpenType font. File Layout truetype/MyFont.ttf build.lua my-font-package.dtx my-font-package.ins File Contents build....
Stephan Lukasczyk's user avatar
6 votes
1 answer
89 views

How can I disable shadows (and similar preaction/postaction effects) in TikZ or PGF?

Is there a general way to disable preactions/postactions in TikZ on which effects such as shadows depend? If not, is there a straightforward way to enable users to add options to an existing style so ...
cfr's user avatar
  • 189k
0 votes
0 answers
27 views

Adding a page in the end of a document with preamble

I am working on a special style package for a company and one of templates must include a special blank page in the end of a document. In order to do it I could make a command like \makeEndPage that ...
Daniel Neskorodov's user avatar
2 votes
0 answers
40 views

Options in style files [duplicate]

How can I have an option to require some packages in a style file I am writing ? For instance, I can have a Science and Technology Option that makes available certain symbols. And another option to ...
Mahavir's user avatar
  • 45
3 votes
1 answer
97 views

LaTeX for Companies

I work with a small company (10 people). I've been a LaTeX user for roughly 20 years. We have been trying to implement LaTeX as the primary document preparation system in our company with varying ...
cole's user avatar
  • 31
0 votes
0 answers
21 views

How to manually space two images in a environment defined by a personal package

I am trying to create a package in order to be able to write in Ithkuil (it's an artificial language). To do this, I need to have an environment \begin{ithkuil} ... \end{ithkuil} in which the ...
Emanuele Lorica's user avatar
1 vote
1 answer
16 views

Errors setting up a custom equation environment using \tcbhighmath

Currently, I'm writing a Macros package to store my custom environments and macros for my homework sheets. I'm trying to create a custom environment which I can define within my package (a .sty file), ...
Ammardian's user avatar
0 votes
0 answers
58 views

How to write my own TexLive package?

I want to create my own latex package with a .sty file in it, and install it via tlmgr command. I've looked it up in Google, and found only this page https://tug.org/texlive/pkgcontrib.html, where I ...
OrthoPole's user avatar
  • 113
2 votes
1 answer
54 views

Why can these custom commands from packages not be seen in the main document?

I am using TeX Live (MacTeX) 2023 with all updates (as of this morning). Consider two packages called packageone.sty and packagetwo.sty. packageone.sty contains a redefinition of \vec to include a ...
LaTeXereXeTaL's user avatar
1 vote
0 answers
36 views

Are header guards necessary for LaTeX packages? If so, how to implement one?

A header guard is used in some programming languages to avoid repeatedly importing the same file. Here's one example of this scenario in LaTeX: Let's say we have header1.sty, header2.sty and main.tex ...
Long Horn's user avatar
0 votes
1 answer
26 views

xkeyval keys not resetting after execution of the command with luatex

The following tex document is compiled with LuaLaTeX engine. \documentclass{article} \usepackage{luakeytest} \begin{document} \myAddFunction[c=30,d=40]{10.1}{20} \myAddFunction{1}{2} \end{document} ...
user61681's user avatar
  • 1,729
1 vote
1 answer
41 views

Macro without arguments to define macro with arguments

I'm trying to use xparse and generic TeX/LaTeX commands to write a macro (that takes no arguments) to define another macro that does take arguments: \documentclass{minimal} \RequirePackage{xparse,...
Ben Zelnick's user avatar
3 votes
0 answers
49 views

How to implement some functions in C++ for Asymptote?

I implemented some special functions in pure Asymptote language and they are useful. But one recommends me to implement them in C++ instead. I'd like (and I already have these functions in C++) but I ...
Stéphane Laurent's user avatar
3 votes
0 answers
72 views

Passing optional arguments to LaTeX commands with Lua

The following tex document is compiled with LuaLaTeX engine. \documentclass{article} \usepackage{keytest} \begin{document} \myAddFunction[c=30,d=40]{10}{20} \end{document} This works fine and output ...
user61681's user avatar
  • 1,729
1 vote
1 answer
175 views

My first package stopped to work!

some years ago I wrote the simple package PSBao.sty. I stopped using it two years ago and now it doesn't work any more. I'm not able to find the cause. Can someone help me? Unfortunately it was my ...
nino_user183677's user avatar
1 vote
2 answers
75 views

LaTeX3 dynamic generation of \prg_new_conditional

I have multiple pieces of redundant LaTeX3 code that creates new conditionals: \bool_if:nT { \cs_if_free_p:N \mypkg_if_package_loaded_p:n && \cs_if_free_p:N \mypkg_if_package_loaded_T:n &...
Neveda's user avatar
  • 43
1 vote
1 answer
48 views

AUCTeX auto style files for .dtx and .tex with the same base name

In a LaTeX package using DocStrip with pretty standard structure one could have the following files: mypackage-code.tex mypackage.dtx mypackage.ins mypackage.tex mypackage.dtx is the main file where ...
gusbrs's user avatar
  • 13.2k
1 vote
1 answer
53 views

l3build testing several tcolorbox theorems: what would be the best way?

(I'm (still) in the process of trying to understand how l3build tests work.) Suppose I'd like to l3build a test for a class (based on standalone class, but I guess it is of little importance here) ...
Denis Bitouzé's user avatar
3 votes
1 answer
81 views

\AtBeginDocument and packages

Here is a very puzzling behaviour of the (Lua)LaTeX compiler. In the situation below, the output depends on whether some code in put in a package or directly in the main file; asking for an extra \...
Rémi Peyre's user avatar
1 vote
1 answer
169 views

Who are the people behind the CTAN packages? [duplicate]

I am sorry for my naive question but the more I get acquaint with LaTeX packages, the more I wonder who are those people behind the packages. Some of them are very complex, with exhaustive 1000-pages ...
Rubem Pacelli's user avatar
0 votes
0 answers
60 views

How can I to pass options (or Load) class to a new package? Is it possible?

I'm planning to build a new package, which I call abntstyle, that can implement Brazilian norms of writing academic works. There is already a class called abnTeX2 that does this. This class is ...
lucenalex's user avatar
  • 317
0 votes
1 answer
34 views

Trouble writing new package for a numbered 'tcolorbox' style with option for 'number within'

I am writing a new package to define a numbered box style (using tcolorbox) that I use in multiple documents. I want to take the numbering convention of the box as a package option. By default, I want ...
Zxcvasdf's user avatar
  • 1,715
1 vote
2 answers
68 views

How to use catcodes in a macro/environment

I want to use catcodes in an environment and the catcodes shall be changed for a very short part in the document. MnWE: \documentclass[a5paper, 11pt]{scrartcl} \usepackage{environ} \NewEnviron{Lied}[...
MaestroGlanz's user avatar
  • 2,298
1 vote
0 answers
57 views

Condition in Writing New Environment with pgfkeys

I'm writing a new environment in LaTeX where pgfkeys package is used to give the key interface. Source Code: \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{noteframe}[2023/01/01 Version 1.0] \...
Future Liang's user avatar
0 votes
1 answer
63 views

How to use \pgfkeys properly in \newenvironment based on xcolor and tcolorbox?

I'm trying to create a new environment called noteframe that is based on tcolorbox. Supposedly, the noteframe environment should allow the user to change the theme color of the box using the name of ...
Future Liang's user avatar
0 votes
1 answer
44 views

``key-one=value one'' versus ``key-one={value one}'' in l3keys or package options

I just noticed that key-one=value one and key-one={value one} seem equivalent as \keys_set:nn arguments but not as package options. In next minimal example, the same key-value argument is parsed as a ...
Jérôme LAURENS's user avatar
3 votes
1 answer
136 views

Typesetting Non-Latin Unicode Characters with LaTeX

I am writing a package in LaTeX, and would like to have basic macros (e.g. \vulture) for printing almost all the Egyptian hieroglyphs (e.g. U+13150 𓅐 - Egyptian Hieroglyph G14 - Vulture). As far as I ...
aralto's user avatar
  • 71
2 votes
1 answer
199 views

How to create an `expl3` package?

By a expl3 package I mean a package that includes some commands that uses expl3. The point is that I want a document to be able to \usepackage{} that package and avoid the need of \usepackage{expl3} ...
youthdoo's user avatar
  • 779
0 votes
1 answer
141 views

How to save a style file in TeXShop?

When I try to save a .sty file in TeXShop, I get the message "You cannot save this document with extension “.sty” at the end of the name. The required extension is “.tex”." Of course, I ...
Ishaidc's user avatar
  • 101
1 vote
1 answer
83 views

Expl3 syntax generate error and warning messages for class and LaTeX

When I do \msg_new:nnnn { module } { errorname } { explenation } and then \msg_warning { module } { errorname } i get Package module Warning:. How can I get it to say Class module Warning: or LaTeX ...
Vebjorn's user avatar
  • 1,758
0 votes
1 answer
46 views

Produce error when document exceeds a page length

I tried making an fatal error when the document exceeds a set pagelimit. I think there is some problem with my if statement, because although the document exceeds the limit there is no error. The idea ...
Vebjorn's user avatar
  • 1,758
0 votes
2 answers
108 views

How to make "fatal error"?

How do you make LaTeX stop/ abort the compilation and output a "fatal error"? I know there are a couple of ways to produce errors/warnings: \ClassError{class-name}{error-text}{help-text} \...
Vebjorn's user avatar
  • 1,758
2 votes
1 answer
48 views

Raise Package/ Class error for incompatible options

When I am writing a package or class, I sometimes have some options that are incompatible with each other. What I want is to raise an error if two such options are imported at the same time. I tried \@...
Vebjorn's user avatar
  • 1,758
11 votes
1 answer
370 views

How does wrapfig internally work?

wrapfig is a LaTeX package designed to make it possible to let text flow around images. I am acquainted with the documentation, which was written with the needs of an end user in mind. But how does ...
user7427029's user avatar
3 votes
1 answer
74 views

Customize package between book/article classes

I wrote a small package that I used to typeset a book. Now, I'd like to reuse it for smaller documents. The package uses tcolorbox and defines a box like this: \newtcblisting[auto counter, ...
Michel Charpentier's user avatar
1 vote
0 answers
51 views

Create an alphabet package that works like greek letters

Some friends and I have been using LaTeX for some years and, at College, we have created some new letters to use with math (it was kind of a joke because we were constantly saying there were few ...
Adame's user avatar
  • 21
3 votes
1 answer
63 views

Write a package/ document class with babel supported commands

I am writing a latex class and would like to have a command that prints a sentence in different languages if babel is imported. If babel is not imported (detected) it will simply print the sentence in ...
Vebjorn's user avatar
  • 1,758
2 votes
1 answer
53 views

Why does esint clash when I include it in my package?

I am trying to write my own package, but I can not include esint without getting errors. Here is an MWE of my package: \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{zyy}[2021/08/14 Yiyu's preamble for ...
zyy's user avatar
  • 2,076
0 votes
0 answers
30 views

Error while creating a new command in a custom package

I'm trying to follow the steps in this link to create a new package. My current code is \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{custom}[2022/10/29 LaTeX custom] \let\a\alpha \newcommand{\bfit}[1]{\...
Sam's user avatar
  • 103
1 vote
2 answers
84 views

Macro to define macros within .aux file is not working

Here are some macros that I am trying to define (based on this question): \odef{foo}{bar} will define an "object" with name foo and value bar. \objRef{foo} will insert the value of the foo &...
Ben Zelnick's user avatar
0 votes
0 answers
24 views

Test if a package option defined through pgf is empty

I would like to branch on package/class options defined through the pgfopts package. Here is an example : % CLASS % Preamble \NeedsTeXFormat{LaTeX2e}[1994/06/01] \ProvidesClass{myclass}[2022/10/01] \...
Vincent's user avatar
  • 4,683
1 vote
1 answer
87 views

Which code is executed when generating .sty from .dtx?

I am trying to understand how to generate .sty using .dtx. Suppose I want the following code to be in the .sty file: \NewDocumentCommand{\foo}{ }{} \NewDocumentCommand{\bar}{ }{} \ifluatex \let\baz\...
Michael Fraiman's user avatar
2 votes
2 answers
141 views

How to \protect '#' in \PackageError?

I'm trying to write a package with a macro that's abbreviates \PackageError, and I'd like in particular to use it to report messages such as Parameter #1 cannot be "s" (assuming my input ...
Daniel Diniz's user avatar
0 votes
0 answers
23 views

Canonical way to declare new bib2gls entries for use with glossaries-extra

I found my self reusing blocks of entry-type-aliases={% module = entry,% repo = entry,% ... } quite often, but I think copy pasting code is a bad idea. As I keep reusing and expanding my ...
927589452's user avatar
  • 108
4 votes
2 answers
151 views

\AddToHook{file/⟨file-name⟩/before}{\ExplSyntaxOff} seems to be ineffective

(The current question is related to Using of \usetikzlibrary in an expl3 package fails, at least somehow.) Suppose a (expl3) class of mine, myclass, provides a way to configure it at the document ...
Denis Bitouzé's user avatar
3 votes
0 answers
26 views

Setting up a translatable package

I maintain a LaTeX package that produces an output with three English words: “and”, “p.” and “pp.”. I would like that if someone used my package in a German document these three strings automatically ...
madmurphy's user avatar
  • 233
0 votes
1 answer
35 views

Why can I no longer remove "General:" when using \PrintChanges as of doc 3?

As of version 3, the doc package provides reportchangedates option to display dates along with package changes. I want to remove the word "General" and the colon that follows it from the ...
LaTeXereXeTaL's user avatar
6 votes
1 answer
338 views

As of 2022, how should one build class/package options without l3keys2e? [duplicate]

In a comment of this question,David Carlisle wrote: [l3keys2e] should be considerd legacy now, the new built in option code is based on the same core expl3 code but extended and improved so hopefully ...
Jinwen's user avatar
  • 7,818
0 votes
0 answers
57 views

New conditional to test package version

By now, how should one write the code that does if the package <package> is newer than <version>, do <thing A>; otherwise do <thing B>? I'm aware of \@ifpackagelater, but I ...
Jinwen's user avatar
  • 7,818
2 votes
0 answers
2k views

EuropeCV fails with LaTeX2e pre-release because of loading hyperref in \AtBeginDocument

Below is a minimal example that compiles successfully with stable TeX Live 2022 pdflatex but fails with the latest (and expected to be released in a couple days I think) pdflatex-dev: \documentclass[...
scottkosty's user avatar
  • 12.7k

1
2 3 4 5
12