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

10
votes
2answers
175 views

Why is \newcount declared \outer?

I'm a user primarily of Plain TeX. Lately I get annoyed about the \outer nature of \newcount, especially when I write macros which require temporary internal variables, variables which really need not ...
10
votes
2answers
293 views

Catcode of \endlinechar when its charcode is less than 1

When \endlinechar is less than 1, how do we access its catcode? The following gives the error shown below: ! Bad character code (-1). l.34 ...ndlinechar\string=\the\catcode\endlinechar ...
10
votes
5answers
543 views

What is the minimum TeX one can use to put together a mathematical document?

Being a mathematician, I use LaTeX a lot for writing. However, I am interested (mildly) in working with TeX instead, even if only for keeping my own notes. What is the minimum amount of TeX do I need ...
10
votes
2answers
195 views

Execute non-expandable code inside a tabular environment

As there is no Expandable version of \InputIfFileExists or \IfFileExists, the question arises whether it is possible to execute non-expandable code in a tabular environment after all: File main.tex: ...
10
votes
1answer
322 views

Is there a \show for catcodes?

In the course of attempting to out-pedant another mathematician, I wanted to \show the catcode of $ to convince myself that it was a "special" character in ordinary TeX as well as LaTeX. I was just ...
10
votes
4answers
1k views

Generalize \@ifnextchar to consider more than one character.

I am looking for a clever way to write a switch statement based on the next input characters, ideally, one could write: \@switchnextchars \@case{abc}{\typeout{You gave me an abc}}% ...
10
votes
3answers
915 views

`\write` non-printable ASCII characters to a file

\immediate\write\SomeStream{x} writes x to the file open in \SomeStream. I would like to write non-printable ASCII characters, such as ``, to a file. My naive guess is \begingroup %To keep ...
10
votes
2answers
233 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 ...
10
votes
1answer
123 views

TeX doesn't recognize built-in control sequences?

I'm trying to learn to build things from the ground-up with TeX (not LaTeX---I've used LaTeX before, so I know how easy a solution "\usepackage{amsthm}+\begin{theorem}" is) and I'm trying to build my ...
10
votes
1answer
381 views

Macro delimiter

I'd like to have a macro to split up another macro content, with field separator being a space. So: \def\mytext{foo bar} \def\secondof#1 #2{#2} \secondof\mytext What? What do you mean: "runaway ...
10
votes
1answer
82 views

How to define a command using \lowercase in \csname

I was being lazy and had a lot of commands of the form \def\foo{...Foo...} So I was thinking about taking an approach like ...
10
votes
2answers
851 views

Minimum length of last line of a paragraph

There is a more or less equivalent question to this: Ensure minimal length of last line, but I absolutely need a TeX solution. I more or less stumbled upon the problem mentioned in the discussion of ...
10
votes
1answer
272 views

What documentation thoroughly explains how to use TeX conditionals?

I have a document which needs a large variety of plain TeX conditionals, e.g.: IF #1 >= 1 AND #2 >= 10 IF #1 != “tree” OR #2 == “mountain” IF 10 > #1 > 2 I have found limited ...
10
votes
2answers
484 views

How to use tex -ini, tex -fmt, initex and fmtutil?

What are the roles of each of these commands? What is the good command to create a new format ?
10
votes
1answer
135 views

Macro parameter delimited by more than one delimiter

TeX user can simply create the macro with a parameter delimited by an arbitrary sequence of tokens. For example \def\macro #1delimiter{...#1...} Is it possible to create a macro with a parameter ...
10
votes
1answer
133 views

Emulate TeX's grouping

In TeX, various kinds of groups must match properly, for instance, the following is wrong: $ \begingroup $ \endgroup I would like macros which allow such mismatched grouping. They would keep ...
10
votes
1answer
220 views

Making a character active vs assigning it a specific catcode

My query arises from my answer to Tab not as extra alignment tab and Andrey's rather nicer version. The question at hand involved making the TAB character usable for aligning tables. I assigned it to ...
10
votes
1answer
206 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 ...
10
votes
1answer
358 views

Interwoven alignment preambles are not allowed - what exactly does this mean?

I admit that this post is purely idle curiosity. But I recently stumbled upon a little factoid saying that the TeX error "Interwoven alignment preambles are not allowed" has the following explanation ...
10
votes
1answer
1k views

Newline/linebreak in \message

I want to prompt some messages to my console. I used \message{Hi out there!} Now i want some more Text but with an linebreak. \message{Hello World %some line break here Salut monde } Well i ...
10
votes
2answers
701 views

Reading the contents of a box

Is it possible to take a box and retrieve the following information from it: A list of all "top level" internal boxes; All intervening space (kerns and glue: did I forget another type of space?)? ...
10
votes
2answers
681 views

Do XeTeX and LuaTeX always use Unicode?

I am writing some functions to manipulate strings. A typical way to produce a character with a given character code is the \lowercase primitive. The following code produces a character with code 234, ...
10
votes
2answers
338 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 ...
9
votes
6answers
1k views

Function like macro?

If you have programmed in a high level programming language, you must be familiar with the concept of functions, subroutines which return a value. For example, if you write in C, you can write a ...
9
votes
4answers
914 views

Writing Roman numbers in Equation

What is the command for writing roman numerals like I, II, IV etc. in an equation ? To be noted that my requirement is to write them within $$ ...$$ and not as counters or page numbers. Any light on ...
9
votes
2answers
459 views

Where to find official (!) and extended documentation for tex/latex's commandline options (especially -interaction modes)?

Today I tried to learn more about the several interaction modes for tex/latex/pdflatex etc. The manpages turned out to be not very helpful: $ man tex ... -interaction mode Sets the ...
9
votes
1answer
1k views

