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

learn more… | top users | synonyms

14
votes
1answer
297 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
376 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
70 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
93 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
127 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
496 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
111 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
84 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
90 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 ...
4
votes
1answer
78 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
51 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
181 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
145 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
217 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
810 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
101 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
194 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
88 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
81 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
589 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
182 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
92 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 ...
3
votes
1answer
121 views

Passing arguments to a .sty-file - a specific case

After having plowed through (i.e. read and trimmed down the given examples in an attempt to apply them to my case) these documentations and guides: Implementing key-value input: An introduction The ...
3
votes
2answers
179 views

Global configuration files in LaTeX

Just wanna know if there is posible to have some kind of "configuration file" on LaTeX. Like a properties file on Java. Recently I changed my email address, so i need to replace it on every document ...
8
votes
2answers
151 views

How to clean all personal commands?

I'm trying to improve the answers to my other question to create my personal package which provides some commands, like \alert to write in red color, or some options like lineno to turn on line ...
13
votes
2answers
190 views

Load a package as optional argument

I'm creating my personal package. I'd like to use an option to turn on/off the line numbering provided by the package lineno. So, my sty file contains \RequirePackage{lineno} \linenumbers But if ...
12
votes
5answers
419 views

Parsing hexadecimal numbers to binary and iterating over bits

I'm currently working on a software for an graphic display, so I recreated it in TikZ for documentation purposes: I currently use this to set individual pixels on the display: \setpixel{x}{y} ...
0
votes
0answers
36 views

How make a class or package? [duplicate]

I want to make a class or package but i don't have example class or package Would you help me and give a example document (*.cls) or package(.*sty) ?
20
votes
3answers
376 views

How to write a LaTeX package that bundles not only .sty and .cls files but also some logos in .pdf or .eps formats?

I would like to make a LaTeX package with the following subdirs: tex/latex/common (a common .tex file shared among beamer and letter) tex/latex/resources (lots of pdf and eps files with graphical ...
4
votes
2answers
707 views

Implementing a way to show data structures in LaTeX

Is there a way to implement data structures in LaTeX? I am currently taking two classes that require large numbers of heaps (min,max) and queues (FIFO,LIFO) and the like to be drawn after inserting ...
19
votes
1answer
277 views

When should I upload my new style?

I've been working lately in a new style for my university, which is heavily influenced by a pre-existing style (feupteses). However, feupteses was never meant for PhD dissertations, so I decided to ...
5
votes
1answer
85 views

How to add optional arguments to a package I'm writing?

I want to build a package that can optionally typeset line in double-space. Something like this: \ProvidePackage{mypackage} % actual functional codes Then I can use the package in this way: ...
5
votes
1answer
233 views

Naming conventions for macro names that include the package name

Background Many packages provide commands that have the full name of the package, or an abbreviation, as part of the command name. Sometimes the package name (or abbreviation) is at the beginning of ...
0
votes
0answers
127 views

How to make a package using sagetex and sage-commands

I am trying to make my own package building on sagetex. It starts with \RequirePackage{sagetex} and I want it to execute some 'sagesilent' code as for instance \newcommand{\loadsagefunction}{ ...
3
votes
3answers
156 views

Is it good/bad style to use \label in preamble or package/class file?

I would like to use \labels to organize a package file that has become too long to be navigated by simple scrolling. It seems that this doesn't cause any errors, but I'm not sure if that's good ...
14
votes
1answer
1k views

Creating new class file: Where to start?

Recently, a journal I have some editorial involvement with has decided that for its 'rapid publication' outlet, it will no longer accept submissions where LaTeX has been used to format the document. ...
1
vote
1answer
84 views

How do I redefine a custom environment that I have previously defined elsewhere?

I made a custom class for homework assignments and I've defined a solution environment as follows: \def\qed{\ensuremath{\square}} % <-QED Symbol \newenvironment{solution}{% <-Solution ...
15
votes
1answer
234 views

What are best practices for package authors to deal with package conflicts?

One occasionally encountered problem with LaTeX is incompatibility between packages. What are best practices for package authors to deal with package conflicts? For example: What is the best way to ...
26
votes
3answers
661 views

When is it better to use \par than \endgraf?

Just yesterday I had to patch a package file (changing the description to indicate that the file had changed) to replace some \par to \endgraf because the code had bad interactions with non-\long ...
15
votes
1answer
408 views

Guidelines: when is LaTeX3 too much LaTeX3?

This morning I found myself writing a document where essentially the same text is repeated several times. Because I've been mucking around a lot recently learning LaTeX3, it took absolutely no ...
3
votes
1answer
84 views

bug in listings package?

It seems as if the listings package can not be loaded after all other packages using \AtBeginDocument \documentclass[]{scrbook} % \AtBeginDocument{\RequirePackage{listings}} \begin{document} ...
4
votes
1answer
136 views

Commands from xparse inside functions created by \cs_new:Npn?

Is it okay to put commands from xparse inside functions created by \cs_new:Npn instead of \NewDocumentCommand? Would that be a confusion of programming levels? The example below works but I was ...
17
votes
2answers
323 views

Defining a dimension with or without @

If I am writing a TeX package (as one can find such on CTAN), there are following approaches to define a new dimension length that should be changeable by a user of that package. Approach A: Define ...
2
votes
1answer
166 views

Is \Copy already in use by any package?

I'm working on my copypaste package to address a confusing feature that Seamus has kindly drawn my attention to. \yank copies text and commands from a LaTeX document onto a "clipboard", and \paste ...
10
votes
5answers
905 views

Is it possible to call external programs from LaTeX?

I'm trying to write very specific LaTeX package that does a lot of complex computation. It encloses some parts of text (or whatever else user wants to print) into boxes and then runs quite complex ...
3
votes
1answer
135 views

LaTeX system-wide glossary database as custom package

I'm trying to make a system-wide glossary database (with acronyms and definitions) as a package. My file is: /usr/local/texlive/texmf-local/tex/latex/local/myglossary.sty One needs to run: sudo ...
26
votes
7answers
2k views

What's a good editor for (La)TeX programming?

I've found several questions about editors for writing LaTeX documents ( LaTeX Editors/IDEs seems to be the definitive one). But I'd like to know which editors are out there that help you develop ...
7
votes
1answer
320 views

Is it correct to use RequirePackage[utf8]{inputenc}?

If I create a package, is it correct to use \RequirePackage[utf8]{inputenc} to support utf8. I guess not, but how do I state that this package must (should) be used with inputenc utf8?
9
votes
1answer
222 views

How to raise a LaTeX warning from within Lua code?

I want to raise a warning from within Lua code. With advice from the LuaTeX wiki and LaTeX 2𝜀 for class and package writers, I arrived at the following (working) solution: \documentclass{article} ...