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

Filter by
Sorted by
Tagged with
7
votes
2answers
269 views

Why can I say \input something but not \centerline something?

I am currently reading through the TeXbook (6th printing, March 1986). In chapter 6 Knuth explains that \input story can be used to load/process story.tex. However, in the preceding chapter the ...
0
votes
1answer
78 views

Multiplication and division with counters while also formatting

See the code that follows. The user gives some pairs of numbers. Each time they happen also to be displayed. Finally they are added up in a specific way. \documentclass{article} %\def\Result... \...
41
votes
4answers
3k views

How does your mind bend \expandafter to its will?

Expansion is often cited as one of the most arcane aspects of TeX, more akin to witchcraft than to something easily picked up by the newcomer. There are many great questions and great answers about ...
6
votes
1answer
397 views

Get next chunk of text (of specified size) contained in a macro

Let's say we have a lot of text to be typeset contained in a single macro, let's call it \myverylongtext \newcommand{\myverylongtext}{ This is some really long text: \blindtext[4]. And it ...
1
vote
0answers
41 views

Specific instrument for correcting mistakes

I'm searching a specific instrument for Latex. My teacher showed me it once, but i cannot remember the name. It's functional in general is for long files, with big amount of code and formula's: when ...
1
vote
1answer
31 views

Why does pdflatex fail with newline in equation source? [duplicate]

I recently encountered behavior I've never seen before. This compiles fine: \documentclass{article} \begin{document} \begin{equation} f = x \end{equation} \end{document} But this fails: \...
2
votes
0answers
78 views

Why is the newline character not printed on terminal after entering batch_mode?

When TeX stops on an error, we can answer Q. In such case in the log file this is printed: OK, entering \batchmode... But on the terminal thsis is printed: OK, entering \batchmode<terminal ...
4
votes
1answer
78 views

Why `interaction` is changed(*) from error_stop_mode to scroll_mode right before exiting TeX?

Consider the following two extracts from tex.web: interaction:=scroll_mode; jump_out; "X":begin interaction:=scroll_mode; jump_out; I can't understand the reason behind interaction:=scroll_mode. ...
6
votes
4answers
423 views

Appending a character to a token list using its charcode

Is there any way to obtain the actual character token from its character code representation? In particular, I would like to have a macro \prepend#1#2 that takes a token list #1 and prepends the ...
1
vote
2answers
276 views

Get Height/Width of Parent Box

In cases when input text to be typeset is separate from the structured template, can the input determine the height and width of its containing box? An example input. Question marks (?) to be ...
2
votes
0answers
77 views

Which significance does 100000000 have as overflow boundary in Pascal?

A recent conversation about bug-free software at work has lead to a discussion about TeX (which is considered virtually bug-free, while it might technically be false). Since TeX's source code is ...
5
votes
3answers
271 views

What is the purpose of a <filler> in TeX's syntax?

Many of TeX's primitives require a <general text> as their argument (e.g. \uppercase), which is defined as (TeXbook p. 276) <general text> -> <filler>{<balanced text><...
24
votes
3answers
569 views

Get the lion to run in loops. Tersely

Various constructions can cause TeX (aka the lion) to go into an infinite loop. The simplest example is \def~{~}~, which defines ~ to expand to itself, then expands it. Now, if we exclude macro ...
12
votes
5answers
809 views

“Clever tricks” for using \outer macros

From TeX by Topic, p. 111: For certain applications, however, it is inconvenient that some of the plain macros are outer, in particular macros such as \newskip. One remedy is to redefine them, ...
1
vote
1answer
129 views

Lower diacritics sometimes centering as opposed to upper diacritics

It seems there are some inconsistencies in how upper diacritics (\", \u, etc.) behave as opposed to lower diacritics (\c, \k, etc.). Upper diacritics are placed on the first character (or \i/\j) of ...
5
votes
2answers
257 views

How to find out the number of lines in a paragraph for \hangafter

I want to have the last line in a paragraph be filled with an \hrulefill which sticks out 1cm to the right of the paragraph margin, like in this picture: To typeset the above, I used \hangindent and \...
39
votes
2answers
2k views

Typesetting curiosity: word change on one line does not affect how that line is set, but affects how the next line is set

The following two paragraphs differ only in that the first one uses "his" on the first line and the second one uses "her". \documentclass[12pt]{book} \RequirePackage[adobe-utopia]{mathdesign} \...
4
votes
2answers
105 views

Text variant vs font switch - bfseries

I stumbled into the following sample \documentclass[a4paper,11pt]{article} \usepackage[english, ngerman]{babel} \begin{document} Quick test - not yet bold "\textbf{Bold text for test - part 2} ...
10
votes
1answer
258 views

Shortest code to make INITEX produce printable output

What is the shortest sequence of characters that will lead to a printable page of output when processed by INITEX? Meaning no formats like plain.tex preloaded, and with output of positive width and ...
0
votes
1answer
41 views

How to decide the location of an image in LaTeX document?

I am new to LaTeX and stuck on this image formatting thing for my algorithms class. My source looks like this: \documentclass{article} \usepackage{graphicx} \begin{document} \title{COMP3027 ...
2
votes
1answer
52 views

When do curly braces disappear in macro definitions? (e.g. \documentclass expansion)

I've been looking into how \documentclass and friends are actually defined, and I noticed something peculiar which I'd like to understand. Let's say I have \documentclass[11pt, titlepage]{article}. ...
0
votes
0answers
51 views

Operator space mismatch

Operator space differ for first number and subsequent numbers in inline math, how to fix it throughout in inline math? e.g., $-3 -3$ \documentclass{article} \begin{document} analyse the effects of ...
1
vote
2answers
129 views

What's wrong with `\string`?

I am using the algorithm2e package to typeset my algorithms. I want to be able to control the caption numbering style. More specifically, I want the caption number to be enclosed in curly braces and ...
1
vote
1answer
108 views

How do parskip and similar parameters behave

Im trying to format a twocolumn article document with some twocolumn spanning graphics, small tables etc. I used \raggedbottomfor evading huge whitespace/glue in my text, but sometimes the space this ...
0
votes
0answers
58 views

`LaTeX` documentation and reference guide [duplicate]

Is there anything such as LaTeX documentation? When I am looking for some syntax on google, I only get to forums, but never a site with actual documentation, such as when looking for the meaning of \...
0
votes
0answers
49 views

Why does \if in a tikzpicture evaluate to true for \if 33 \empty? [duplicate]

I have the following code: \documentclass[11pt]{article} \usepackage{tikz} \begin{document} \newcount\x \x=-1 \begin{tikzpicture} \foreach \percentA in {33} { \if \percentA \empty \else \...
5
votes
3answers
203 views

Trying to understand a line in latex.ltx (regarding \string, \escapechar and \csname in the definition of \newif)

I'm trying to understand how exactly TeX parses documents, and with respect to that, the definition of \newif confuses me quite a lot (in latex.ltx, line 929ff): \def\newif#1{% \count@\escapechar \...
0
votes
1answer
109 views

When a string may be assigned to an array?

In section 51 of tex.web there is this: name_of_file ← pool_name; { we needn’t set name length } where name_of_file is (sectoin 26): name_of_file : packed array [1 .. file name size ] of char; and ...
5
votes
2answers
96 views

Why are spaces needed in the end of string array?

In section 11 of tex.web is this: @!pool_name='TeXformats:TEX.POOL '; {string of length |file_name_size|; tells where the string pool appears} and in section 519 is this: for ...
3
votes
0answers
245 views

How is TeX/LaTeX parsed?

I have some questions about TeX/LaTeX parser and parsing TeX/LaTeX after reading the following: Limitations when parsing TeX as a context-free grammar This is a PEG parser, which means it interprets ...
183
votes
10answers
22k views

Why is LaTeX so complicated? [closed]

I have been using LaTeX professionally almost every day for almost 10 years, so I think I can say that, by now, I more or less know what I'm doing. I also do a lot of ordinary computer programming, in ...
3
votes
1answer
64 views

Additional hrule in halign after page break

I try to spread a halign over more than one page. I use \filbreak after every line. \tracingonline=1 \advance\vsize by -15cm \def\tablerule{\noalign{\hrule height .3mm\filbreak}} \newcount\posno\...
1
vote
2answers
89 views

Three identical copies of a page

I need to print one page three times. Is it possible, in plain TeX, to output two exact copies of the last page without incrementing the page number?
4
votes
1answer
97 views

Different vsize for first page

Is it possible to alter the vsize for the first page? I tried this: \vsize=20cm \def\pagebody{% \ifnum\pageno=1% \advance\vsize by -8cm% \vskip13cm\vbox to \vsize{\boxmaxdepth=\maxdepth ...
2
votes
3answers
135 views

Change separator in tex code / for loop

I found this very useful macro to add rows to a table (while defining the rows externally from the table): Command to continually add to table with a command/macro In my case the macro has only some ...
0
votes
1answer
41 views

Prevent LaTeX from adding paragraph after blank line

I like to put a lot of comments inside my documents, even between sentences. To make the comments more visible I would like to put a blank line between the comment and the sentence before like this: ...
3
votes
1answer
106 views

Alternating command

Is it possible to have a command alternate its behaviour? My idea is something like this: \documentclass{article} \def \current {c} \def \abc { \ifx\current{a} \def\current{b} \...
1
vote
3answers
87 views

Allow spaces between arguments in a macro definition

I don't know if it's right to allow this kind of practice, but I've been asked many times. How do you allow spaces between square brackets and parentheses in the code below? I try to use \@ifnextchar ...
8
votes
4answers
187 views

How to safely check by means of expansion-methods whether a list of tokens contains a token which is defined in terms of \outer?

I take the following question for a moot thing. Nonetheless it makes me sick that I don't see a good and robust solution myself. ;-) Assume something like this: \def\unfold{\umbrella My bald head ...
0
votes
0answers
143 views

Getting text to flow around images in either TeX or LaTex

For years I've been using HTML to produce web pages with text flowing nicely around images. Here's an example of the sort of thing: As you can see, the images are floated left and right, and may ...
0
votes
0answers
71 views

How to put upper dot to a kannada font in XeLaTeX?

I'm a beginner in XeLaTeX programming. I need to put an upper dot to some kannada fonts in a PDF. I used the following code snippet to do that. But the output is negative. Please help me in this. ...
23
votes
2answers
494 views

Should different TeX implementations (e.g. MiKTeX's and TeX Live's) produce identical DVI files?

It is said that TeX is supposed to work identically on all systems. For example, Knuth's TRIP test exists to ensure that any program can be called “TeX” only if it does certain things given certain ...
4
votes
1answer
222 views

When error lines are divided into three parts?

Usually TeX divides error lines to two parts. But sometimes three. When and why this happens? Consider the following example. If final \hfil is removed, only two lines are displayed at the top, but ...
2
votes
1answer
142 views

How TeX sets glue for \halign entries?

On p.235 of TeXbook it is said: TeX reads an entire \halign{...} specification into its memory before typesetting anything, and it keeps track of the maximum width of each column, assuming that ...
0
votes
1answer
151 views

Why does \ifdim work here but \if doesn't?

I'm very new to LaTeX, and need to compare a length I've defined with a default value (and set another length accordingly). Consequently, I'm exploring the murky (to me anyway) world of LaTeX ...
3
votes
1answer
79 views

Inserting tokens after \input

The answer for this should be pretty simple, but I just can't seem to find how to do it. I'm trying to use \afterassignment to make syntax for a section header and then use TeX's lexing for \input to ...
2
votes
1answer
95 views

How \show must print null control sequence?

On p.46 of TeXbook it is said \csname\endcsname is the same as empty (aka null) control sequence. But why they are printed differently by \show? Compare \endlinechar=-1 \def\ {a} \def\x{\ } \show\x ...
7
votes
3answers
352 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 ...
5
votes
1answer
893 views

Showing expanded \let command with \typeout

I have already seen the related page macros - What is the difference between \let and \edef?, but I'm afraid it still doesn't expain to me the following MWE: \documentclass{minimal} \begin{document}...
0
votes
1answer
50 views

Compiling lextex example

I am trying to use the lextex macros. For this, I started by taking a look at the example file. I tried to follow the instructions and run tex &plain example1.tex but this gives the message ...

1
3 4
5
6 7
34