{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}.
13
votes
1answer
86 views
On the basics of writing to & reading from auxiliary files (.aux, .toc, etc.)
Some actions (e.g. generate the table of contents) require two passes of the TeX compiler: during the first, some data are written to some auxiliary file, only to be retrieved during the second pass.
...
5
votes
0answers
63 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 ...
13
votes
5answers
189 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}
...
36
votes
3answers
528 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 ...
8
votes
3answers
949 views
How to make a ruler
In The TeXbook (Ch. 10, after exercise 10.3), DEK shows some nice rulers. But I couldn't figure out how he did them. I'm sure I could look it up from the texbook source, but for some reason I'm ...
7
votes
2answers
47 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 ...
7
votes
2answers
107 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?
...
7
votes
2answers
158 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
3answers
462 views
\aftergroup a list of tokens
\aftergroup executes the next token after the end of the current group. Is there a variant, \Vaftergroup{\some\tokens\a\b} that would put \some\tokens\a\b after the current group ends? Of course, one ...
3
votes
0answers
50 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 ...
20
votes
5answers
808 views
More Modern Reimplementations of TeX
There is no doubt that the original Pascal/WEB implementation of TeX is a masterpiece and I have learnt a lot reading through the source code (both weaved and tangled) but it definitely shows its age. ...
9
votes
1answer
267 views
Computer Modern font with accented characters (in XeTeX)
I'd like to use Knuth's Computer Modern font with XeTeX (not with XeLaTeX and so not with a LaTeX package) in a way where I don't have to type accents in a \'-way and without any gimmick such as ...
5
votes
1answer
30 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 ...
22
votes
5answers
731 views
How to find out where a macro is defined?
Using \@ifdefined (in LaTeX), we can check whether a command is defined.
Using \meaning, we can get the definition of a command.
Can we also get information about where a command was defined? For ...
13
votes
3answers
101 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
93 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 ...
19
votes
2answers
391 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
...
3
votes
1answer
61 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 ...
10
votes
2answers
280 views
Starting point for getting more familiar with TeX/LaTex etc
Background: I've been using what I would call LaTex for ~4 yrs to typeset assignments, reports, essays and tutorial notes. I have been using "TexShop" (for Macs) - mostly because it was simple when I ...
1
vote
0answers
42 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 ...
34
votes
2answers
570 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 ...
46
votes
5answers
7k views
What is the difference between TeX and LaTeX?
I know LaTeX and I've heard that LaTeX is a set of macros in TeX.
But what does it exactly mean?
3
votes
3answers
112 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, ...
12
votes
3answers
362 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 ...
6
votes
1answer
67 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 ...
52
votes
3answers
869 views
Why isn't everything expandable?
TeX's macro processor does its work in a process called expansion. For an input stream of tokens, the macro processor repeatedly expands them until non-expandable tokens remain. The resulting stream ...
11
votes
3answers
129 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 ...
7
votes
2answers
67 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
1answer
101 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
61 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}
...
19
votes
2answers
315 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
98 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 ...
40
votes
3answers
805 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 ...
15
votes
1answer
106 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
122 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 ...
1
vote
0answers
36 views
Is there an interface to call the Hyphenation Algorithm in plain TeX?
As the title said. Which TeX engine can do that? Knuth TeX, XeTeX, pdfTeX, or LuaTeX?
10
votes
1answer
82 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 ...
17
votes
2answers
2k views
How do I split a string?
I need to split a string into one or more substrings. I know that I could use the xstring package, but I'd like to do it using only inbuilt TeX/LaTeX commands. So, if I say
\def\MyTeXKnowledge{Not ...
21
votes
2answers
177 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 ...
1
vote
1answer
157 views
What Linux operating system contains patgen for hyphenation?
This question follows previous one. In TexLive, patgen command prompts error of "No such file or directory". I found at About.com that Linux contains patgen. I have Linux Red Hat 9.0 in my system. Can ...
5
votes
1answer
262 views
How to use translate_file correctly in patgen of TexLive?
This question follows previous one about use of patgen.
I installed TeX Live 2011 (thanks Martin) and find patgen (version 2.4) command.
According to manual, command is:
patgen dictionary_file ...
9
votes
1answer
137 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:
...
3
votes
1answer
51 views
Suppress output for a group
I have an \item style command where I need to be able to suppress output for the following text. I can do this with \nullfont, but that seems like a poor hack. Is there a declaration that will ...
10
votes
1answer
117 views
How to install or replace fonts in old TeX files?
I got interested in a research paper from 1991, which I cannot get an electronic online version of. The author was kind enough to send me his tex sources, but is himself unable to produce a pdf file ...
4
votes
3answers
255 views
How could the macro xii.tex be simplified into a better readable form
I was reading some TeX guides from where I have found this source:
\let~\catcode~`76~`A13~`F1~`j00~`P2jdefA71F~`7113jdefPALLF
PA''FwPA;;FPAZZFLaLPA//71F71iPAHHFLPAzzFenPASSFthP;A$$FevP
...
1
vote
1answer
51 views
How to check if a fragile macro value is empty or will not create text with plain TeX conditionals?
A similar question has been already asked here, but has not been answered yet for fragile commands such as eg. \@author?
What would be the right way to get detect if \author has been called with a ...
24
votes
4answers
2k views
How to check if a macro value is empty or will not create text with plain TeX conditionals?
I have a macro which holds some text value, e.g. \macro{some text}. If it is empty, I would like for nothing to appear in the document, but it has some content of any kind which would produce text ...
8
votes
1answer
79 views
Why doesn't \mathord work to turn an Acc atom into Ord?
Writing ${\dot X^a}^b$ produces a very cryptic "double superscript" error: this has been explained here on this forum: the reason is that {\dot X}^a generates an Acc atom and that, for a reason that ...
35
votes
4answers
1k views
Typesetting limitations of LaTeX
What are the typesetting limitations of LaTeX? In other words what are the things that desktop publishing and word processing programs do better than LaTeX? I am not really interested in things that ...
4
votes
1answer
73 views
representing literal characters in a \newcommand or \def
Consider this short LaTeX document:
\documentclass[11pt]{article}
\usepackage[T2A]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[russian]{babel}
\def\name{...}
\begin{document}
Hello: \name
...
