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

16
votes
3answers
266 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 ...
16
votes
1answer
668 views

Is it still worthwhile to let TeX try line-breaking without hyphenation?

Here's TeX's line-breaking approach (as I understand it) in a nutshell: If \pretolerance is positive, try to break a paragraph into lines without inserting discretionary hyphens and without ...
16
votes
1answer
274 views

Semantics of negative glues

This question is about the semantics of glues like 0pt plus -1fill, where the coefficient in front of the fill is negative. The following minimal example shows my attempt to figure this out ...
15
votes
3answers
2k views

\string command behavior - Plain TeX

I would like to learn Plain TeX and I'm reading Knuth's "The TeXBook". At Chapter 7, Knuth talks about the \string command and how it converts control sequences into lists of characters tokens. Why ...
15
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 ...
15
votes
2answers
166 views

Multiple consecutive \par's equivalent to just one?

I think the answer to this question should be positive but I just couldn't find it answered elsewhere: Are multiple consecutive \par's the same as a single \par? For example, is \par\par the same as ...
15
votes
3answers
309 views

Parsing strings containing diacritical marks (macros?)

I apologize that this question may seem very much like several other recent ones I have asked (Parsing leading hardspaces, Parsing a \$ as part of an improved \getargs command). They are all related ...
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⟩’. [...] ...
15
votes
3answers
213 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
333 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
439 views

Why does `x_\text y` work?

As far as I have understand the tokenization in LaTeX, x_\text y will be split up into x _ \text y Now the _ will consume/bind to the next token. However, \text takes an argument as well. If _ ...
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
606 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
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
4answers
611 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
1answer
187 views

\def two macros with same name, but different argument syntax

Is it possible to have macros with the same name, but different “syntax”? E.g. we have the primitive \font which could be seen as having 3 arguments(a. without size information; b. giving the ...
15
votes
2answers
195 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
3answers
530 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 ...
15
votes
1answer
492 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
465 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
4answers
724 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
4answers
673 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 ...
14
votes
4answers
440 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
3answers
3k 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
3answers
602 views

Is there a printable version of a reference manual for all TeX primitives?

Everywhere in the TeX community, I see suggestions like \parskip, \obeylines, \parindent, etc. I'd be surprised not to find them even in the most basic LaTeX packages. So I figured they must be deeper ...
14
votes
3answers
1k 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 ...
14
votes
2answers
170 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
233 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
3answers
762 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 ...
14
votes
2answers
488 views

What is the difference between square brackets and curly brackets in a command invocation?

Pardon the naive beginner question. In a command like: \textcolor[HTML]{4C7045}{dark green text}, or \documentclass[12pt]{article}, or \begin{figure}[htb], why are some arguments surrounded by [] and ...
14
votes
2answers
226 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 ...
14
votes
2answers
334 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
2answers
548 views

Why is \baselineskip not inserted before an \unvbox?

It seems that \setbox0=\vbox{\hbox{abc}}\unvbox0 is not equivalent to \hbox{abc}: the former does not insert a \baselineskip in the following situation. \vbox{% \hbox{XY}% \hbox{abc}% ...
14
votes
1answer
175 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
190 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
2answers
188 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
195 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
819 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
745 views

How to change \hsize in the middle of a paragraph at pagebreak, especially for two-column?

The original question is: How to get two columns with different width in LaTeX? I know this older question: How can I create a two-column layout with different widths (and texts) for the two columns? ...
14
votes
1answer
214 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
2answers
626 views

Active characters let to a (non-active) character

It seems that if I \let\amp&, the alignment tab & can be replaced by \amp everywhere (e.g., in the preamble and in the body of an \halign). It is also possible to make the character & ...
14
votes
1answer
191 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
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} ...
13
votes
2answers
628 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
648 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
3answers
567 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
1k 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
2answers
625 views

The revenge of the vboxes

Yes, they're back. With a vengeance. Those pesky little buggers we call \vboxes which I've fought against previously. (And Bruno, too.) \parskip=0pt \def\unquo{\unvbox0\smallskip} ...
13
votes
2answers
402 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
272 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 ...