Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [primitives]

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

1
vote
1answer
131 views

What is “# Notation”? How does the # syntax work?

Closely Related: How to implement \expandbefore, similarly to \expandafter? In the related question, a reference is made to the "# Notation". How does the syntax work? From an answer on the other ...
3
votes
1answer
273 views

Different file opened by \openin (was: between 2017 and 2018)

Short version: It seems that some trivial behavior of file opening (\openin) changed between TeX Live 2017 and 2018 differs between environment. Only Overleaf one behaves differently. I did not see ...
1
vote
1answer
92 views

TeX macro/primitive vs Plain TeX macro

I know there are TeX primitives and Plain TeX macros created (directly/indirectly) by TeX primitives. My question is are there TeX macro? E. g. I can use \break in pdfTeX without defining it and \...
4
votes
0answers
93 views

\string-primitive works in unexpected ways in LuaTeX — Where can I find exact documentation of the \string-primitive in LuaTeX?

Where can I find exact documentation of the \string-primitive in LuaTeX? I ask this question because I encounter some unexpected (at least by me) behavior when compiling the example below with LuaTeX....
1
vote
1answer
92 views

Changing text in Console output

I am finding that I am writing more and more packages/commands for other people these days and have started writing some nice default utility commands to use. However, there is always the concern for ...
2
votes
1answer
166 views

Error of \begin{problem} ended by \end{problem}… huh?

So, I know if I get a mismatch error like error: \begin{problem} ended by \end{document}, that means I have mismatched number of \begin and \end commands. But here, I am getting the following error: !...
1
vote
1answer
30 views

Swap many pair of command names in a row

I've learnt from this post how to swap two commands using the let primitive: \let\temp\first \let\first\second \let\second\temp \let\temp\undefined Now, in order not to flood my preamble with this ...
0
votes
0answers
95 views

Conditional to execute alternative code when error detected

I would like to be able to build a conditional to execute one set of code if the conditional would compile, versus another if the code would generate an error. Take the following code block which ...
5
votes
2answers
302 views

hide/show complete row of tabular

I need to toggle on/off full rows of a tabular via changing my preamble. My workflow only permits me to alter the first cell of each table in order to make it toggleable. My idea was to use the ...
14
votes
2answers
578 views

What's the difference between \hfil and \hskip0cm plus 1fil?

What's the difference between \hfil and \hskip0cm plus 1fil? In both cases, a glue token is created that skips by zero, but with 1fil of stretchability. If you use \hbox spread 4cm{\hfil test \...
3
votes
1answer
57 views

How to test if a macro is being expanded between \csname … \endcsname, in (e-)upTeX?

pdfTeX added some new primitives, based on e-TeX, including \ifincsname. When this primitive is being expanded between a pair of \csname ... \endcsname, the result of expansion will be true, otherwise ...
1
vote
1answer
8k views

How to fix the Underfull \vbox badness has occurred while \output is active on my memoir chapter style?

After some hours studying the warning Underfull \vbox (badness 2573) has occurred while \output is active on the question how to suppress "Underfull \vbox (badness 10000) ... while \output is ...
16
votes
2answers
623 views

Documentation of \mathop

The Dirac delta distribution is ubiquitous in physics. Since it is a special object I wanted to give it some extra spacing by using \mathop. I know that single letters inside \mathop are centred ...
8
votes
2answers
7k views

Practical consequences of using \over vs. \frac?

This question explains the difference between \over and \frac and it seems as though the most experienced members unanimously agree that \over is inferior (if not something to be outright regretted); ...
3
votes
2answers
405 views

List of Plain TeX macros [duplicate]

Where can I get a list of all Plain TeX macros. In the TeXbook, it is said that Plain TeX adds about 600 macros (to the ~300 TeX primitives). Where are they listed (with their documentation)?
9
votes
3answers
1k views

How to use @ifstar with arguments

I want to use @ifstar to define a command, whose non-star version stores a value in a variable and whose star version reads the value from the variable. I tried the following. It doesn't produce an ...
1
vote
5answers
252 views

Error trying to use \edef

Feel free to skip past this explanation to the code below. My issue is trying to get \Q@Selection to work with edef. I have a macro that uses a for loop to assign some dynamic macros that I am toying ...
0
votes
2answers
88 views

How to detect the range of possible character codes?

Please forgive me if this question is too basic for this forum. I came into touch with TeX three weeks ago. I learned that there are different TeX engines. E.g., there are TeX, eTeX, pdfTeX, pdfeTeX, ...
0
votes
1answer
97 views

How can I redefine \\ (\tabularcr) such that a space character afterward is ignored?

Here I append code to \\ that looks ahead to see whether the \end in \end{tabular} is up next to bat. This code is hidden within a \noalign. The \\ has code that looks for a star and then a [ before ...
1
vote
1answer
43 views

Is there a way to have \show not behave like an error? [duplicate]

Everybody loves the \show tex primitive. Sadly it so happens that whenever I \show something the execution/compilation which I call using pdftex -halt-on-error also stops, which was quite supprising ...
16
votes
3answers
750 views

The "^'' glyph in the TeXBook

TeX, plain TeX, within the source of the Texbook of Don Knuth, there is use of ^ in different command sequences, and in text bites. Is there a special meaning to ^ in TeX primitives, in plain TeX, ...
7
votes
1answer
161 views

computing md5sum of file content in XeTeX

PdfTeX has \pdfmdfivesum{...} and \pdfmdfivesum file {...} for inline text and external file content, respectively. On the other hand, XeTeX seems to provide only \mdfivesum. Is there a means to ...
1
vote
0answers
116 views

Where should I specify pdftex primitives? [duplicate]

I would like to suppress this type of warning by pdftex: PDF inclusion: multiple PDFs with page group So one solution proposed here is to use this primitive: \pdfsuppresswarningpagegroup=1 Where ...
1
vote
0answers
58 views

Append code to the \directlua primitive

LuaTeX provides the primitive \directlua, which is described in detail in section 1.6.1 of the LuaTeX reference manual. Basically, this primitive runs Lua code. Its syntax is: \directlua ⟨general ...
24
votes
2answers
1k views

What is a primitive, a macro, and how do they compare?

The title pretty much says it all. If it helps, I found myself asking this question when reading this post about \par vs. \\.
12
votes
1answer
678 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
261 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 ...
12
votes
1answer
708 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 ...
22
votes
1answer
2k 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 \/ ...
5
votes
2answers
222 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 ...
4
votes
2answers
220 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
241 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 ...
14
votes
3answers
2k 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? \the\...
3
votes
1answer
173 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 ...
29
votes
1answer
360 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
271 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 ...
8
votes
1answer
602 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 ...
8
votes
1answer
275 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 -&...
29
votes
1answer
2k 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 I ...
4
votes
2answers
384 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
364 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
1k 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 ...
57
votes
3answers
70k 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
3k 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
472 views

Converting command to result

Consider this example: \documentclass{article} \newcommand{\foo}{} \newcommand{\currentbar}{\thebar} \newcounter{bar} \setcounter{bar}{0} \makeatletter \newenvironment{baz}{\addtocounter{bar}{1}}{\...
36
votes
2answers
8k 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 (...
12
votes
2answers
313 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 \...
4
votes
1answer
257 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 for-...
10
votes
1answer
436 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 ...
8
votes
1answer
458 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 ...