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 ...

7
votes
1answer
162 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
39 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
45 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
41 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 ...
9
votes
2answers
166 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
81 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
41 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 ...
1
vote
1answer
26 views

How to place a landscape table on a portrait page without clearing the current page?

Following the post https://tex.stackexchange.com/questions/19017/how-to-place-a-table-on-a-new-page-with-landscape-orientation-without-clearing-t/453774?noredirect=1#comment1141155_453774 I would ...
4
votes
1answer
83 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
88 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
295 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
115 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
36 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
27 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
12 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
54 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
114 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
61 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
246 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
114 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
51 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
131 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
80 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
205 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
109 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
96 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
45 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
96 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
62 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} \...
2
votes
1answer
44 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 ...
0
votes
0answers
110 views

What is the original TeX format and how can we emulate it in latex

I am referring to the doc width, line spacing, fontsize, fontfamily, margins etc .. I have a feeling that they look differently. Would I stand corrected that their defaults are different ? IF so, how ...
6
votes
2answers
188 views

context-sensitive macro: look behind?

I try to fine-tune a macro depending on whether it is following a specific character/text. E.g., This is it! \great! Wait, what is \great? should become This is it! Grrreeeaaat! Wait, what is great?...
8
votes
1answer
258 views

Why there is \relax at the end of the definition of \raggedright?

(From the appendix of "The TeXbook") \def\raggedright{\rightskip=0pt plus2em \spaceskip=.3333em \xspaceskip=.5em\relax} It seems that many other plain TeX macros don't end with \relax. What makes \...
3
votes
2answers
125 views

First box in current vertical list?

Is is possible to get first box in current vertical list? If it is impossible, is it possible to define a macro that gets an argument and return first line (first box of vertical list) of that ...
1
vote
1answer
50 views

How can I get all box of a vertical list?

I know \lastbox is the last box in current list. Now my questuin is how can I access all boxes in current list. Thanks in advance.
4
votes
1answer
28 views

Macro Substitution/Expansion in Environment Names

I've noticed that you can use macros for substitution into environment names: \def\itmz{itemize} \begin\itmz \item Item the first \item Item the second \end\itmz % works It also works ...
2
votes
1answer
88 views

How TeX does its scale factor calculation? [duplicate]

With the following example \documentclass{article} \begin{document} \dimen0=1sp \dimen1=0.5\dimen0 \dimen2=0.99999\dimen0 \dimen3=0.999992\dimen0 \dimen4=0.999993\dimen0 \count255=\dimen0 \the\...
2
votes
1answer
36 views

Columnsep affect line breaks in a twocolumn paper

With the following code, TeX break lines after every two \myboxs, which is what I want. \documentclass{article} \RequirePackage[a3paper,landscape,twocolumn,columnsep=6cm,left=3cm,right=3cm]{geometry}...
1
vote
0answers
56 views

The most used latex symbols [closed]

I am creating a free offline latex tool for recognizing hand-written latex symbols https://zaidalyafeai.github.io/texter/ I want to improve the accuracy by knowing what are the most used latex ...
24
votes
2answers
666 views

How does TeX look for delimited arguments?

The following code \def\foo#1#2\baz{\#1: -#1- \quad \#2: -#2-} 1) \foo hello world\baz 2) \foo supercalifragilistiexpialidocious\baz 3) \foo a \baz 4) \foo a\baz %5) \foo \baz % error! \bye ...
11
votes
2answers
188 views

Why not catcode11 (letter) but catcode12 (other) is used for verbatim?

What would happen if catcodes were changed to 11 (letter) instead of 12 (other) in verbatim environment or something similar? Will any problems happen? Or, are there any advantages to use catcode12 ...
7
votes
1answer
177 views

What is difference between \box and \unvbox or between \box and \unhbox

What is difference between \box and \unvbox or between \box and \unhbox.
17
votes
3answers
475 views

About what TeX does after it finds commented conditionals with ltxdoc

When I thought I understood the concept of the doc package, LaTeX proved me wrong. I was trying to make a file to use with ltxdoc when I realised I could not use conditionals in the preamble because ...
2
votes
1answer
54 views

Inconsistent spacing between \unvbox and following text

The below MWE (from a cookbook document) has three parts: (1) a recipe name centered and in a 24pt script font, (2) a recipe story indented 17pts on the left and right and in a 12pt roman font, and (3)...
4
votes
1answer
121 views

Why latex does not compile when two newlines are inserted in math mode?

When you try to compile the following code: \begin{equation} \phi = \psi \end{equation} The compilation fails with this error message: ! Missing $ inserted. I know how to fix this. But still, ...
6
votes
1answer
320 views

How to quit TeX in interactive mode on CLI in Windows 10?

Suppose I have a file named demo.tex containing: \hrule \vskip 1in \centerline{\bf A SHORT STORY} \vskip 6pt \centerline{\sl by A. U. Thor} \vskip .5cm Once upon a time, in a distant galaxy called \"...
2
votes
0answers
63 views

What causes fatal errors and why TeX cannot produce any file if it occurs?

Besides the regular errors, there are fatal errors, like Fatal error occurred, no output PDF file produced! I have seen them happen when TeX capacity exceeds, the mysterious seac (see Automatically ...