Articles of tex core

Getting the page breaks right for a \beginsection macro

I’ve found this code in the question No indent in the first paragraph in a section in Plain TeX \def\mysection#1{% \goodbreak \vskip2\baselineskip \noindent #1\par \nobreak \vskip\baselineskip \everypar={{\setbox0\lastbox}\everypar={}}} but it doesn’t stretch the bottom of the page when the page breaks on a new paragraph (here the stretching was found in the skips around the section […]

Could significant speedups be gained from package code minification?

Wikipedia: Minification is (also minimisation or minimization), in computer programming languages and especially JavaScript, is the process of removing all unnecessary characters from source code without changing its functionality. These unnecessary characters usually include white space characters, new line characters, comments, and sometimes block delimiters, which are used to add readability to the code but […]

How to create a format file with initex to speed up processing time?

I have a file called matteo.tex which contains lots of macros. I’d like to create a format file with initex so that, every time tex processes a file that contains some of matteo.tex macros, it doesn’t have to waste time processing the file matteo.tex. How to do it? And, then, how to make tex load […]

Prevent \topinsert on chapter page (Plain TeX)

How to define chapter to prevent insertion of floating figures and tables (\topinsert) on chapter page. I would like to place an object at the top of the next page. \def\chap#1{\vfil\break \vglue1cm {\nobreak\noindent #1\par} \nobreak\bigskip\firstnoindent} \chap Name of chapter Some text \topinsert some table or figure \endinsert

Resize all images in Latex to a percentage width

I am auto-generating multiple tex files using pandoc (one tex file for each of my chapters). Pandoc generates this tex code for each image. \begin{figure}[htbp] \centering \includegraphics{images/flock_of_birds.JPG} \caption{A flock of storks rush to fill orders during the Baby Boom.} \end{figure} How can I set the width of all images to a percentage value without directly […]

The difference between `\the\numexpr` and `\number\numexpr`

I wonder if there is any functional difference between \the\numexpr and \number\numexpr. Some obscure context where they would yield different results? (I’m obviously aware that \the and \number differ, wildly. I’m just curious about the case where they are followed by \numexpr.)

How to display filenames with underscores.

The following latex code uses fancyvrb VerbatimOut and VerbatimInput environment to write out and display code. The idea is to maintain only a latex file which contains code and documentation and that requires no additional literate programming software (such as noweb), but only latex. It works fine for filenames without underscores (in the example: “createx.m”), […]

Problem with dynamic table creation

I’ve wandered into uncharted territory with a package I’m writing. At one point I need to create a table of ‘n’ columns (n supplied by user in doc). Creating a variable in the preamble of the tabular declaration will handle the number of rows and the justification, but I can’t seem to figure out how […]

How do I tell a node about LuaTeX's state of mind when it made it?

To be absolutely clear before I begin, this is a question about LuaTeX and so “node” in this question means LuaTeX’s notion of a node, not any other TeX package’s notion. Ultimately, I want to detect when TeX changes group and record that information in the node list so that when I come to process […]

Why do I need an \hbox inside \vcenter to make it work?

I want to vertically center an object in an equation. I thought: “Ok, \vcenter is the way to go.” But I don’t understand (not even from the TeX primitives reference), why I need an \hbox inside my \vcenter to make it work. And also, is this a bad approach? Is there a better alternative? See […]