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

learn more… | top users | synonyms

3
votes
2answers
140 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
148 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
170 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
384 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
35 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) ?
19
votes
3answers
340 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
545 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
271 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
77 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: ...
4
votes
1answer
202 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
114 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
153 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
681 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
70 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
219 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 ...
23
votes
3answers
553 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
399 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
79 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
113 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
293 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
153 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 ...
9
votes
5answers
731 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
128 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 ...
25
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
279 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
208 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} ...
5
votes
1answer
226 views

pass xkeyval option to class

I have read about passing options to classes in this thread, but do not understand what I'm doing wrong. My class is defined like so, using xkeyval and based on memoir. \NeedsTeXFormat{LaTeX2e} ...
8
votes
3answers
256 views

Indirectly defining two active characters within an \AtBeginDocument command

I'm trying to define a macro that uses two active characters inside an \AtBeginDocument command. I can write a macro such as the following using only one active character: \catcode`\_=13 \begingroup ...
7
votes
1answer
86 views

Error line inside a package

I've created my own package, but, when I use it in a new document, and pdflatex find an error using a custom command (defined in my own package), it shows me only the error line where this command was ...
3
votes
1answer
458 views

LuaLatex package: \dofile results in error “no such file or directory”

I've written some macros that randomly selects questions from a database to include on an exam. The start of my .sty file reads as follows: \NeedsTeXFormat{LaTeX2e} ...
8
votes
2answers
97 views

Define a command so that it is only active within the document environment

I would like to configure a custom command so that it only affects the document environment. Because the command changes a number of catcodes, it has to be included after the begin{document} tag in ...
17
votes
1answer
620 views

How does TeX actually work?

Lots of useful information for human beings, especially in academia. But, what is actually underlying the TeX engine? How does it really work? Does it parse everything and just put the stuff together? ...
7
votes
1answer
195 views

Choice keys and exception handling

Recently, I switched a self-written "bundle package" from using xkeyval to keyreader. One reason for this, beside the backward compatibility, was that the definition of keys is more convenient in ...
20
votes
1answer
447 views

How would one design a math font?

There are (some very nice) text fonts which do not have math support. Though there are ways to 'remedy' this, such as the mathastext package and some others, these are hardly satisfactory. All accents ...
3
votes
1answer
414 views

beamerposter custom style with keyval definition

I'm creating a beamerposter style accordingly to my department specification. I would like to create a theme where the definitions of the blocks can vary accordingly to a keyword in the calling of the ...
8
votes
3answers
177 views

More complicated key definitions in loops/for each statements

While writing a package with a key-value interface, I had a lot of repetitive key definitions. Naturally, one would like to express these definitions with a loop. When the definition contains ...
5
votes
1answer
104 views

Packages `fighting' for the value of a length

I've recently written some macros for typesetting certain constructs used in linguistics (Discourse Representation Structures). I hit an issue whereby the svmono class was changing the value of ...
9
votes
2answers
148 views

Is it possible to prevent users from seeing the package codes while they still can make use of its publicly exposed macros?

Assume that I have a confidential package that nobody is allowed to see the source code. The users are only allowed to use the public macros. This question is closely related to my other question. ...
9
votes
1answer
158 views

Defining synonyms for indexing

Is it possible to set things up so that indexing synonyms does not generate multiple entries? For example, if the text includes \index{cur}, \index{hound}, and \index{mutt}, can these be coalesced ...
2
votes
1answer
129 views

How to add text to beginning of body via sty file

This is my first post here. I can usually find what I'm looking for using questions other people have asked, but this time I'm stumped. Please can anyone help? I am very new to Latex. I am trying to ...
3
votes
1answer
98 views

Using qstest to implement unit tests

I was trying to figure out how to test my xpeek package (see https://github.com/jcsalomon/xpeek) and I came across What's the folk-lore on automatic testing of TeX programming? and Testing ...
0
votes
1answer
384 views

modular title pages

How to achieve having modular title pages in latex (xelatex), to only have to change one word in the .tex file and have it changed? All the files must be defined in the project's directory, not ...
12
votes
3answers
146 views

Executing a command after a package has been loaded

In my previous question I ended up with \DeclareMathSymbol{:}{\mathpunct}{operators}{"3A} But now I'm using the fontspec package which redefines : with \AtBeginDocument itself. So as my own ...
24
votes
1answer
306 views

Wrote a new package. Is there some standard place to share?

So I finished writing my package for typesetting Begriffsschrift. I think it marks a marked improvement over the package begriff, which is the only other package for the same purpose, that I can find ...
10
votes
2answers
227 views

Other than syntax what is the difference between \dimen0= and \setlength{}{}?

I have been browsing around for a while trying to find an answer to the above question, and I have found some similar questions along with there answers, so I already have a vague idea how to answer ...
4
votes
1answer
146 views

how to organise common preamble of dtx files

I have some new packages (see latexthesistemplate/trunk/packages/template which all use a shared preamble file. I want all of them to have the same packages and commands available and the same ...
36
votes
3answers
2k views

Is it really bad to use \makeatletter and \makeatother in a package or class file?

In my answer to this question What do \makeatletter and \makeatother do? I apparently wrote: The commands should not be used within .sty and .cls files themselves as they may conflict with the ...
24
votes
2answers
2k views

\newcommand vs \DeclareRobustCommand

I sort of understand the difference between the two. But that's not what I'm interested in—I just want to know, which one should I use? In general, when I'm creating commands in a package or class, ...
1
vote
0answers
77 views

Name collision in package development [duplicate]

Possible Duplicate: choosing macro names so as to avoid namespace conflicts How package developer find out whether other packages already used a specific command name or not? How do they ...
17
votes
1answer
594 views

How to write overlay-specification–aware macros that work w/o the beamer class

The LaTeX beamer class provides with \newcommand<> and \newenvironment<> an interface to define own commands that can deal with beamer's overlay specifications. Internally, commands ...