Questions tagged [primitives]

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

Filter by
Sorted by
Tagged with
5 votes
3 answers
165 views

Testing "sequentiality" of \expandafter (plain Tex) - weird results

Trying to have a better understanding/controlling over \expandafter, I wrote this code. \count100 = 0 \count101 = 1 \def\c{% \the \count100 \advance \count100 by \count101\relax}% % \everypar{\...
user avatar
0 votes
0 answers
30 views

How to use \newlinechar and \endlinechar primitives to output position information at the beginning and end of each line of text?

If I want to use the \newlinechar and \endlinechar primitives to output the position information at the beginning and end of each line of text, what should I do?
user avatar
  • 149
0 votes
1 answer
51 views

MetaPost: mpost and plain.mp

Am I right that 'pure' MetaPost (mpost), without plain.mp, knows only primitive commands? So that MetaPost compiler + plain.mp is like a pure TeX + PlainTeX or TeX + any other macros package? Is it ...
user avatar
  • 515
1 vote
0 answers
34 views

How to output the name of a command at the same time when calling a command

I know that using everypar can print some information every time everypar command is called. I want to know whether it is possible to print the name of the command at the same time when the command is ...
user avatar
  • 149
9 votes
3 answers
425 views

Syntax of TeX for primitives that demand braces

TeX defines some primitives which some of them expand (or try) the following tokens before execute itself; others even require argument between braces. But I couldn't get the point in this case. \...
user avatar
4 votes
2 answers
98 views

Statements about \noexpand in source3.pdf and in the TeXbook

The LaTeX3 sources, released 2021-07-12, says in section "23.7 Description of all possible tokens" of "Chapter 23: The l3token package /Token manipulation": Expanding \noexpand ⟨...
user avatar
  • 22.9k
5 votes
1 answer
474 views

How to typeset ordered pairs?

I'd like to typeset ordered pairs with comma-separated components while \langle and \rangle as their delimiters. I want line breaks at commas for an ordered pair in inline math mode. So I came up with ...
user avatar
5 votes
2 answers
110 views

How to create a paragraph that show the number of line it contains?

Trying being brief... How can I create a paragraph that shows meta information, e.g., mentioning the number of lines or words it contains, using TeX primitives only? It's very important that such ...
user avatar
3 votes
2 answers
81 views

Redefine \pdfouput=1 to be ignored

How I can redefine the command \pdfoutput=1 to be ignored? I need to compile a file with lualatex (see https://tex.stackexchange.com/a/586129/33634) but it contains the command \pdfoutput=1. I cannot ...
user avatar
1 vote
0 answers
38 views

Getting the name of control sequence token - which values of \escapechar besides 32 require special attention?

I'd like to get the name of a control sequence token as sequence of character tokens. With \relax I'd like to get relax. The preceeding escape character is to be removed from the result of \string\...
user avatar
1 vote
4 answers
370 views

Minutes command in TeX

Someone told me, minutes were accessible in TeX, but I cannot find a command to call this. How do I call minutes in TeX? Please do not tell me about the construction of minutes out of \the\time, I ...
user avatar
4 votes
0 answers
93 views

What is the essential/crucial difference between \scantokens/\tex_scantokens:D and \tl_rescan:nn?

Part III The l3names package—Namespace for primitives, Section 1 Setting up the LaTeX3 programming language of interface3.pdf says: This module is entirely dedicated to primitives (and emulations of ...
user avatar
  • 22.9k
5 votes
2 answers
130 views

Glue not needed in alignment templates?

Consider this simple alignment (note lack of \hfil in template) \halign{#&#\cr a&b\cr aaaaaaaa&bbbbbbbbb\cr } To my surprise, this does not give Underfull \hbox in alignment error! The ...
user avatar
2 votes
1 answer
178 views

\vadjust example on Tug.org

I was on Tug.org reading about some of TeX's primitives. I came across this example usage of \vadjust. 1. \def\strutA#1#2{\vrule height#1 depth#2 width0pt} 2. \def\ta#1% 3. {% 4. \strutA{8.5pt}{3....
user avatar
  • 139
0 votes
1 answer
154 views

Multiple glossaries on a single page with a chapter-title

The setting is that I need to have two glossaries. They should be separated just by a \medskip and not by a \newpage-break. To stow them properly, I thought of putting them in a single chapter List of ...
user avatar
  • 151
1 vote
1 answer
56 views

Why does unhboxing seem to ignore vertical mode and why does unvboxing seem to ignore horizontal mode?

First question Why does unhboxing seem to ignore vertical mode and why does unvboxing seem to ignore horizontal mode? The MWE after the next two pictures both delivers the text of the first question ...
user avatar
2 votes
1 answer
58 views

The effect of triggering the re-writing/creating anew of a text file which currently is processed via `\input` puzzles me?

I tried to create a .tex-file fileb.tex which can be \input by filea.tex and which - when being input - stops being input and triggers rewriting itself. In my first attempts I erroneously omitted \...
user avatar
  • 22.9k
6 votes
2 answers
128 views

Why does `\endinput` bring TeX into interactive mode while there are still tokens to process?

Minimal example consists of two files: fileA.tex: \def\foo#1{#1} \foo{\endinput\input fileB.tex}% fileB.tex: This is file B. \bye I assumed that compiling fileA.tex would lead to a file fileA.pdf ...
user avatar
22 votes
1 answer
12k views

Difference between \hfil and \hfill

I am trying to understand the difference between \hfil and \hfill. I always thought that these commands were roughly equivalent except that \hfill was "stronger" than \hfil. As a result, I thought ...
user avatar
12 votes
1 answer
4k views

what is \kern good for

What is \kern instruction good for and how is it defined? I cannot find it in Knuth's book TeXbook.
user avatar
  • 1,838
5 votes
1 answer
102 views

Get correct results for overwritten font identifier

How can I get a correct font identifier with \showthe and \the after it is overwritten? The MWE is below (Same result with all of Knuth TeX, pdfTeX, XeTeX, (e-)pTeX, (e-)upTeX and Aleph. Only LuaTeX ...
user avatar
4 votes
3 answers
127 views

Overriding control sequences for accessing TeX's integer-/dimension-/glue-/..-parameters

In TeX there are a lot of parameters which you can adjust for changing the behavior of TeX. Example 1: By assigning \baselineskip=... you change distance between lines. Why TeX's breaking-paragraphs-...
user avatar
1 vote
1 answer
169 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 ...
user avatar
3 votes
1 answer
465 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 ...
user avatar
19 votes
3 answers
1k views

Is there a list of expandable TeX primitives? LaTeX? e-TeX? others?

According to Christian Hupfer's comment I understood that calculations are possible in a keyval list when the macro is expandable. The macro \numexpr being expandable, calculations are possible. ...
user avatar
  • 23.2k
1 vote
1 answer
242 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 \...
user avatar
5 votes
1 answer
165 views

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

This question refers to LuaTeX-engines prior to luatex 1.10.0 in texlive 2019. With luatex 1.10.1 in texlive 2019 and later the \string-primitive works as expected. Where can I find exact ...
user avatar
  • 22.9k
1 vote
1 answer
530 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 ...
user avatar
  • 929
3 votes
1 answer
562 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: !...
user avatar
  • 929
1 vote
1 answer
201 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 ...
user avatar
  • 1,423
0 votes
0 answers
319 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 ...
user avatar
  • 929
6 votes
2 answers
1k 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 ...
user avatar
  • 3,414
15 votes
2 answers
1k 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 \...
user avatar
3 votes
1 answer
93 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 ...
user avatar
  • 3,733
9 votes
2 answers
30k 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 ...
user avatar
  • 4,325
17 votes
2 answers
974 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 ...
user avatar
10 votes
2 answers
10k 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); ...
user avatar
  • 1,587
3 votes
2 answers
889 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)?
user avatar
  • 479
10 votes
3 answers
2k 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 ...
user avatar
  • 101
1 vote
5 answers
365 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 ...
user avatar
  • 929
0 votes
2 answers
119 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, ...
user avatar
0 votes
1 answer
212 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 ...
user avatar
1 vote
1 answer
52 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 ...
user avatar
17 votes
3 answers
962 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, ...
user avatar
  • 351
7 votes
1 answer
318 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 ...
user avatar
  • 50.9k
1 vote
0 answers
277 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 ...
user avatar
1 vote
0 answers
75 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 ...
user avatar
  • 660
28 votes
2 answers
2k 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. \\.
user avatar
12 votes
1 answer
3k 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 ...
user avatar
9 votes
1 answer
294 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 ...
user avatar
  • 581