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 [tex-core]

{tex-core} is for questions for syntax, semantics and expected behavior of TeX primitive control sequences, regardless of extensions (eTeX, etc.) formats (Plain or LaTeX) and macro packages (tikz). Such questions usually relate to low-level TeX programming or the behaviour of TeX at an underlying level. Note that even Plain TeX is a format in itself; for questions about it, use {plain-tex}.

1
vote
0answers
71 views

Is there a little randomization on TeX default font which is not present in LaTeX default font?

It's more pleasing to me to stare at this... ... than to stare at this... One time Knuth commented that he prefers fonts with a little randomization on their design (Knuth, D. E. (1979). ...
7
votes
1answer
86 views

Can \relax be replaced by a space?

LaTeX defines \vec as \DeclareMathAccent{\vec}{\mathord}{letters}{"7E} which eventually is expanded to \mathaccent"017E\relax whereas plainTeX defines it as \def\vec{\mathaccent"017E } replacing ...
1
vote
1answer
21 views

Undo alternate command definition

I'm working with an automated system that injects some code that redefines the paragraph command: % Redefines (sub)paragraphs to behave more like sections \ifx\paragraph\undefined\else \let\...
14
votes
2answers
156 views

A Question About \futurelet

Here is something I don't understand about \futurelet, in this case, into macro \xfl. I can successfully do the archetypal test of \ifx\xfl x... to test whether the next token is an x. When true, ...
0
votes
0answers
43 views

How to \noexpand all its followings in one time

The macro \noexpand can only block expand of its first followings, i.e. for \noexpand\huge\color{red}, \color{red} is not effected by \noexpand. I want get a way to block expand of all in one time, ...
5
votes
1answer
117 views

Unable calculate value of coordinate by macro constructed by \newcommand in tikz

I construct a macro named \mycal(with an optional argument) to calculate value of coordinates which will be used in \tikz\draw. I find that with this optioal arg, the code can not compile. When the ...
7
votes
2answers
170 views

Non-alphabet letter in \csname …\endcsname

Why can't I get what I want in the following code? MWE: \documentclass{article} \begin{document} % \def\aaa*{*} \def\aaaAAA{AAA} |\csname aaaAAA\endcsname|% typeset |AAA| as I desired. |\csname aaa*\...
2
votes
1answer
76 views

What is the difference between badness and penalty?

What in LaTeX is the difference between badness and penalty? Are badness and penalty the same? In what range are the values for both, badness and penalty?
1
vote
3answers
79 views

@nameuse with value \relax in conditionals

This is a follow-up to this question: @nameuse as conditional where i asked about how to use \expandafter if i combine \@nameuse with \ifx. However, in my real-life example, i use \relax as a default ...
4
votes
2answers
133 views

@nameuse as conditional

Please consider the following, non-working, example: \documentclass{standalone} \makeatletter \parindent\z@ \@namedef{blafasel}{foo} \def\foo{foo} \def\bar{bar} \makeatother \begin{document}...
3
votes
2answers
43 views

Interacting with plain-TeX programs

Is it possible to read from stdin in plain TeX? I have seen that it is possible in LaTeX with \typein (See here), however, this is unavailable in TeX. Are there any alternatives? An MWE in LaTeX: \...
23
votes
3answers
1k views

How to properly smuggle (with or even without TikZ)?

I am seeking to find something that allows me to "broadcast" macros outside a group. Concrete examples include paths and scopes in tizpictures. Here is an M(N)WE. \documentclass[tikz,border=3.14mm]{...
2
votes
2answers
61 views

An acute diacritical mark not being typeset

Why is the umlaut over the "i" typeset but not the acute over the "e" typeset? \documentclass[10pt]{amsart} \usepackage[utf8]{inputenc} \begin{document} \noindent \textbf{10.) The author of Passage ...
2
votes
1answer
77 views

Running bashful on Windows

Since the author of the package \bashful claims: The pack­age may use other Unix shells than bash, but does not work with­out mod­i­fi­ca­tion in a Win­dows en­vi­ron­ment. https://ctan.org/pkg/...
0
votes
1answer
60 views

mathbb not working and mathbbm/mathds not compiling in rmarkdown

I'm trying to get the math 1 character in an rmarkdown file. \mathbb{1} just produces a simple 1, and \mathbbm{1} / \mathds{1} does not compile for some reason. title: "A3" header-includes: - \...
3
votes
1answer
224 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 ...
6
votes
1answer
103 views

Is there an advantage in converting user provided \hfuzz values to sp?

I was looking through the fancyvrb code. At a point it defines a key hfuzz as follows: \define@key{FV}{hfuzz}{% \@tempdima=#1\relax \edef\fv_hfuzz{\number\@tempdima sp}}} \fvset{hfuzz=2pt} ...
4
votes
3answers
226 views

What command should I use to be warned of this collision beforehand?

After a hunt through several subfiles, I've narrowed down what I thought was a bug down to this MWE \documentclass{article} \usepackage{amsmath, amssymb} \newcommand{\R}{\mathbb{R}} \begin{document} $...
1
vote
1answer
26 views

Tree diagram in same line

I'm trying to put the tree diagrams in the same line but they are coming in different lines. \documentclass[12pt,a4paper]{book} \usepackage[utf8]{inputenc} \usepackage{amsmath} \usepackage{mathtools} ...
2
votes
2answers
104 views

An error using \par\xdef\tpd

Why do I get an error message with \par\xdef\tpd{\region\prevdepth} but not with \par\xdef\tpd{\the\prevdepth}? \documentclass{amsart} \usepackage{mathtools} \usepackage[dvipsnames]{xcolor} \...
1
vote
2answers
39 views

Getting the proper interline spacing after a minipage environment

I have a TikZ diagram to the right of a minipage environment. I have some text that I want under the minipage environment. The interline spacing is about half of the other interline spacing. I don't ...
4
votes
3answers
123 views

Iterate over tokens

Assume I have a macro like \def\myMacro#1{<some stuff>} And I am calling it like this \myMacro{There are \some arguments \in \here g} How can I iterate over each single token in the #1 ...
3
votes
1answer
172 views

Check if macro is fully expandable

Question Is there a way to check whether a macro is fully expandable (or rather "safe in an expansion-only context" [1])? Consider this code: \def\a{Just a string} \def\b{\a} \def\c{\def\unsafe} \...
2
votes
1answer
23 views

Is it possible to write a class file that loops over the documentbody?

What I would like to achieve is a repeat.cls such that I could write a .tex file \documentclass{repeat} \begin{document} foobar \end{document} and then the document would contain 'foobar' a certain ...
1
vote
0answers
57 views

Is there any way to free up the TeX memory?

As described in this quesion TeX memory is very limited due to the limitation of the computer in time of TeX invention. I want to know is there any way to free up the TeX memory before reaching its ...
2
votes
1answer
200 views

Problem with | (\vert) in LaTeX

I am using a stylesheet to convert MathML to LaTeX. When I try to convert: <mrow> <mo>|</mo> <mi>a</mi> <mo>|</mo> </mrow> In latex that ...
0
votes
1answer
38 views

Defining colors in style file by forcing immediate expansion

I am writing a template for a poster (using beamer/beamerposter) package for students that I intend to distribute as a folder. It will contain a .tex file that the students can start editing, and a ...
3
votes
1answer
122 views

Write TeX Engine

What do I required if I want to write a TeX engine. Now I am reading The TeXBook, when I finished, I will read source2e next. Thus I am pretty curious about how to write a TeX engine myself, and what ...
3
votes
1answer
28 views

Overfull in vbox inside hbox with hsize of the same width

While learning with Plain TeX, I am trying to create a framed paragraph. I have started with the following code, which is supposed to limit the paragraph width but still enable the line breaking ...
6
votes
1answer
204 views

How to use packages in Plain TeX?

How to use packages in Plain TeX? Are there any packages for Plain TeX at all or are packages a feature only for LaTeX?
1
vote
1answer
80 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 \...
2
votes
1answer
114 views

Documents written in TeX (no LaTeX, no Plain TeX) [duplicate]

LaTeX and Plain TeX are formats for TeX and they ease creating document. But can we create documents using only TeX? I couldn't find any pure TeX sample.
3
votes
0answers
102 views

How does Tex layout engine work

Would it be correct to say that somewhere within Tex, there is a layout algorithm? If there is, is a description of the algorithm and abstractions it consumes and produces available? A question and ...
6
votes
1answer
114 views

Subtleties when using \def and \ifnum conditionals

I am having some difficultly comparing two numbers passed as arguments using \ifnum. Consider the command \def\comparenum[#1,#2] { \def\x{#1} \def\y{#2} \ifnum\x=\y TRUE \else FALSE \...
7
votes
1answer
186 views

token register vs. macro register

Consider the following simple code: \def\@ifundefined#1#2#3{% \cs{UNDEF}{DEF} \def\reserved@a{#2}% \def\reserved@b{#3}% \ifdefined#1 \let\reserved@c\reserved@b \else \...
3
votes
1answer
49 views

How to get core dump from VIRTEX?

Just out of curiosity, I stripped TeX source to a minimum from TeXLive build tree and compiled it successfully (it works in conjunction with texlive-lang-english package installed on Debian 10). You ...
4
votes
1answer
50 views

\mathop applied on colon

I thought I knew when \mathop centers its argument on the math axis and when it does not, but apparently I'm wrong (admittedly, that happens rather often :-)). \documentclass{article} \begin{...
2
votes
1answer
70 views

How to \input using relative or absolute path (in plain TeX)

I'd like to have my personal library of macros but I do not know how to import them from different directories other than the current one. And It feels super ugly to have symlinks to all files in my ...
10
votes
2answers
184 views

Does \leavevmode leave any tokens in the input stream

The standard (plain TeX) definition of is \def\leavevmode{\unhbox\voidb@x} where \voidb@x is a permanently empty box. This will force TeX to leave vertical mode, and so is widely used to start ...
3
votes
2answers
99 views

Define an active character inside a definition

\def\test{\catcode`!=\active \def!{test}} Of course the above code would not work because nothing is executed when TeX is reading the replacement text of a macro definition. ! gets catcode 12 anyway....
2
votes
1answer
46 views

Outer loop terminating early

I'm trying to implement the Euclidean Algorithm in LaTeX. Yes, I know I could do it more easily in python, but that's not the point. I have an inner loop (extracted to a macro) to compute the ...
4
votes
1answer
92 views

Using a macro with parameters in \everypar fails

Out of curiosity, I wonder why this fails: \documentclass{article} \usepackage{xparse} \NewDocumentCommand{\bla}{mm}{#1.#2!} \begin{document} \begingroup \obeylines \everypar={\bla} {C}{G} skdjfs;...
6
votes
2answers
99 views

What are the values for parameters of an \edef at the time of definition?

Suppose we have the following short document \documentclass{article} \def\foo#1{\if#1XX\else not X\fi} \edef\bar#1{\if#1XX\else not X\fi} \begin{document} foo: X = \foo{X}, Y = \foo{Y} bar: X = \...
11
votes
1answer
302 views

Is it possible to display all boxes I am currently in?

I'm currently reading Knuth's TeXbook. As an educational reference, is there a way to display a hierarchical list of all boxes I am currently "in" (in other words, I'm typing the document ...
1
vote
0answers
272 views

Why do people still use latex? [closed]

I have never really understood why people love latex. I think latex serves an important role in scientific community in establishing a consistent way of presenting a scientific writing. However, ...
3
votes
0answers
46 views

Get value of global token register from local group

Given the following sample code: \documentclass{article} \newtoks\foo \foo={foo} \begin{document} \the\foo, \begingroup \foo={bar} \the\foo \the\global\foo % <-- fails \endgroup \end{document} ...
2
votes
2answers
40 views

Use macro argument in \multicolumn column-specification

When creating table headings, a 1-cell \multicolumn is often used. To simplify this, one might make a table-head macro: % this definition works, but doesn't allow controlling alignment \newcommand{\...
0
votes
1answer
35 views

Is it possible to make two separate columns that aren't columns?

I know it is possible to make two columns, and to make two tables. I am wanting to know if it is possible to create two columns that aren't connected/flowing into each other. If one column is longer ...
6
votes
1answer
71 views

\let\newtoks=\relax % this allows plain.tex to be read in twice

\let\newtoks=\relax % this allows plain.tex to be read in twice ... \let\+=\relax % in case this file is being read in twice I came across this when I was studying plain.tex. I have some questions: (...
7
votes
2answers
126 views

When an implicit token is allowed?

Example: the latex code: \documentclass{article} \begin{document} % test-case 1 % Output: "b" % Expansion is not allowed, and implicit token doesn't take effect. \begingroup \let\implicitToken=b \...