{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)

1
vote
1answer
40 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 ...
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
181 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 ...
8
votes
5answers
379 views

What's the best practice way to test whether parameter is empty?

I have a macro that might work either in LaTeX or in plain TeX and I'd like to test whether one of its parameters, which presumably should be just text, is empty. Currently I do it this way: \bgroup ...
6
votes
1answer
106 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
74 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
70 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 ...
0
votes
1answer
55 views
21
votes
4answers
1k 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
68 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
71 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
143 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 ...
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
308 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
519 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
117 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
106 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
194 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
99 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
28 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
195 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} ...
8
votes
2answers
1k 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
7k 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
81 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
633 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 ...
3
votes
1answer
71 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
155 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 ...
51
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
78 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
82 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 ...
27
votes
1answer
356 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
562 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
150 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
270 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)?
23
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
83 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 ...
9
votes
1answer
160 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 ...
4
votes
4answers
339 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
78 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 ...
8
votes
0answers
121 views

Feed fontdimen parameters to TeX

I have decided to use \fontdimen parameters as an array of numbers (to store data about Unicode Character Properties). The question now is to fill in those \fontdimen parameters in the most efficient ...
9
votes
1answer
140 views

Question about exercise 7.5 in TeXbook

Consider this extract from TeXbook: EXERCISE 7.5 Experiment with TEX to see what \string does when it is followed by an active character like ~. (Active characters behave like control ...
55
votes
1answer
1k views

Can TeX generate “heap dumps” to analyze+optimize out-of-memory situations?

As package author of the memory-extensive package pgfplots, I have been asked to analyze some out-of-memory situation. I could identify the "culprit"; it was some call to \pdfmdfivesum in which it ...
7
votes
1answer
50 views

What's the most plain way to define a parametrized macro within an outer macro definition

I often want to pass some arguments into a macro definition that defines an inner macro with parameters. For example \def\outmac #1,#2.{% \def\argone{#1} \def\argtwo{#2} \def\inmac ...
29
votes
1answer
724 views

What does “expanding” mean in (La)TeX?

You can often read about expanding a macro or when a macro does expand, sometimes about expansion. But what does this mean - in English?
4
votes
1answer
143 views

In LaTeX, what is the most efficient way to search for an optional token in given input?

My question is inspired by this comment by Joseph Wright. Let's say we have input strings with varying character combinations, such as: ...
1
vote
1answer
42 views

Writer2Latex table border removal

I'm using Writer2Latex to convert my .odt file, created in Google Docs and downloaded as .odt format, to .tex. It works but because there is no way to create columns of text in Google Docs other than ...
2
votes
1answer
171 views

Alignment in an enumerate environment using “\hspace” and “\hphantom” commands

I give a display of the first three problems from a multiple-choice test in algebra. The choices in the first problem are displayed using a tabbing environment, and the choices in the second and third ...
4
votes
0answers
121 views

Which algorithms does (La)TeX use? [closed]

People often talk about the many "typesetting wonders" (La)TeX can do because of the countless algorithms it uses. But exactly what are these typesetting algorithms? Concrete examples I have gathered ...
4
votes
1answer
78 views

Declaring array of integers

Is it possible to declare in TeX array of integer numbers ? What I am trying to do is to declare new tabular environment for very long tables spanning accross multiple columns and (or) pages. My ...