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

15
votes
2answers
257 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 ...
15
votes
3answers
212 views

Is it possible to interact with TeX mid-process?

Quoting from an answer to Typesetting the entire Song That Never Ends I ran this code once, and aborted the process after it reported producing something like 47,000 pages (in a very short amount ...
15
votes
4answers
316 views

Using the filename in the document?

I have a bunch of documents called wk01.tex wk02.tex and so on up to (eventually) 20. These are weekly handouts for a course I TA. Currently, each document starts with a \def\classweek{5} or whatever. ...
15
votes
2answers
3k views

Difference between setting parindent and hangindent

Is there a difference between setting \parindent to 1em and to setting \parindent to 0em, \hangindent to 1em, and \hangafter to -1 that shows in practical use? The nodes created by TeX are ...
15
votes
4answers
576 views

Detokenizing without extra spaces?

I have a need to pass through potentially arbitrary characters untouched and found this macro: \def\test#1{\expandafter\zap@space\detokenize{#1} \@empty} The problem is that \detokenize inserts ...
15
votes
4answers
550 views

Selectively suppress generation of typeset output

Is it possible put TeX into a "mute" mode in which all typesetting is suppressed? \documentclass{article} \pagestyle{empty} \begin{document} \suppress This text will not be seen in the generated ...
15
votes
2answers
1k views

How to add a hook to a macro

LaTeX uses hooks extensively, one method employed is the command g@addto@macro. It is defined in source2e as: \long\def\g@addto@macro#1#2{% \begingroup \toks@\expandafter{#1#2}% ...
15
votes
2answers
187 views

Test whether \end will really end the run

Can I test whether calling the \end primitive will really end the run? The naive \ifdim\pagegoal=16383.99998pt yes\else no\fi is not sufficient (even adding to that mix \deadcycles). According to ...
15
votes
1answer
464 views

Is \toks necessary to define \g@addto@macro? Can token registers be avoided in generel?

In LaTeX2e kernel, there is a useful macro \g@addto@macro: \long\def\g@addto@macro#1#2{% \begingroup \toks@\expandafter{#1#2}% \xdef#1{\the\toks@}% \endgroup} However, I think the ...
15
votes
1answer
458 views

How do I ‘expand’ a control sequence `\let` to a character?

Consider the following: \let\1=X \edef\2{\1} \show\1 \show\2 The result is > \1=the letter X. > \2=macro: ->\1. Is it possible to ‘expand’ the meaning of \1 so that \2 contains just ...
14
votes
5answers
2k views

What on earth is iTeX?

Is that an hoax? Or is it a real wish from D. Knuth? (http://river-valley.tv/media/conferences/tug-2010/Don-Knuth)
14
votes
4answers
668 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 ...
14
votes
3answers
2k views

What is the difference between \empty and \@empty?

I want to elaborate a command that would print differently simple differential dx and multidimensional differential d^3x. For this purpose I invented the command \dif with one optional argument. It is ...
14
votes
4answers
370 views

LaTeX, package documentation look-up

I am on OS X (10.6 Snow Leopard) using TeXLive-2011 to typeset a simple .tex file I am editing in Vim and trying to learn. My problem is: how do I... gradually learn about what TeX can do for me get ...
14
votes
2answers
161 views

Can I get at stuff in “current page” or “recent contributions”?

When I compile the following, \documentclass[a4paper]{article} \usepackage{atbegshi} \AtBeginShipout{\showlists} \showboxdepth\maxdimen \showboxbreadth\maxdimen \usepackage{lipsum} ...
14
votes
3answers
228 views

How to determine which register a count uses

Suppose there is \newcount\c@mycountera \newcount\c@mycounterb \newcount\c@mycounterc Each \newcount uses \alloc@ and that has \wlog{\string#5=\string#2\the\allocationnumber}. Thus to determine ...
14
votes
2answers
325 views

Every possible \meaning that a token can have

In the context of a debugging package that I am writing, I need to analyse an arbitrary token in the input stream. What are the possible outcomes of \meaning<token>? Macro: (\protected) ...
14
votes
1answer
148 views

How to actually close a write-stream

I don't know too much about writing and reading to and from files. But I managed to create a nice command for me where I need to write something into a text-file and later-on read it again. ...
14
votes
2answers
178 views

Use TeX macros to store multiple data

I'm trying to use TeX macros to store multiple data such as website url/name. Here is an example : \documentclass{article} \def\Google{{http://www.google.com}{Google Search}} \makeatletter ...
14
votes
3answers
460 views

Unbalanced output routine

The TeX primitive \output behaves almost like a toks register, except in the fact that it is always surrounded by braces. For instance, after \output={\plainoutput}, the result of \showthe\output is ...
14
votes
2answers
175 views

What is the easiest way to modify catcodes in a string?

Assume that a token register contains a sequence of letter tokens, each having a catcode of 12. I want to store in a second token register the same sequence of letter token, altering some catcodes on ...
14
votes
1answer
184 views

How to read a stream of tokens up to one of two different delimiters

The core question How can I process text delimited by one of two terminators? For instance, if I want to process text up to the next \A, I can just write \def\CmdA#1\A{...} But suppose that \A ...
14
votes
1answer
669 views

How to transpose a table in expl3

I've been very impressed with xparse and expl3, and have written a wonderful document command using \ProcessList that takes a comma separated list and turns it into a (basically) 1 column table. ...
14
votes
1answer
200 views

Am I programmatically tieing my hands behind my back by insisting on a particular engine?

I've read Differences between LuaTeX, ConTeXt and XeTeX, but still have a niggle at the back of my mind that I'd like to ask about. I'm developing a LaTeX package/class/stuff with the aim of making ...
14
votes
1answer
188 views

Can one determine the first character of a given math list?

I'm still pursuing my quest to code a better \widebar command. I can do bars over single characters quite well already, but I have problems when it comes to letter combinations such as AW. ...
13
votes
5answers
274 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} ...
13
votes
2answers
562 views

Can the PostScript language be used to fully replace TeX? [closed]

THE POSTSCRIPT® LANGUAGE is a simple interpretive programming language with powerful graphics capabilities. ... Because of the importance of text in most applications, the PostScript ...
13
votes
4answers
638 views

File copy without expansion

What is the command for file copy? I want to copy the contents of one file into another without any command expansion. The operative system would use copy source target I tried reading the contents ...
13
votes
4answers
469 views

Dividing dimensions to get a count

Is there a way to divide two dimens and get a count? For example, if I have a box that doesn't fit on a single page, and I want to know the number of pages I'd need for the box (i.e., \heightofbox / ...
13
votes
4answers
2k views

How to make a real backslash (escape) character?

I just want a good way to make a backslash character (or whatever character(s) any given format uses as escape characters), suitable to \write to a file or pass to a pdfTeX primitive. Let me ...
13
votes
3answers
471 views

TeX macro and command expansion?

I have implemented couple of macros that should remove commas from numbers. It's nasty dirty stuff, but it works when input is number: \removecommas{12,34,56.7} % => 123456.7 But it stop working ...
13
votes
2answers
959 views

Why (La)TeX can not work with true type fonts?

I know that if one wants to use true type fonts, there are solutions via xelatex or lualatex. My question however is, why it is like so? What is the fundamental difference between latex fonts and ...
13
votes
3answers
952 views

Defining commands that are scoped to a particular environment

Is it possible to define commands in a separate namespace so that they only work within a particular environment? For example, can I create a package named foo that defines a foo environment and a ...
13
votes
2answers
199 views

How to set tikzmarks with \noalign at the edge of tabular rows

I'm trying to improve the lines in a tabular with colored rows (lines above a colored row can disappear in the adobe reader at some zoom levels) by redrawing the line above a row after the row itself ...
13
votes
2answers
366 views

What is “plain TeX”?

I occasionally see a statement that plain TeX is not the same as TeX, because plain TeX is already a format. What is plain TeX, and what is the difference to TeX proper? Some answers are here (The ...
13
votes
3answers
269 views

What other macros like \pdffilesize exist?

So I just learned about \pdffilesize from this answer. Are there other similar things like this? I learned about \the\inputlineno a while ago which prints the line number of the input file. In ...
13
votes
3answers
726 views

\def taking rest of the line as argument

I know how to define a macro that will take the rest of the paragraph as parameter. Simply write \def\a#1\par{\textbf{#1}}. But, how do I write a macro whose argument will extend to the end of the ...
13
votes
3answers
817 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
234 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
111 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
4answers
452 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
186 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
689 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
506 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
146 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
389 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
180 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
211 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, ...