Questions tagged [primitives]
{plain-tex} commands used for macro {programming}.
69
questions
5
votes
1answer
83 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 ...
5
votes
2answers
102 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 ...
3
votes
2answers
67 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 ...
1
vote
0answers
35 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\...
1
vote
4answers
312 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 ...
4
votes
0answers
77 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 ...
5
votes
2answers
126 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 ...
2
votes
1answer
91 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....
0
votes
1answer
85 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 ...
1
vote
1answer
44 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
...
2
votes
1answer
53 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 \...
6
votes
2answers
99 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 ...
19
votes
1answer
5k 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 ...
7
votes
1answer
2k 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.
5
votes
1answer
90 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 ...
4
votes
3answers
104 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-...
1
vote
1answer
158 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
432 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 ...
19
votes
3answers
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.
...
1
vote
1answer
200 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 \...
5
votes
1answer
153 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 ...
1
vote
1answer
389 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 ...
3
votes
1answer
417 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
119 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
223 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 ...
6
votes
2answers
754 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 ...
15
votes
2answers
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 \...
3
votes
1answer
84 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 ...
8
votes
2answers
24k 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 ...
17
votes
2answers
827 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 ...
10
votes
2answers
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); ...
3
votes
2answers
715 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
320 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
113 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
183 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
47 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 ...
17
votes
3answers
889 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
265 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
237 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
72 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 ...
28
votes
2answers
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. \\.
12
votes
1answer
2k 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
281 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 ...
16
votes
1answer
1k 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 ...
23
votes
1answer
3k 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
284 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
275 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
270 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
3k 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\...