{tex-core} is for questions that are independent of formats and macro packages. 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}.

learn more… | top users | synonyms (1)

5
votes
2answers
78 views

Output Location of Element

Suppose I have a LaTeX document, the entirety of whose content is: $\frac{a+b}{c}$ Now, suppose I want to bounding rectangles for the $a$, $b$, and $c$. Is there a way to DEFINE A FUNCTION "bbox" ...
7
votes
2answers
112 views

\write and \ifmmode

This is related to a previous question of mine (if I understand correctly, \write works a bit like \edef). Consider the following code: \documentclass[varwidth,convert={size=640}]{standalone} \...
5
votes
1answer
190 views

\edef, \xdef and \ifmmode

I don't understand the difference between \edef and \xdef in the following code. Clearly, the \xdef does what I'm expecting but why? AFAIK, $ does not start a group. \documentclass[varwidth]{...
3
votes
2answers
55 views

What are the rules for style change in formulas (Plain TeX)?

Both numerator and denominator in the following two formulas are of the same size, namely \textstyle (from which we conclude, that: 1) style change does not affect the digit, which immediately follows;...
1
vote
1answer
44 views

Weird spaces after \magstepN

Consider example1: hello% world \bye In example2 a space is added between o and w, in comparison with example 1: hello% \magnification\magstep0 world \bye (It seems that space (which appeared ...
11
votes
1answer
171 views

Why does \moveleft not contribute to width but \moveright does?

Consider example1: \setbox1=\vbox{ \moveleft 1pt \vbox{\hrule width 4pt height 10pt depth 0pt} \hrule width 4pt height 10pt depth 0pt } \showbox1 The output: \vbox(20.0+0.0)x4.0 .\vbox(10.0+0....
6
votes
3answers
234 views

nested \ifnum commands

I'm trying to make macro to work in biblatex edition field. Logic is following: if edition =1 there is suffix -li (1-li) if edition>1 and if edition<21 there is prefix me- (me-15,me-20 ..etc) if ...
14
votes
1answer
386 views

How to write a two-pass system in TeX?

On page 400 of The TeXbook ("Dirty tricks" part) it is said: An output routine can also write notes on a file, based on what occurs in a manuscript. A two-pass system can be devised where TeX ...
4
votes
1answer
66 views

Why depth of \vadjust does not influence interline glue?

Consider the following examples: example1.tex %\input vadjust_hook \def\marginalstar{\strut\vadjust{\kern-\dp\strutbox\specialstar}} \def\specialstar{\vtop to \dp\strutbox{ \baselineskip\dp\...
7
votes
2answers
136 views

Why does the redefinition of \par disable \nopagenumbers?

Let's disable page numbers: \nopagenumbers Hello world. \bye Page numbers appear if we redefine the nearest \par: \begingroup\def\par{\endgraf\endgroup} \nopagenumbers Hello world. \bye If we ...
6
votes
1answer
168 views

How are dimensions converted in multiplication and division?

In the TeXbook it is said (page 118): Multiplication and division are possible too, but only by integers. ... Dimension values are integer multiples of sp (scaled points). Example 1. Result is ...
1
vote
1answer
56 views

How to get last box in vertical mode?

I'm trying to get the contents of a paragraph with \showbox via \vadjust, by overloading \par. I came up with this: \showboxdepth\maxdimen \showboxbreadth\maxdimen \let\oldvadjust\vadjust \def\...
9
votes
2answers
1k views

What is a macro, really?

From the list of catcodes, \ starts a new control sequence, { starts a group, and } ends a group. In LaTeX, a macro appears as \foo[opt-arg]{arg1}{arg2} However, TeX does not seem to have the ...
3
votes
1answer
290 views

How to convert pdflatex to word [duplicate]

I have a tex document with math formula, figure, tikz drawings. What is the best way to convert tex to doc format. I tried with latex2rtf, pandoc, ... but nothing works. Can someone write step ...
6
votes
1answer
136 views

Weird error after \showthe

I'm trying to understand the meaning of \p@ from plain.tex: \newdimen\p@ \p@=1pt % this saves macro space and time While trying to figure it out, I stumbled upon strange behavior. Consider this: \...
5
votes
1answer
80 views

How is a page produced in the output routine?

Compare this \nonstopmode \tracingonline=1 \showboxdepth=\maxdimen \showboxbreadth=\maxdimen \output={\shipout\vbox{ \unvbox255 \showlists }} \nopagenumbers \noindent A \bye and this \...
6
votes
1answer
72 views

Question about exercise 12.17 in TeXbook

This is exercise 12.17 (This is a sequel to exercise 12.2, but it's trickier.) Describe the result of \line{\hfil A puzzle.\hfilneg} This is exercise 12.2 Describe the result of \line{\hfil\...
0
votes
1answer
77 views
21
votes
3answers
2k views

Why does TeX remove braces around delimited arguments?

On pp. 203–204 of the TeXbook, Knuth describes how TeX absorbs macros' arguments: delimited go until the first appearance of the delimiter, and undelimited go until the next token, in both cases ...
7
votes
1answer
79 views

Question about vertical glue (concerning example from TeXbook)

The question concerns The TeXbook, page 78, 4th dangerous-bend paragraph. For example, let's suppose that \baselineskip=12pt plus 2pt, \lineskip=3pt minus 1pt, and \lineskiplimit=2pt... Suppose ...
4
votes
1answer
93 views

Question about space factor after \char

The TeXbook page 76: When ligatures are formed, or when a special character is specified via \char, the space factor code is computed from the individual characters that generated the ligature. ...
6
votes
1answer
149 views

Why does \loop behave differently depending on order of its contents?

Just a question out of curiosity. I tested the code below, and first two {\loop...\repeat} commands returned \TeX!\quad six times, and others returned it five times. Why do only first two {\loop...\...
1
vote
0answers
28 views

More than 3 included .eps files causes single page to be broken into two pages [duplicate]

I am working in MikTex, trying to put more than 3 .eps drawings onto a page. After the third .eps drawing is added, the next drawing gets pushed onto the next page. Here's my Tex code; I can provide ...
2
votes
1answer
321 views

How TeX reads what you type

These questions are connected with this answer: Carriage-return and line-feed in web2cTeX Suppose TeX is reading an input file and is at the beginning of new line, in state N. New end-of-line ...
4
votes
4answers
591 views

One-liner for removing characters from a string

I have a predefined command \mycommand which, for some reason, outputs {"/home/user/di rect ory/"/}. (Yes, there's a slash after the quotation mark, and there are curly braces.) Could one think of a ...
4
votes
1answer
144 views

How is “noindent” different from “parindent0pt + leavevmode”?

Why these two examples produce different results? \parindent=0pt \leavevmode \hbox to 0pt{\hskip -\parindent \bf 8.}% Lorem ipsum dolor sit amet. \bye \noindent \hbox to 0pt{\hskip -\parindent \...
6
votes
1answer
112 views

Why hbox does not start a new paragraph?

These two produce the same result: abc %\null def \bye abc \null def \bye These two are different: abc %\null def \bye abc \null def \bye Does anybody know where this behavior is ...
1
vote
0answers
19 views

Three ways of grouping: compare and contrast [duplicate]

Grouping is often important in TeX/LaTeX programming. I know of three ways to delimit a group: Via a \begingroup…\endgroup pair; Via a pair of matched braces {}; Via a \bgroup…\egroup. Now I am ...
6
votes
1answer
448 views

What is the difference between “-interaction=nonstopmode” and “-halt-on-error”?

Scripting with xelatex I know halt-on-error makes it possible to use xelatex in loops within scripts without causing scripts to hang up when a document does not compile, but why do we need ...
1
vote
0answers
111 views

Is there any programming language similar to TeX? [closed]

I know nothing about programming, so TeXMaker's pseudo-WYSIWYG reminded me of a stereotypical programmer.
2
votes
0answers
29 views

Why must parameters for inner macro definitions double each #? [duplicate]

Or "When would an expression like ###1 be useful?" In macro programming, it's a well-known rule that you need to double your parameter identifiers with each successive layer: \def\insult#1#2{% #1 ...
11
votes
2answers
221 views

Is it possible to define a dotted version of `\vrule`?

The \vrule primitive has a nice charcateristic: it has the ability of adapting itself to the height and depth of the enclosing box: \documentclass{article} \newcommand\TestBox{\parbox[c][3cm][c]{1em}...
10
votes
2answers
2k views

debug No room for a new \write problem

I have a template with an extensive documentation. (See TemplateDocumentation.pdf). It compiled several month ago. Now with updated packages it does not compile anymore because of the famous No room ...
52
votes
5answers
8k views

Shortest code causing “Emergency stop.” error

This question is purely academic. TeXing a file containing \valign{\halign#\cr! causes an ! Emergency stop. error. Is that the shortest code which produces a fatal error in TeX?
0
votes
1answer
99 views

Where can I get a LaTeX command explanation? [duplicate]

For example, I do not know the definition of the LaTeX command \ensuremath. Where can I get its accurate meaning? Is there one professional website to offer some information about this?
12
votes
1answer
2k views

Where do arguments of \kern, \hskip etc. end?

In TeX, code like I\kern37ptlike\hskip100ptcake works perfectly well. That makes me wonder how exactly the syntax of primitive commands like \kern, \hskip etc. work? How does TeX determine where their ...
4
votes
1answer
105 views

Where can I find documentation on what “\char” does?

I've seen samples of TeX using \char`\\ to produce a literal backslash. Where can I find documentation on what the \char command does? Is it a generic construct to safely produce reserved literals?
13
votes
0answers
157 views

What type of Chomsky hierarchy is TeX? [duplicate]

There are four types of chomsky hierarchy (specified for formal languages): Type-0 Recursively enumerable Type-1 Context-sensitive Type-2 Context-free Type-3 Regular I consider that, it should ...
53
votes
5answers
1k views

\let\foo\bar vs \let\foo=\bar

Both uses of the \let primitive often lead to the same result. Is this even true for every case? What was the thought process behind it. And if they are actually not equivalent, are there particular ...
4
votes
1answer
90 views

How to expand control sequence in argument of a macro

Consider the following: \def\foo#1#2 {% \if#1a% \message{#2} \fi} \def\x{abc} \edef\y{\foo\x} \y The result: ! Argument of \foo has an extra }. The expected result: bc
5
votes
1answer
127 views

Equivalent Leaders construction

What is the equivalent construction of \leaders\hrule height 1pt depth 1 pt\hskip 20pt \relax in terms of the following construction or something similar \leaders\hbox{\vrule height 1pt depth 1pt}\...
28
votes
1answer
391 views

Exercise 17.21 of Knuth’s TeXbook: a (known) error?

Exercise 17.21 of The TeXbook asks a question concerning \delcode: Appendix B defines \delcode‘< so that there is a shorthand notation for angle brackets. Why do you think Appendix B doesn’t ...
27
votes
3answers
635 views

How to define phantoms for depth and height?

In the third "dangerous bend" on page 178 of of The TeXbook there's the following description of \vphantom: Even more useful than \phantom is \vphantom, which makes an invisible box whose height ...
10
votes
1answer
155 views

Rearranging blocks (poetry) in OTR (Plain TeX)

I have a problem that I think would best be solved by an output routine. It seems like an act of moderate TeX wizardry so before I get stuck in the weeds on a wrong approach I thought I would describe ...
6
votes
3answers
299 views

Non-latin characters with plain TeX

What would it take to output non-latin letters (e.g. cyrillic letters) to a document using just plain TeX (i.e. without using "third-party" macro packages such as LaTeX)?
25
votes
1answer
1k views

Knuth “Some Implementations of TeX”…

In Appendix D of The TeXBook, p. 387, in a discussion about automatic column sizing, Knuth tantalizes us with this: Some implementations of TeX display the output as you are running, so that you ...
5
votes
1answer
92 views

TeX: Lining up three boxes

This question is really a continuation of my previous question. Basically, I'm wondering why this does not work: \hbox{\vbox{\hbox{This is}\hbox{A line}}\hfil\vbox{\hbox{And so}\hbox{Is this}}\hfil\...
9
votes
1answer
172 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 ...
5
votes
4answers
349 views

Hiding particular output files: namely, .aux and .log files

Is it possible to hide .aux and .log files? If so, what would be the most low-maintenance/simple way of doing so? They create quite a bit of clutter. I have a folder where I'm tending to a bunch of ...
0
votes
0answers
79 views

Can not update packages in Tex Live Utility after installing Tex Live 2015 [duplicate]

since Tex Live 2015 was released these days, I updated it. I´m using a Mac. Now I wanted to check for package updates in the Tex Live Utility. But that does not work, unfortunately. First strange ...