Why does \@gobble take one argument

I understand what \@gobble, \@gobbletwo etc. do, but I don't understand why \@gobble allows for an argument. I believe that the definition of the macro is \long\def\@gobble#1{}. Why is this argument ...
9
votes
2answers
688 views

Force the expansion of a macro parameter without \edef or \xdef

Two days I am looking for a solution but I have no more idea. This is my problem. I'm trying to create a macro to automatically define new other macros to write references in a document. I want to ...
9
votes
3answers
153 views

Problem with ^^<HEX>

I have small problem with ^^<HEX>. If I have a <HEX> part of the ^^<HEX> in the macro \def\attemp{<HEX>}, I cannot write ^^<HEX> as ^^\attempt or ...
9
votes
2answers
940 views

How to avoid underfull vbox in combination with \vsplit?

In the following example I am using the command \vsplit. I can't see the reason why \vsplit produced an overfull \vbox \documentclass{article} \parindent0pt \def\exampletext{Text Text Text Text Text ...
9
votes
3answers
940 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 ...
9
votes
3answers
434 views

Making register declarations local, Undefining a register (count, toks, etc.)

Is it possible to make \newcount, \newtoks, etc. respect grouping, so that, e.g., \newcount\temp\temp=2{\newcount\temp\temp=1}\showthe\temp gives 2 (instead of 0)? Relatedly, is it possible to ...
9
votes
2answers
125 views

Replace every backslash in a string with a forwardslash

I would like to replace every backslash \ inside a macro (string) with a forwardslash /. The macro is intended to contain a filename in Windows notation which should be replaced by a valid (La)TeX ...
9
votes
3answers
331 views

How to force LaTeX only commands?

Recently, I learned that for a long time I have been doing all of my mathematics in LaTeX incorrectly! I was using the $ TeX commands instead of the \( and \) LaTeX commands! I immediately went back ...
9
votes
1answer
153 views

Can TeX detect a newline at the end of the file?

Is TeX able to distinguish beween a file containing, say, the single character a/ byte 97; and a file containing this same character followed by a newline marker (which is system-dependent)? I had a ...
9
votes
2answers
176 views

Local allocation of registers

I saw the following code in an issue of TUGboat (Volume 9, 1988, No. 3). I have modified it slightly. The motive was to avoid allocating registers globally. My questions are (1) How safe is it for ...
9
votes
2answers
151 views

How can the contents of a TeX \mark be viewed?

The purpose of marks in TeX is to generate running heads. One inserts material to a mark, simply by: \mark{A running head} If we write a short TeX program, we can see that the contents of \mark ...
9
votes
3answers
379 views

Verbatim text in token registers

How can I add verbatim text in a token register (I want to accumulate pieces of code in a toks register and print them in an appendix). In the MWE below if you substitute verbatim text it fails. ...
9
votes
1answer
113 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 ...
9
votes
2answers
114 views

How can I specify text to be included in the pdflatex output log during compilation.

I would like to be able to have some kind of logging command that is able to log text to the default pdflatex logfile (<input-base-filename>.log). Is this possible, and if so, how? In ...
9
votes
3answers
280 views

Detecting catcode in parameter text

Say someone has defined \documentclass{minimal} \begin{document} \def\fooA#1@{} \makeatletter \def\fooB#1@{} \end{document} It is easy to test and see that the two are different: ...
9
votes
2answers
195 views

Is it possible to use $ as a macro delimiter?

Experimenting with macro definitions that use strange delimiters (see e.g. this or this question), I thought it would be fun to have a macro that takes an argument of the form "a/b" and turns this ...
9
votes
2answers
280 views

Missing baselineskips?

Here are some cases where when there is stuff inside a vbox, the baselineskips are sometimes there and sometimes not. Or maybe it's something else that is producing the differences? \setbox0\vbox{% ...
9
votes
2answers
677 views

\def taking next word as argument?

This question is a variant of my previous question requesting a macro that takes the rest of the line as argument. I would like to write a macro that would take the next word as argument, where word ...
9
votes
1answer
143 views

What can and can't occur as macro argument?

The documentation of the environ package says The advantage to using environments is that their contents is not treated as a macro argument, so there are less restrictions on what can exist ...
9
votes
1answer
500 views

Computer Modern font with accented characters (in XeTeX)

I'd like to use Knuth's Computer Modern font with XeTeX in a way where I don't have to type accents in a \'-way and without any gimmick such as making accentuated characters active and then say ...
9
votes
1answer
734 views

Why \leaders and \mkern works strangely in different font size?

I can hardly determine a good title for this question, I'm sorry. Minimal test code: \documentclass{minimal} \usepackage{lipsum} \begin{document} foo {\fontsize{18}{18}\leaders\hbox{$\mkern ...
9
votes
2answers
229 views

Which spaces exactly are ignored by \halign?

Some spaces seem ignored by the \halign primitive. For instance, \setbox0=\vbox{\halign{ # \cr \space b \cr}} \showbox0 indicates that there is no glue before b, but that there are two spaces ...
9
votes
4answers
610 views

How do I get the category code of a character that is the value of a control sequence?

How can I get the category code of a character that is the value of a control sequence? If I do this The catcode for A is \the\catcode`A. I get The catcode for A is 11. If I do this \let\abc=A ...
9
votes
1answer
136 views

vbox disappearing inside hbox

I don't understand why a vbox disappears when it's surrounded by two \hss, for instance in: \hbox to 0pt{\hss abc\hss} \hbox to 0pt{\hss\vtop{def}\hss}% doesn't work \hbox to 0pt{\vtop{ghi}\hss}% ...