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

13
votes
2answers
475 views

\expandafter within a \begingroup … \endgroup [duplicate]

Possible Duplicate: What does \begingroup\expandafter…\endgroup do? In many of Heiko Oberdiek's packages one sees this type of construction: ...
13
votes
3answers
546 views

Can I make a command not gobble spaces?

(I'm using ConTeXt, but I suspect the answer will lie in plain TeX.) I've created an environment that takes one argument myBufferName, and stores its contents in a buffer of that name. Unfortunately, ...
13
votes
3answers
885 views

How can I open a file in “append” mode?

Could not find anything in the TeXBook, but this could be just me. I guess it is always possible to open the file for reading, copy its content to another file, and then continue writing to that ...
13
votes
2answers
237 views

Difference between one glue and two glues after each other

Is there a difference between A\hskip 1pt \hskip 0pt plus 1fil B and A\hskip 1pt plus 1fil B ? Are these two glues the same in terms of spacing and (line-)breaking? Or do they just add up, as I ...
13
votes
1answer
122 views

Difference between “hbox group” and “adjusted hbox group”?

eTeX's \currentgrouptype distinguishes two types of \hbox group types \hbox{\showthe\currentgrouptype} % 3 "adjusted hbox group" \noindent \hbox{\showthe\currentgrouptype} % 2 "hbox group" Looking ...
13
votes
2answers
1k views

Write to log without wrapping

I'd like to to generate some metadata in the log file that I can copy to another application. But the log file is wrapped to 80 columns and I end up with newlines embedded in what I'm putting there. ...
13
votes
4answers
461 views

How does one change the math style to one of the “primed” styles?

Background TeX typesets each portion of a mathematical expression in one of 8 styles: display, display', text, text', script, script', scriptscript, or scriptscript'. Knuth calls them, D, D', T, ...
13
votes
3answers
2k views

How to use \valign?

I just bumped into a interesting command called \valign. It seems to be the sister of \halign, but the TeXbook seems to be rather shy on explaining its use. As is the TeX by Topic. They only mention ...
13
votes
2answers
190 views

Which TeX procedure removes trailing tabs?

From reading the TeX source, it seems that the input_ln procedure is responsible for removing trailing spaces from lines upon input (before category codes are considered). A very short excerpt from ...
13
votes
1answer
728 views

\jobname, character codes and \detokenize

I recently wanted to compare \jobname to a string (with the xstring package) and was rather surprised that the string never matched. Tho internet told me that I had to use \detokenize on the string. ...
13
votes
1answer
150 views

Does tex know its own command line arguments?

Is it possible to test within the document what commandline arguments were passed to tex? The particular case that prompts this is the question Tabs in output file written by xelatex and pdflatex are ...
13
votes
1answer
631 views

uppercase and \spacefactor

Apparently, \uppercase forgets about the \spacefactor at the end. For example, {What is the spacefactor?} \the\spacefactor. returns What is the spacefactor? 3000. while \uppercase{What is ...
13
votes
1answer
147 views

What is considered a token for non-standard input encodings?

When I use an input encoding to (La)TeX that allows me to directly input characters such as é and ä (such as by declaring \usepackage[utf8]{inputenc}), how is a token defined? Specifically, is it ...
13
votes
1answer
402 views

How to print and assign category codes?

Consider the code below, which after giving me some trouble (especially with catcode 9 and 15), prints all the category codes up to catcode 15. \documentclass{minimal} \parindent0pt \begin{document} ...
13
votes
1answer
192 views

What practices are there regarding the use or avoidance of “internal” TeX or LaTeX commands?

What practices are there regarding the use or avoidance of "internal" TeX or LaTeX commands? (About "command" vs "macro", there is some discussion in this TeX.SX answer, though I don't know whether ...
13
votes
1answer
213 views

How to find out if a math list consists of a single character?

When accents are placed, the TeX engine gives single characters a special treatment; see the TeXbook, Rule 12 on page 443. See also this question and its accepted answer for details. Thus, ...
12
votes
2answers
229 views

Define a shortcut (-> to \rightarrow) in plain TeX

I'ld like to make -> a shortcut for \rightarrow. Is that possible with Plain TeX or has it to do with the loaded font?
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
1k views

Breakable vboxes

In Plain TeX how can I make vboxes breakable, and can I handle/measure them separately? What I'm trying to do, is that I have a portion of text, that is treated separately (no indention, narrower, ...
12
votes
1answer
811 views

What does the \the\everypar do?

If you test the following minimal it does not produce an error. What does it actually do? \the\everypar \bye Why doesn't it produce an error as one would expect?
12
votes
4answers
1k views

Making efficient use of \writes

I'm currently trying to compile my thesis using LaTeX and have run up against the old ! No room for a new \write . problem. After some googling it seems the only way to actually resolve this problem ...
12
votes
3answers
331 views

Expansion of first token in a tabular cell

Background I currently do some work on the collcell package which collects the content of a tabular/array cell and provides it to a user defined macro, e.g. using ...
12
votes
2answers
528 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, ...
12
votes
2answers
372 views

All about \shipout

While reading about packages that allow to hook macros to certain events, I came across this command, \shipout. Searching on the internet didn't help a lot but if I'm not so wrong it's somehow related ...
12
votes
1answer
265 views

What does \empty do? [duplicate]

What does it do and what are its applications? I am currently testing the subtitle of my beamer presentation for its string length to decide about line spacings. Could it be simpler using \empty? If ...
12
votes
2answers
184 views

Can I detect whether a footnote has been split?

Title sez it all: Can I detect, hopefully by inspecting \box\footins, whether a footnote has been split at page-breaking? I found the package fnbreak but it uses labels, which is much too delayed for ...
12
votes
2answers
2k views

What does \relax do? [duplicate]

Possible Duplicate: How can I speed up LaTeX compilation? What is the difference between \relax and {}? The title suggest the question. On and off, I see macros here in TeX.SE and I see ...
12
votes
1answer
711 views

From LaTeX with pdflatex to plain TeX

I've always wanted to try plain TeX instead of LaTeX. I can use plain but I'm not able to use correctly the fonts and I'm not able to use the french hyphenation. I would to know how to do this with ...
12
votes
2answers
905 views

Globally redefining 1 pt to 1/72 in (PostScript point) and other similar changes

Introduction TeX point (1 pt in TeX) equals 1/72.27 in (= 2540/7227 mm ≈ 0.35145980351 mm). Quoting part of Traditional American point system section from Wikipedia's Point (typography) entry: In ...
12
votes
1answer
182 views

Array functionality in TeX?

I've been using LaTeX for a while, but only recently I made myself a mission to create a class. I needed to learn the details of TeX, and I couldn't find answers to some of my questions. One of them ...
12
votes
2answers
409 views

New lines and TeX: difference between ^^J and ^^M

What is a new line for TeX in the following contexts: When reading from a file. When writing to a file. After having read a % character. In a \scantokens. I am asking in particular because the ...
12
votes
2answers
134 views

Document equivalence

What is the best way to determine, for two arbitrary input files, if they will result in the same compiled document (disregarding timestamp information and external files)? Context I'm attempting to ...
12
votes
1answer
263 views

\show with fewer lines?

I am writing some macros for general debugging purposes (See Yiannis' question). I am basically expanding a given input step by step, and printing the result to the terminal and log. In order for this ...
12
votes
1answer
75 views

Tight connection of \vbox es

I don't understand why TeX put a thin whitespace between my two vertical boxes: \documentclass{article} \begin{document} \vbox to 1cm {\rule{1cm}{1cm}} \vbox to 1cm {\rule{1cm}{1cm}} ...
12
votes
1answer
165 views

Hide ^^^^-notation from pdftex

The following example gives when compiled with pdflatex the error ! Text line contains an invalid character. \documentclass{article} \usepackage{ifluatex} \ifluatex \usepackage{fontspec} \fi ...
12
votes
1answer
266 views

Test if a number is in a comma separated range/list of numbers

Martin Scharrer posted a very elegant answer for the question "Creating a zebra effect using listings". I want to extend that code to highlight only lines given in a comma separated list. The ...
12
votes
1answer
296 views

Is Knuth's *The TeXBook* complete?

Suppose I want to learn TeX. Then, is The TeXBook a complete source? Does it cover all relevant aspect of TeX? Or is there something worth learning about TeX which is not present there? Does also ...
11
votes
7answers
2k views

Can I see a plain TeX source file please?

all the LaTeX-tutorials tell me how LaTeX is an extention simplifying the building of TeX documents. Understandably, no one uses plain TeX anymore, right? But I seem to learn better when I grasp the ...
11
votes
3answers
435 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 ...
11
votes
2answers
530 views

() or {} after a command

I was wondering why for some commands it is "(...)" that follows, while for other commands it is "{...}". For example, "\exp(x)" and "\bar{x}". Are both () and {} for specifying the arguments for the ...
11
votes
3answers
470 views

Does the \relax side-effect of \csname…\endcsname still have a use?

I find it annoying that using \csname...\endcsname will define ... to be \relax if ... is undefined, and there is no improved primitive that does not have this side-effect, though there are partial ...
11
votes
2answers
1k views

Which “TeX” should one use?

This question is from my confusion with the editor. In the WinEdt 6.0, there is a button for different kinds of "TeX". How do I know which one I should use and what's the difference?
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} { ...
11
votes
2answers
242 views

How does math mode work?

When writing an a in TeX, it is typeset as an upright "a" by default. When writing an a in math mode it is typeset in italics. Furthermore, in math mode white spaces are ignored and no empty lines ...
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 ...
11
votes
2answers
141 views

Does a space belong after pt?

Does a space always belong after pt, e.g. as used in \hskip1pt? If a space is used, are there situations where a space will appear where it is not intended? If no space is used, will pt be ...
11
votes
2answers
193 views

Creating new primitives

Consider the following TeX: \tt ~~~[def]: \meaning\def \par ~~~[let]: \meaning\let \par [define]: \meaning\define \par ~[macro]: \meaning\macro \def\macro#1{some ...
11
votes
4answers
266 views

How can I compare two (not necessarily integer) variables?

After experimenting and researching for hours, I still cannot figure out how to perform a simple equality test between two numbers. More specifically, here, the two numbers in question are the ...
11
votes
2answers
238 views

How is \unexpanded defined?

I was wondering how \etoolbox's \expandonce does what it does. So I looked up how it was defined and found \unexpanded\expandafter{#1} But no matter where I look, I cannot find a definition for ...
11
votes
3answers
278 views

Expandable 'character scanning' command that preserves spaces

David Carlisle recently offered a clean and rather elegant TeX solution to a question about expandable 'character scanning' commands. Unfortunately, David's solution does not preserve spaces in the ...