Plain TeX is Knuth's original default format for TeX documents.

learn more… | top users | synonyms

2
votes
2answers
83 views

How to change character code in Type1 font?

I needed to make spaces at the beginning of line copyable in pdf, and came up with the following trick. In lm-rmtt.enc I change /tilde to /nbspace and then use this code: \font\myfont=rm-lmtt10 \def\...
9
votes
1answer
72 views

Why does unboxing lose margin kerning in pdfTeX?

Consider the following code: \showboxdepth=20 \showboxbreadth=200 \hsize=5.33333in \pdfoutput=0 \pdfprotrudechars=1 \input protcode.tex \setprotcode\tenrm \vbox{\noindent Test. Test. Test. Test. ...
4
votes
2answers
87 views

Adding crop marks to legacy document

I have a legacy book written in Plain TeX which contains code that centers the page in A4 paper. I need to add crop marks to these A4 pages at the correct positions for the target book size. I have ...
0
votes
0answers
19 views

Slight variation of plain \topinsert [duplicate]

I would like to use \topinsert for placing figures at the top of the pages. But I don't want to insert figures at the top of the first page of a chapter. So I was thinking about creating a macro \...
3
votes
1answer
55 views

\leaders when at the start of the line

I'm encountering an issue where I have \leaders that occasionally fall at the beginning of the line and as a result, there are no leaders appearing. I have for example: \hsize 9.2cm Lorem ipsum ...
1
vote
1answer
83 views

footnote with smaller characters

How can I write a footnote with smaller characters? How can I write a formula in a footnote, with the same character size (fonts) as the main text of the footnote? Example: \footnote{${}^1$}% {\font\...
1
vote
1answer
58 views

cross-referencing a list item in OPmac

I need to give a reference to a list item in plain TeX. I have a numbered list with a custom style. \begitems \sdef{item:F}{\bf FP\the\itemnum\kern.25em} \style F * List item 1 * List item 2 ...
7
votes
1answer
117 views

How can I have my ordinary delimiters come from the same font but 1 pt larger?

This question is general, but arises because I am using Times fonts; in CM, I would not make these changes. In CM, delimiters have a height that is larger than that of a capital letter, whereas in ...
7
votes
2answers
141 views

Write an \unpar macro

I would like to write an \unpar macro which removes last \par. For example, the TeX code This is a \par \unpar paragraph should be equivalent to This is a paragraph (Note that by equivalent I ...
7
votes
3answers
212 views

Macro like `\ignorespaces` for ignoring `\par`s

I would like to have a macro \ignorepars that removes all \pars following it. I wrote the following code: \def\eat{} \def\ignorepars{\futurelet\next\ignoreparsA} \def\ignoreparsA{\ifx\next\par\...
3
votes
1answer
50 views

Check for sufficient number of tokens left

I want to use a command that takes a large number of arguments, possibly more than left in the input stream. \def\consumeseven#1#2#3#4#5#6#7{} \consumeseven \space In this scenario \consumeseven ...
1
vote
1answer
48 views

How do I provide a ddot accent in text using the stix-mathsf font within plain TeX?

If I use the font stix-mathsf and try to type H\"o, then the o will have a large inverted breve accent over it (because the position of the character \" is different from most fonts), whereas H\char"...
3
votes
3answers
303 views

ç doesn't work in \write and \read

In Plain TeX when I do a \write containing ç or Ç in the string it gets expanded generating a lot of code in the output file, which can't be read back. I got this problem when reading a TOC: This is ...
2
votes
2answers
90 views

How to stop a custom \section macro from adding whitespace to the beginning of a paragraph?

I lifted a \section macro from the TeXbook. \outer\def\section#1{\medbreak\noindent{\bf#1}\smallskip\par\nobreak\noindent} When I use this macro like this: \section{\TeX nical documenation} Blah ...
3
votes
1answer
86 views

superellipse with pdfliterals

I don't know if this is possible, since I know nothing about PDF literals, so can I draw a superellipse with \pdfliterals, and how? I'd like to write a presentation theme for lecturer which draws a ...
3
votes
1answer
77 views

How can the font Open Baskerville be used with plain TeX?

I downloaded the font Open Baskerville from here, but I don't know how to use it. How can it be loaded in plain TeX? I can use any of tex, pdftex or xetex. (I am using texlive on Linux.)
4
votes
2answers
138 views

Plain TeX end of proof macro

I am writing a macro to typeset proofs of theorems. By getting rid of irrelevant (for this question) things, it simplifies to \def\demo#1\enddemo{\noindent{\it Proof.\quad}#1\quad\copy\cvdbox\...
5
votes
3answers
135 views

How to draw a box around something with the dimensions of something else?

I'm using plain TeX and I've lifted a macro \boxed from the TeXbook (where it is called \cstok and slightly different) to put boxes around things in math mode: \def\boxed#1{\hbox{\vrule\vtop{\vbox{\...
6
votes
2answers
210 views

What's the way to change the size of a math symbol in plain TeX?

I find that \diamondsuit in ntxsy is too small, so I want to define a macro that will enlarge it and take into account the current font size being used. To illustrate below, I have a partial attempted ...
5
votes
1answer
52 views

Can lineskip depend on how close the boxes are horizontally?

TeX adds lineskip when two lines would get too close together. However, this ought to depend on whether the conflicting boxes in question are near each other horizontally, not just vertically. Is ...
2
votes
1answer
80 views

MathTime Pro 2 with luatex

I'm using Tex Live on Linux (Ubuntu). I have the MathTime Pro 2 (lite version) fonts installed, using the script I found here. I always used them with tex, pdftex or xetex and they worked correctly. ...
8
votes
3answers
222 views

Smart macro to produce stanzas

I want to typeset a booklet of poetry, in Plain. Thus far I've been able to make TeX obey spaces and lines with the following code: \def\startline{\par\noindent} \obeylines\obeyspaces \let^^M=\...
6
votes
2answers
162 views

Extra interline glue between \vbox'es?

In the following example I use \strut's in both lines, but nevertheless there is gap between the rules. Why there is this gap between two rules? Example 1: \vbox{X\strut\hrule} \vbox{\hrule Y\strut\...
0
votes
1answer
54 views

How to set the width of last column in \settabs?

The last column in sample line in tabbed alignment is not used for anything. If we use sample line in \settabs, we must put there the widest cell for corresponding column (which may not be the first). ...
1
vote
1answer
35 views

Why vrules are not aligned between rows of tabbed alignment?

How to make \vrules aligned against each other in the following example? Why the sample line after \settabs does not work as needed? \magnification=\magstep5 \nopagenumbers \font\ttl=rm-lmtl10 \font\...
1
vote
0answers
58 views

Asymptote in plain TeX [closed]

Is there a way to directly embed Asymptote code in plain TeX as it can be done in LaTeX? (For example by using miniltx or something like that?) Can labels in figures be typeset using plain TeX instead ...
3
votes
0answers
61 views

Why zero lccode does not stop hyphenation in LuaTeX?

Compile the following example with tex and luatex: \nopagenumbers \parindent=0pt \parskip=0pt \def\par{\endgraf\hbox to 15em{\hrulefill}} \hsize=1pt \hfuzz=15em 1 'supercalifragilisticexpialidocious \...
8
votes
2answers
180 views

Problem in a macro definition (plain TeX)

I'm trying to write a \multicenter macro that acts as \centerline, except that it splits the text in different lines whenever it encounters the command \\. For example, \multicenter{ciao\\a\\tutti!} ...
5
votes
1answer
103 views

How to put characters between every paragraph

I'd like plain TeX (pdftex) to put a specific sequence of characters between every paragraph of its output. For example: Original text might be: This is paragraph 1. This is paragraph 2. This ...
4
votes
4answers
332 views

How to properly change page offsets?

Suppose that we need to change margins. This cannot be done only by changing \hsize and \vsize, because of the default offset of 1in. There is a possibility to change \hoffset and \voffset directly, ...
8
votes
1answer
199 views

How does \halign differ from \hfil?

Suppose we have three blocks of text aligned horizontally. Why Example 1 differs from Example 2 and what should be changed in the latter to make it look like the former? NOTE: I added rules just to ...
4
votes
1answer
266 views

What is the purpose of \raggedright?

I thought that \raggedright is used to get text: 1) not exceeding certain width, 2) with natural interword spaces, 3) without hyphenation. But it turns out that hyphenation is done with \raggedright. ...
4
votes
1answer
129 views

Why is \leftskip glue not automatically inserted?

TeXbook says (page 100): TeX has two parameters called \leftskip and \rightskip that specify glue to be inserted at the left and right of every line in a paragraph ... Consider this example: \...
4
votes
1answer
80 views

How do I type a brace-enclosed, numbered equations in plain TeX?

Basicly it looks like: I tried \eqalign, but it cannot have equation numbers on the right. I also tried \eqalignno, but it cannot have a brace on the left.
5
votes
1answer
124 views

QR code for plain TeX

I am looking for a macro package for QR codes applicable in plain TeX. The QR code should be calculated from string at TeX macro level like in qrcode.sty, but this package is usable only for LaTeX. I ...
1
vote
0answers
18 views

Non-equal spacing comparing between \left, \right and their \big equivalents [duplicate]

The following two examples differ only with that in the first \left and \right are used, and in the second they are replaced with equivalent \Biggl and \Biggr. But spacing differs slightly. Why? $$ \...
3
votes
2answers
53 views

What are the rules for style change in formulas (Plain TeX)?

Both numerator and denominator in the following two formulas are of the same size, namely \textstyle (from which we conclude, that: 1) style change does not affect the digit, which immediately follows;...
1
vote
1answer
44 views

Weird spaces after \magstepN

Consider example1: hello% world \bye In example2 a space is added between o and w, in comparison with example 1: hello% \magnification\magstep0 world \bye (It seems that space (which appeared ...
2
votes
1answer
95 views

Plain TeX and XeTeX

Will all plain TeX code also work with XeTeX?
7
votes
2answers
131 views

Why does the redefinition of \par disable \nopagenumbers?

Let's disable page numbers: \nopagenumbers Hello world. \bye Page numbers appear if we redefine the nearest \par: \begingroup\def\par{\endgraf\endgroup} \nopagenumbers Hello world. \bye If we ...
1
vote
1answer
52 views

How to get last box in vertical mode?

I'm trying to get the contents of a paragraph with \showbox via \vadjust, by overloading \par. I came up with this: \showboxdepth\maxdimen \showboxbreadth\maxdimen \let\oldvadjust\vadjust \def\...
4
votes
1answer
123 views

moving from old plain TeX to XeTeX

I have a style file I used for a project in pre-Unicode age. Now I want to convert it for use in XeTeX. I used Computer Modern and now would like to use CMU Serif. Pointers on what to do with the ...
4
votes
3answers
39 views

Setting headlines with widths which differ from the width of the body text

Using (plain) TeX, I'm trying to set the headline to a different width from that of the body of the text (i.e. hang page numbers to the outside of the text, as seen in the TeX Book).
1
vote
0answers
50 views

Short footnotes on same line or centered in plain TeX

Is there in plain TeX a way to print two short footnotes on the same line (spaced as if in columns) or a single footnote centered?
2
votes
2answers
147 views

How to align vertically by right border?

Consider this example: \hsize.1in \noindent \parfillskip=0pt \leftskip=0pt plus 1fil \hfuzz=2em hello world \bye The result is: The expected result is: Why the example does not produce the ...
10
votes
1answer
152 views

Question about exercise 23.3 in TeXbook

This is exercise 23.3: Explain how to change the output routine of plain TeX so that it will produce twice as many pages. The material that would ordinarily go on pages 1, 2, 3, etc., should go ...
3
votes
1answer
90 views

How much space is occupied by footline?

This is said in TeXbook about page dimensions: Plain TEX sets \vsize=8.9in (not 9in, since \vsize doesn't include the space for page numbers at the bottom of each page)... According to ...
6
votes
1answer
135 views

Weird error after \showthe

I'm trying to understand the meaning of \p@ from plain.tex: \newdimen\p@ \p@=1pt % this saves macro space and time While trying to figure it out, I stumbled upon strange behavior. Consider this: \...
5
votes
1answer
79 views

How is a page produced in the output routine?

Compare this \nonstopmode \tracingonline=1 \showboxdepth=\maxdimen \showboxbreadth=\maxdimen \output={\shipout\vbox{ \unvbox255 \showlists }} \nopagenumbers \noindent A \bye and this \...
6
votes
1answer
127 views

How to draw borders around page contents

During learning, while conducting different experiments, it's useful to see actual page borders. So I wrote the code which does this and would like to know whether it is the proper way to accomplish ...