Stack Exchange Network

Stack Exchange network consists of 174 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 ...

3
votes
3answers
195 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
19 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} ...
0
votes
0answers
8 views
2
votes
1answer
42 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
31 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
117 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
151 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
22 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
51 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
60 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
37 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
109 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
24 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
182 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
68 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
105 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
97 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
101 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
174 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
47 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
48 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
60 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
177 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
91 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
43 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
87 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
92 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
300 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
163 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
41 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
33 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
0answers
16 views

! I can't write on file `“RAA N.pdf”'. Please type another file name for output

I can generate pdf of the tex file saved in E drive. But, with the same tex file saved on desktop, I can't generate pdf. I got the following message "! I can't write on file `"RAA.pdf"'. ...
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
70 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
118 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 \...
7
votes
1answer
63 views

Using control sequence names to efficiently store a large amount of characters

When reading the thread about low-level arrays in TeX I stumbled over a note in Bruno Le Floch's answer: A long string of characters is stored more efficiently as a csname than as a list of tokens....
6
votes
2answers
252 views

What is the internal LaTeX working logic for \left and \right with delimiters?

I am reading about latex and in several books is written that to be able to size the delimiter to the vertical size of formula I need to use \left and \right. I understand that part. But I am ...
0
votes
0answers
21 views

What is the difference between control sequences begining with `\` and the ones begining with `\@`? [duplicate]

In all LaTeX packages documentations that show their internal codes, we see \@ and often we see \@@ or even \@@@. What is the difference between \ and \@? What does it mean to write more @ to start a ...
8
votes
1answer
116 views

Distinguish active characters from non-active pendants with expansion-methods only?

(Please take the following question rather for a moot point than for an everyday-problem.) Is there an expandable method for distinguishing an arbitrary explicit non-active character token from its ...
0
votes
2answers
63 views

Remove space after new line

I need to remove the space inserted by starting a new line in tex file. Exmple: file.tex: This is actually a paragraph that will continue to this new line. file.pdf This is actually a paragraph ...
3
votes
3answers
142 views

how can I compare strings using the if statement without package?

For example, \newenvironment{genPage}[2] {\clearpage\thispagestyle{#1}\normalsize\bfseries \if#2=c \centering \fi } {\newpage} \begin{document} \begin{genPage}{plain}{c} ...
4
votes
4answers
1k views

Why aren't all math functions wrapped in ensuremath? [closed]

It seems like it would make life easier, right? \vec{x} vs $\vec{x}$ Could there be a way to say, force all, or most math commands to automatically ensure math? Maybe an environment? I realize math ...
1
vote
0answers
82 views

How LaTeX builds the large horizontal/vertical brackets

Wondering about how LaTeX implements the vertical and horizontal brackets [{(⟨. I saw these unicode characters which could potentially be used for vertical brackets: ⎡ ⎢ ⎣ ⎤ ⎥ ⎦ ⎧ ⎨ ⎩ ⎪ ⎫ ⎬ ⎭ But ...
6
votes
2answers
251 views

Fully expand macro argument

I am sure this has been answered already, but I cannot seem to find any answer that explains it in core TeX primitives and that I understand on a token level, e.g. I definitely don't want to get into ...
4
votes
1answer
135 views

Problem with \hrulefill

(Note: \parindent is set to 0, for the sake better appearance.) \noindent\hrulefill\par %With one single \hrulefill I get nothing. a\hrulefill b\par %As desired. \noindent\hrulefill b\par %As desired....
1
vote
1answer
101 views

If TeX / LaTeX modifies the spacing between individual letters

Wondering if there is any compression / expansion of the between-letter spacing done in TeX / LaTeX. In looking at the font specs, I noticed they only have 2 horizontal properties: advance width and ...
2
votes
1answer
46 views

TeXbook Exercise 2.4 (triple quotes)

The exercise is to reproduce the two possible typings of ``` (three leftquotes). Immediately beforehand there is an explanation of how to do the same thing with three rightquotes, which I will rewrite ...
1
vote
1answer
99 views

Documentation on the Algorithms or Techniques LaTeX uses for Text Layout

I am wondering how LaTeX implements its algorithms for laying out the text. How it figures out how to break a word in the mid-dle to better fit on the page, or how it slightly compresses the words to ...
4
votes
2answers
65 views

filecontents non repeating execution of commands

As requested by Merging multiple different tables records. // Splitting table records in tables. I there is a command that I created (a varaint I found here). \newcounter{magicrownumbers} \...
4
votes
1answer
71 views

How can I get the complete list from \showlists

This is the code. I'm stupid. I'm stupid. I'm stupid. \showlists And this what I get from \showlists \### horizontal mode entered at line 1 \hbox(0.0+0.0)x20.0 \tenrm I \tenrm ' \tenrm m \...