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

11
votes
1answer
237 views

TeX capacity exceeded, sorry [semantic nest size=500]

Reading through tex.web, I note that there is a difference between grouping levels and semantic nesting (i.e., the nesting of math, horizontal, and vertical modes). I can think of commands which ...
29
votes
1answer
1k views

How to generate “You can't use \unskip in vertical mode”?

We all know (or believe so) that \unskip is not possible in main vertical mode and this statement can be found in various answers on the site. And yes LaTeX does a lot of gymnastics in \addvspace or ...
4
votes
1answer
180 views

How to make a rich png image from a Latex Math Equation [duplicate]

I have a LaTeX math equation that I have been trying to convert it into a rich .png image by compiling the .tex file into .dvi and then from .dvi to .png. But I noticed that the Image is small and the ...
3
votes
1answer
98 views

Hook tex macro without altering tokens stream

Is is possible to hook a macro with function which writes some info to file or log without altering stream which creates dvi file. For example if i have macro definition \def\foo{\mathop{A}} and i ...
9
votes
1answer
109 views

Interactively look up macro definitions

In a TeX document, the primitive command \show will print out the current definition of a macro one level deep (it won't (and can't?) reduce to primitives). This comes with the restriction of actually ...
2
votes
1answer
455 views

How to convert an A5 document (PS or PDF) to an A4 document (PDF)?

I have a document with A5 pages (created from a TeX file) and want to combine pairs of A5 pages to A4 pages. That is, without scaling, page 1 and 2 of the A5 document should become page 1 of the A4 ...
16
votes
2answers
292 views

Use of \everyeof and \endlinechar with \scantokens

