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
97 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 ...
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. ...
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 ...
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 ...
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 ...
4
votes
1answer
203 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
115 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}{ ...
23
votes
3answers
554 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 ...
9
votes
5answers
733 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 ...
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 ...
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 ...
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, ...
17
votes
1answer
595 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 ...
6
votes
1answer
383 views

suffix package, cannot redefine a suffixed macro

I have two local packages A and B. Package B is used occasionally to override macros defined in package A. Package A defines a macro and, using the suffix package, also defines a starred version of ...
1
vote
0answers
217 views

What is the use of @ and @@ in variables names in TeX/LaTeX? [duplicate]

Possible Duplicate: Why do LaTeX internal commands have an @ in them? What do \makeatletter and \makeatother do? What is the difference between \myname and \my@name while writing a .cls file? ...
28
votes
2answers
2k views

What does \z@ do?

in parcolumns it has \z@ all over the space. I don't see it define it anywhere so I assume it is some internal command or something? I can't really make heads or tails of it though and I can't really ...
0
votes
1answer
297 views

Adding border/frame around boxes [closed]

I'm trying to modify a package to suit my needs but since I'm not very familar with the tex macro language I would like to add a border around the boxes created by the package so I can see exactly ...
7
votes
2answers
237 views

Emulate a “tuple” data structure (when you are free to choose the syntax)

How can a "tuple" data structure be implemented in LaTeX? The idea is to store several elements (possibly a predefined number) in one macro and then be able to extract each of these elements by index ...
6
votes
3answers
226 views

Emulate a “tuple” data structure when the syntax for creating a tuple is predefined and cannot be altered

Imagine I have a macro \createcontact that accepts three parameters. Now, instead of using these during the expansion, I would like to save them separately for later use and retrieval. The above macro ...
25
votes
1answer
576 views

Macro naming best practice?

Is there a preferred or generally accepted idiom for naming user defined macros? I notice that in the change from Tufte 3.5.0 to 3.5.2, for example, the names of the debugging macros have change, for ...
6
votes
1answer
142 views

Nested parameters lost when generating new macros from package options

I've created a package which I would like to take in options and turn these into new macros (one new macro for each option). I also want these new macros to produce new macros in turn. For example, ...
15
votes
3answers
558 views

How would you name these fraction macros?

I've got four macros now for typesetting fractions in text mode. The first writes them horizontally (shilling style, with a hyphen), the second writes them diagonally, the third writes them ...
10
votes
2answers
321 views

How to specify an optional final argument with \newcommand?

I'm writing my first package, and I'm trying to work out how to create a new command with an optional final argument. In this instance, if an argument is omitted, it defaults to blank. This is ...
6
votes
3answers
262 views

How to remove all dashes (-) using a macro?

In a package, I'm building macro names from the values of options passed to a function. Now, the values should also allow a - inside, but the command names I'm building with \csname do not. So, I need ...
9
votes
3answers
196 views

Backward compatibility for command names

I have made a class file. It defines commands for use in document files. I want to change some of the command names, but I also want old document files to work without changing them. Here's an ...
4
votes
1answer
816 views

Use \newcommand with a variable inside a style file

I have the following code which I put inside the preamble of my LaTeX documents: \newcommand{\modulecode}{SESG6025} \newcommand{\lecturetitle}{Interpolation} In this case, that means that when I'm ...