{plain-tex} commands used for macro {programming}.

learn more… | top users | synonyms

11
votes
1answer
108 views

Can one safely redefine \jobname?

I want to access labels from an external document -- in general this is not a problem with the xr package. But in this case both documents are compiled on sharelatex, and there \jobname is always set ...
9
votes
1answer
135 views

Somewhat versatile usage of \@gobble and \@firstofone found in several macros

I was doing search about my question (see here for more detail) and found a thread commath and \ifinner. In the thread, there is a macro named \spx , the definition and usage of which are extracted ...
7
votes
1answer
109 views

Prevent scaling of printout of PDF without using hyperref

pdftex produces PDF. We need a viewer to view the PDF and print it. Some of those viewers tend to scale the printout: the letters shrink. This is a bug especially of the Adobe Reader and explained ...
21
votes
1answer
1k views

What does \/ do?

I've seen this in some tex file where a word is set in italics, but its ending is in regular font. Trying it out I don't see it making any difference, so I must be missing something. What does the \/ ...
4
votes
2answers
112 views

Trying to understand \def\def@ sintax primitives

I am trying to understand this syntax of primitive \def \DeclareOption{man}{% \def\def@man{\@manmode} } Why this primitive nesting? And I do not get to understand why there is two \def sentences ...
5
votes
2answers
170 views

New primitives and grammar for replacing horrible \expandafter

Time and time when I am trying to read or write some macros, I'm always frustrated by lots of \expandafters inside them. Why don't we add some new primitives and grammar into TeX engines to make ...
10
votes
1answer
135 views

List of all control sequences let to primitives in common formats

I would like to know a list of all control sequences which are let equal to primitives in common formats. For plain TeX for instance, we would get the list \endgraf % = \par \endline % = \cr \repeat ...
11
votes
3answers
453 views

Change \the\year

Is it possible to make LaTeX believe that the current year is 2012, so that \the\year prints 2012? \documentclass{article} \begin{document} % What to do so that the following prints 2012? ...
3
votes
1answer
136 views

Can I use a TeX primitive in a “before” and “after” macro? (and how?)

The Question Can I use a TeX primitive in a "before" and "after" macro? (and how?) There are two questions that I found useful and related to my question, which sent me in the right direction: how ...
25
votes
1answer
251 views

Which primitives does LaTeX2e rename/move?

TeX's primitives can be renamed by macro formats/packages: this allows new/altered features or behaviours. Usually this is done such that the originals are still available ('renamed'): certainly ...
13
votes
1answer
210 views

Which primitives does ConTeXt rename/move?

TeX's primitives can be renamed by macro formats/packages: this allows new/altered features or behaviours. Usually this is done such that the originals are still available ('renamed'): certainly ...
6
votes
1answer
355 views

Why should some TeX primitives never be set directly in LaTeX?

In an earlier question More economic and robust command for abstract at the beginning of chapters, David Carlisle told that one should never use directly some TeX primitives. How can I distinguish ...
1
vote
0answers
79 views

About those magic primitives [closed]

While learning TeX, I found some primitives are magic (e.g., \expandafter \futurelet \aftergroup). These primitives can change the expansion order of the input stream. Have anyone made any ...
8
votes
1answer
222 views

How can \ifx\\\\ be false?

It appears that I have a case where \ifx\\#2\\ is false, even though #2 is empty. Here is the relevant excerpt from the log file, with \tracingcommands and \tracingmacros turned on: \lastpageref ...
25
votes
1answer
566 views

Using elastic lengths — when do they work?

I was wondering why elastic lengths like \fill seem to work only under certain conditions. For instance if I write A \hspace{\fill} B I get A left aligned, B right aligned as wanted. If however ...
4
votes
2answers
288 views

ConTeXt doesn't implement some Knuth TeX primitives?

I try to use new TeX format ConTeXt, but I find that some TeX primitives don't act any more. How sad I am when I find that. An simple example is that in plain TeX, we can set the spaces between ...
6
votes
1answer
235 views

How to emulate \pdfstartlink and \pdfendlink with xetex?

In my ocgx package, I would use the new ocg-p package instead of the ocg package. With pdflatex or lualatex, all is good. But with xelatex, I obviously can't use \pdfstartlink and \pdfendlink (these ...
12
votes
3answers
544 views

A command to replace \middle| when it's missing?

I'm using this LaTeX plugin for a Wiki (Confluence, blech), and it doesn't support the \middle| command. I'm guessing it doesn't have eTex primitives or some such backwardness. Anyway, I guess I can ...
28
votes
3answers
27k views

how to suppress “Underfull \vbox (badness 10000) … while \output is active”?

when using an inflexible document class, one is often faced with the warning Underfull \vbox (badness 10000) has occurred while \output is active [] on pages that contain no display math. in ...
11
votes
2answers
2k views

Is it safe to temporarily redefine \and, \or, and \not?

I'm writing lots of logic expressions in LaTeX and I'd much rather write $p \and \not q \or r$ than $p \land \lnot q \lor r$. I was thinking of doing something like this: \newenvironment{logic}{% ...
3
votes
1answer
325 views

Converting command to result

Consider this example: \documentclass{article} \newcommand{\foo}{} \newcommand{\currentbar}{\thebar} \newcounter{bar} \setcounter{bar}{0} \makeatletter ...
25
votes
2answers
3k views

What are the exact semantics of \detokenize?

How does \detokenize work? The e-TeX Short Reference Manual states: When followed by a <general text>, expands to yield a sequence of character tokens of \catcode 10 (space) or 12 ...
10
votes
2answers
270 views

Which TeX primitives can be recovered after their initial definitions are overwritten?

This is mostly an academic question out of curiosity, but I think it may give some interesting answers. The question is, given a TeX file beginning with \def\someprimitive{}, for which values of ...
3
votes
1answer
234 views

Recursion - splitting a group.

I've been trying to understand the notion of recursion in TeX - not easy given that my background is the high-level stuff in LaTeX. The only examples I can (just about) understand are very basic ...
7
votes
1answer
347 views

\let a control sequence to a redefined primitive

pdfTeX version 1.40.0 introduced the primitive \pdfprimitive which the manual describes as follows. This command executes the primitive meaning of the following control sequence, if it has been ...
7
votes
1answer
357 views

Use case for pdfTeX's \quitvmode

While reading one of Lev's answers, I encountered a pdfTeX primitive \quitvmode that I have never noticed before. The pdfTeX manual states that this causes TeX to leave (internal) vertical mode and ...
16
votes
1answer
1k views

What does \marks do?

Recently I had cause to define a macro called \marks. If I try something like \newcommand{\marks}{fred} I get the error ! LaTeX Error: Command \marks already defined. In LaTeX, if I do ...
14
votes
3answers
667 views

Is there a printable version of a reference manual for all TeX primitives?

Everywhere in the TeX community, I see suggestions like \parskip, \obeylines, \parindent, etc. I'd be surprised not to find them even in the most basic LaTeX packages. So I figured they must be deeper ...