The e-TeX \scantokens primitive allows retokenization of input. However, it is almost always used in a group where \everyeof and \endlinechar are set (see for example Can I convert a string to catcode ...
16
votes
3answers
267 views

Can I convert a string to catcode 11?

In the TeX FAQ there's a way to test if the jobname is equal to something (comparing the jobname). The difficulty of the naïve test is that the contents of the \jobname primitive are catcode 12 so to ...
18
votes
1answer
305 views

Drawbacks of redefining math accents with extra leading {}?

As I discovered through the non-bug latex/4253, TeX has a (mis)feature whereby it ignores braces around a \mathaccent construction: ${a_b}_c$ works, but ${\tilde a_b}_c$ fails with a "Double ...
7
votes
1answer
426 views

Is there likely to be an xpsTeX?

The 2007 TUG April Fools' announcement was pretty funny, but does this idea have any traction whatsoever? From a design point of view, XPS may be the starting point for future document formats beyond ...
12
votes
2answers
157 views

What would be a suitable replacement for ifcsname in a non-etex situation?

From the pgfkeys.code.tex file: % This is useful: \def\pgfkeys@ifcsname#1\endcsname#2\else#3\fi{\expandafter\ifx\csname#1\endcsnam e\relax#3\else#2\fi}% \ifx\eTeXrevision\undefined% \else% ...
12
votes
2answers
536 views

Is a TeX macro defined?

I am looking for a way in TeX to check if a macro was defined. Currently I use a rather tangled way. I exploit a sort of side effect when comparing two macros via \ifx; this command returns: true, ...
32
votes
3answers
764 views

Why doesn't TikZ's \foreach iterate over the last element of the list?

This code \documentclass{report} \usepackage{tikz} \begin{document} \begin{tikzpicture} \draw[dashed] (1,-1) -- (1,2) node[above] {$1$}; \draw[dashed] (2,-1) -- (2,2) node[above] {$2$}; \foreach ...
54
votes
3answers
3k views

2013, year of the TeX bugs report. Will pdfTeX, XeTeX, etc. be changed accordingly?

Barbara Beeton said (TUGboat vol. 34, pag. 4): As noted on Don Knuth's TeX web pages, www-cs-faculty.stanford.edu/~knuth/abcde.html, he "intend[s] to check on purported bugs again in the ...
11
votes
4answers
190 views

Partially expanding a command

My \john command is defined like so: \def\john{\DontExpandMe} I would now like to repeatedly change its definition, to keep adding some extra stuff on the front. \foreach\i in {ape,bat,cow,dog} { ...
54
votes
2answers
1k views

If LaTeX is only a macro package, why does it have its own executable?

From other answers on this site and the FAQ of the TeX User Group my understanding is that: TeX is the original typesetting program, written by Knuth Omega, eTeX, pdfTeX, XeTeX, LuaTeX are engines. ...
17
votes
1answer
135 views

What primitives can expandably tell us about the current horizontal list?

I've been writing some code that expands macros and catches characters and non-expandable primitives as they reach TeX's stomach, and I encountered an issue: since I gather letters one by one, with ...
8
votes
2answers
700 views

Highlighting haskell listings in large *.tex document [duplicate]

Suppose, there is a large *.tex document, which has many nested \input directives with many Haskell listings surrounded by \begin{code} \end{code} commands. How can all this code listings be ...
7
votes
1answer
602 views

TeX ignores \vskip at the beginning of document

Here is a simple Plain TeX snippet for demonstration \vskip 3in Aaaaa \vskip 3in Bbbbb \end When I compile this with pdftex, I expect to see a 3-inch-high blank space, then Aaaaa, followed by ...
6
votes
2answers
243 views

Learning how to use TeX for automatic layout of non-technical documents

Whenever I try to learn more about TeX or LaTeX, I am stymied by the general bias of the books and online resources I have seen, and possibly by the bias of LaTeX itself. I am not interested in using ...
7
votes
0answers
85 views

What is the difference between \def and \newcommand (Part II)? [duplicate]

A previous question What is the difference between \def and \newcommand? has discussed the difference between \def and \newcommand at some length. However, I cannot find in that discussion an ...
41
votes
1answer
874 views

On the basics of writing to & reading from auxiliary files (.aux, .toc, etc.)

Some actions (such as generating the Table of Contents) require two passes of the TeX compiler: during the first pass, some data get written to an auxiliary file, only to be retrieved during the ...
13
votes
5answers
284 views

Checking if a string contains # with its original catcode

At comp.text.tex the following scheme was suggested for testing if a string contains the parameter character with catcode 6. \def\endcheck{\endcheck} \def\second#1#2{#2} ...
8
votes
2answers
125 views

\setbox containing maths interferes with surrounding math mode in XeTeX

I encountered what might be a bug in XeTeX (but I would be glad to be proven wrong) while chasing a strange interaction between bytefield, unicode-math, and mathtools. In general, I do not expect a ...
44
votes
3answers
1k views

Why no vertical-mode Knuth-Plass?

I have only basic knowledge of the TeX internals, so I hope what I am saying here is not complete nonsense. If I understand correctly, in TeX, horizontal positioning / line breaking is done using a ...
7
votes
2answers
191 views

Stupid error caused by doing stupid things

When I was writing my thesis I wrote the following two commands which I found useful (and still do). They are both ways of defining other commands. \usepackage{ifthen} \makeatletter \def\optional ...
7
votes
2answers
136 views

Why does TeX attempt to insert 'missing' tokens?

"Missing \cr inserted", but it looks to me like it's already there! Missing $ inserted ... Why does TeX attempt to insert missing tokens? Why doesn't it simply throw up and die? ...
3
votes
0answers
250 views

What is a working python code snippet for escaping a string, so that it can be included in a tex file? [closed]

I'm using python to populate a tex template with arbitrary strings - and I would like to escape the strings so they're interpreted and displayed properly inside the tex file (rather than having them ...
5
votes
1answer
40 views

How to use tangle to merge to get a single merged file from original source and change files

I'm trying to read and understand the TeX source, but it is difficult to keep track of when I should be reading code from the original file and when I should be reading code from the change file. I ...
15
votes
3answers
1k views

Difference between \mskip and \mkern

What are the differences between \mskip and \mkern? The TeXbook writes the following (ch. 18): You can insert math glue into any formula just by giving the command ‘\mskip⟨muglue⟩’. [...] ...
7
votes
3answers
800 views

How do I get the width of \hfill?

In my LaTeX document, I have a first line with a given spacing obtained using \hfill, then a paragraph, and then a third line in which I would like to use the same spacing as in the first line. The ...
3
votes
1answer
69 views

TeX document allowing any byte sequence being inserted

Out of a hacker's interest, I looked for a TeX document into which an arbitrary byte sequence can be inserted without causing the TeX process to fail, but had a similar issue; I basically set all ...
19
votes
2answers
444 views

Outright impossible TeX byte sequence

Out of a hacker's interest, I am wondering if there is any byte sequence that can never occur in any valid TeX document before \end is processed. I thought of things like {\catcode`}=9\catcode`\=9 ...
1
vote
0answers
47 views

Errors after TeX Live 2012 update on Ubuntu 12.04 [duplicate]

I wanted to use mdframed package but I was getting the error package not found. I followed the advice here to update to Text Live 2011. However, I figured out there is Tex Live 2012 and therefore ...
3
votes
3answers
198 views

How exactly are TeX and LaTeX related? [duplicate]

I know that plain TeX is the low-level typographical language that describes nearly every aspect of presentation, taking care of things like paragraph breaks, new pages, and the like. I know (well, ...
17
votes
3answers
2k views

How to compile the source code of TeX

I am more and more interested in the system TeX (and LaTeX) and I want to study it more deeply. I am not telling that I want to learn how to use it, but I want to understand its mechanism now. The ...
7
votes
1answer
306 views

\pdfstrcmp or \strcmp in pure TeX

I'm trying to get LaTeX3 working with an old e-TeX kernel, and it fails due to the lack of \pdfstrcmp (or XeTeX's \strcmp equivalent). Is there a pure TeX definition of \pdfstrcmp that I could insert ...
45
votes
2answers
2k views

Electronic version of Knuth's “TeXbook”?

I have a printed copy of the TeXbook (from D.E. Knuth) at home. Now that I travel a lot, I don't want to take my library with me every time. Question: Is there a legal way to obtain (=purchase) a PDF ...
11
votes
3answers
313 views

Understanding etoolbox \ifdefempty and \ifdefvoid

I am trying to understand the etoolbox \ifdefempty and \ifdefvoid macros. The documentation says that \ifdefempty Expands to true if the control sequence is defined and is a parameterless macro ...
10
votes
2answers
211 views

Determining the math class of a non-keyboard symbol

What is the "right" way of determining the math class (e.g. ordinary/0, relation/3, closing/5, etc.) of a non-keyboard symbol? Something like \oplus is easy enough to guess, but I wasn't immediately ...
6
votes
2answers
320 views

How to not have widows and orphans without using raggedbottom

I know I can set \clubpenalty and \widowpenalty to 10 000 to make them “really bad”, but then TeX sees it equally bad to cut the page short when there is no vertical stretch (i.e. \parskip=0pt), and ...
4
votes
2answers
126 views

Change display style in xlop package

I recently discovered the package xlop to typeset automatically elementary school calculations. Using this for division for example like this, gives the output below. \documentclass{article} ...
20
votes
2answers
892 views

TeX's algorithms for “breaking paragraph into lines” and “setting the glue”

I want to learn more about the implementation of TeX's text-justification algorithm (setting the glue). After scanning through ch.12 of Knuth's TeXbook, I'm guessing that setting the glue must ...
7
votes
2answers
156 views

Deleting an element from a comma separated list

In this answer we learnt how to remove the n-th element from a comma-separated list. How can I remove an element from a list by its value, rather than its position? For example: if my global variable ...
42
votes
3answers
871 views

Why/When should I pay attention to warnings?

I often see warnings in the compilation-log of my tex-files. I searched in the internet and did not find a good answer to this question. And in my opinion there must be a reason why tex warns me about ...
22
votes
2answers
400 views

What is the differences between mathcode and catcode and how can I use mathcode?

The command \catcode is often used to change some internals. E.g. the command \makeatletter changes the catcode @. But what is \mathcode and how does it work? catcodes are well explained here: Wiki ...
7
votes
3answers
136 views

Sorting to match a given list

I am looking for ideas on the following task. I want to sort the entries in \listb to those in \lista. It cannot always be assumed that only the elements of \lista are in \listb; neither can it be ...
10
votes
1answer
144 views

How to get the natural width of the last box in a paragraph?

I want to get the natural width of the last line in a paragraph. For example, the last line of the following paragraph Georg Friedrich Bernhard Riemann (September 17, 1826 – July 20, 1866) was an ...
25
votes
2answers
487 views

What are lccode and uccode used for?

In TeX, each of the 256 bytes has an associated \lccode and an \uccode, integers in the range [0,255] which indicate among other things how \lowercase and \uppercase act. There are of course a bunch ...
11
votes
1answer
475 views

Using \toks registers

I was reading this tutorial for TeX programming: http://pgfplots.sourceforge.net/TeX-programming-notes.pdf recommended in the 2-nd answer here: Where do I start LaTeX programming? It says: ...