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

5
votes
1answer
75 views

Arguments possibly delimited by \bgroup and \egroup

I still don't see (and haven't thought about) pros and cons of making available the arguments as \foo{…} or \foo\bgroup …\egroup (or even unbalanced, \bgroup …} and {…\egroup). But I'm curious about ...
6
votes
2answers
126 views

Delimited arguments and using a macro inside of itself

I wanted to play with delimiter sizing without using the \delimiterfactor, -shortfall, etc. and made the following: \newdimen\bigdim \bigdim = 1.9743ex \newdimen\Bigdim \Bigdim = 2.671ex ...
5
votes
1answer
41 views

\par in the parameter text (as an argument delimiter) and \vbox{#1} in an \everypar macro

This is basically a question about TeX's error messages. I am confused by a cryptic error message that TeX gives me when I try to do the above. I have tried to isolate it, but have come no further ...
6
votes
1answer
53 views

testing parameter values with \ifx

Let's say that I would like to redefine \@seccntformat so that whenever the section counter is printed, it is prefixed by Section, but other counters should no be changed. Here is my failed attempt: ...
2
votes
0answers
27 views

Page breaks and memory [duplicate]

Note the following passage in the TeXbook (p. 110) TeX breaks lists of lines into pages by computing badness ratings and penalties, more or less as it does when breaking paragraphs into lines. ...
1
vote
1answer
51 views

Vertical bar appearing except on top of page

I want a command \shybar which prints a \textbar except if it would be the first character on the page. In this case, it should do nothing. Because of this question, I tried the following code: ...
9
votes
4answers
862 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 ...
6
votes
1answer
115 views

Stopping the accidental absorption of digits into literals

I recall that I was once writing some TeX code, and I encountered something like this \count\foo \foo=2\otherMacro [\the\foo] If \otherMacro was defined as something like \def\otherMacro{9 cats is ...
9
votes
1answer
122 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}% ...
6
votes
2answers
47 views

What Pascal procedure inserts \mathon and \mathoff?

TeX surrounds inline math formulae with \mathon and \mathoff, which appear to be nodes. For instance, running TeX on $ $\showlists\bye gives ### horizontal mode entered at line 0 \hbox(0.0+0.0)x20.0 ...
11
votes
3answers
167 views

Command delimited by return or blank line

I have this document \documentclass{scrartcl} \long\def\quotenextparagraph#1 {\begin{quote}#1\end{quote}} \begin{document} Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod ...
11
votes
1answer
76 views

Measure total glue in a box

Someone gives me a box, and my goal is to know as much as possible about the amount of glue inside that box. I can assume that the box is not huge, but it may contain arbitrary stuff (so I cannot ...
5
votes
3answers
150 views

Trim braces from macro content

I'm having macros with a content which may or may not have extra curly braces. I want to trim the extra braces but without expanding the rest of the content, if possible. The following code shows the ...
8
votes
1answer
64 views

weird ifnum with compact syntax [duplicate]

In some packages like tabularx, I find the following syntax in many places {\ifnum0=`}\fi or even \ifnum0=`{\fi} But I can't figure out why this can be useful for? Is ` a register of some kind? ...
5
votes
3answers
106 views

Adding a hrule between hboxes decreases their vertical distance

Using pdftex. Given two sample programs test0.tex \vbox{ \hbox{X} \hbox{Y} } \bye test1.tex \vbox{ \hbox{X} \hrule \hbox{Y} } \bye gives the following outputs. test0.png test1.png So, ...
4
votes
1answer
43 views

How do you define a command to select nested groups?

Assuming a pair structure (2-tuple) is defined using groups {{<tokens1>}{<tokens2>}} is it possible to define a command \first#1{...} (and \last#1{...}) taking the surrounding group as ...
15
votes
1answer
185 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 ...
5
votes
1answer
63 views

Struggling to define variable using variable previously defined

new to tikz and am struggling to figure out how to define a variable using variables I have just defined. I think the problem in the code below is coming from the following section: ...
2
votes
0answers
51 views

GNU Readline- like history, for the latex terminal shell?

I find myself more than often willing to use the (pdf)latex shell, and \typeout commands there directly - unfortunately, there is one deal breaker: there is no command line history. I think that in ...
1
vote
1answer
65 views

How to derive one TeX-Format from another

Let's say I want to write my own TeX-format for learning purpose, how can I easily derive from plain.fmt (or better xetex.fmt)?
4
votes
4answers
90 views

\vtop vertical top alignment of \vsplit \vbox

Well, I wanted to have a minipage spanning across pages, so first I thought to split a minipage so it can , but I learned you cannot; so I got to breakable vboxes, and in trying that, learned that ...
3
votes
1answer
50 views

Why can I not vsplit a parbox? (and fbox alignment, and unvbox syntax)

I was trying to experiment with the code in this answer: Breakable vboxes, and I got something I didn't expect; consider this MWE: \documentclass{article} \usepackage{lipsum} \usepackage{xcolor} % ...
1
vote
1answer
82 views

Why does LaTeX throw an error when I write _ in text mode

Why LaTex return error when I write _ in normal mode (not math mode). Why we have decided to return error, we couldn't just print _. I mean if we write _ in a normal mode it print _ and in normal mode ...
7
votes
3answers
221 views

How does (or, what happens when) Tex typeset(s) a line and linebreak?

I could not find references to this with a cursory search, so I thought I'd post a question; I'm aware this is probably discussed at length in the Tex book or similar, but unfortunately I don't have ...
3
votes
1answer
43 views

Variable scoping of edef definitions in a local group (inside an ifx conditional)?

Consider this MWE: \documentclass{article} \def\testswitch#1{ \def\isA{A} \def\firstOpt{#1} \edef\tmpstr{-init-} { % start local \edef\tmpstr{-loc defined-} } % end local ...
34
votes
3answers
753 views

What does the 'etex' package do, exactly?

I was creating a rather large LaTeX project, so I had to use many packages. This gave me an error No room for a new \dimen \newdimen \MPscratchDim while my editor(Kile) opened the file ...
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 ...
26
votes
3answers
1k views

Mathematical description of TeX's infinite numbers?

TeX has things like infinitely stretchable spaces and infinitely bad penalties. Since Knuth is Knuth, I assume these are a carefully thought-out implementation of some well defined non-Archimedean ...
3
votes
1answer
35 views

Possible to run a handler / callback function, when a macro (\inputlineno) changes value/definition?

I was thinking about the debugging procedure I went through in How come the tilde ~ sometimes does not behave like non-breaking space? - basically, to find out where did the macro ~ change, I had to ...
6
votes
1answer
176 views

How do I implement a string buffer in TeX?

I've recently learned how to create a macro to iterate over a token sequence using \afterassignment and \let in TeX. Currently, I'm trying to apply this to a tokenization macro (where "tokenization" ...
0
votes
1answer
37 views

Automatic parsing/extraction of single-argument commands from input (for use in new environment)?

I'm not sure whether this is in principle possible, so let me try to explain; consider this MWE: \documentclass{article} \usepackage[showframe]{geometry} \usepackage{tikz} \usetikzlibrary{calc} ...
5
votes
2answers
40 views

Free - dereference - release - delete a newdimen length?

Somewhat similar to How to erase/delete a counter, I guess, but for \newdimen... So, consider the MWE: \documentclass{standalone} \usepackage{tikz} \begin{document} \begin{tikzpicture} ...
1
vote
0answers
44 views

Untyped character at the end of chapter

Although there is no "f" typed, there exists a "f" character at the end of the chapter when pdf is created. What can be the problem? I can't find it! Even I delete all the text, and just type a ...
6
votes
1answer
61 views

Redefine @ for tabular inter-column specification within \makeatletter \makeatother

I need to use a tabular with a @ inter-column specification within a \makeatletter and \makeatother environment. I. e. I something like \makeatletter %code that uses @ as letter ...
2
votes
3answers
51 views

Legitimate “local variable” (argument) command in a macro raising “Undefined control sequence”?

Consider this MWE: \documentclass[varwidth,tightpage,border=1bp]{standalone} \usepackage{tikz} \begin{document} \begin{tikzpicture} \makeatletter \gdef\getMyInfoString{% \let\trfm\relax % ! ...
8
votes
1answer
182 views

Maximum number of counters am I allowed to make/have?

I'm currently working on generating the pentest-reports of the company I work for with tex. I came across the totcounter package which I use for the overview table of the findings. there i'm adding ...
0
votes
0answers
24 views

Protecting / escaping the # (number-sign/hash) in a callable macro? [duplicate]

Consider this MWE: \documentclass{article} \usepackage{tikz} % \gdef\myset{ %* \tikzset{ % mystyle/.style={rectangle}, mycode/.code n args={2}{% \typeout{YEAH! #1 #2} % }, } % end ...
7
votes
1answer
107 views

How do you define macros to toggle a character active and define a macro for it?

I'm experimenting with core tex in order to learn some basics. My goal is to define a shorthand environment which makes use of active characters. The general idea is to activate the used characters ...
2
votes
3answers
115 views

Left margin wider than right one

Why is the left margin wider than the right one? Each of them should be 1 inch wide: If you run TEX without modifying the plain TEX format, you get pages that are numbered at the bottom; and each ...
5
votes
1answer
90 views

Is there any way to disable automatic ('discretionary break') hyphenation, while allowing/forcing TeX to break some chosen words?

I have a large document with narrower paragraph width than regular (approx 5 average words long), and I want to disable hyphenation short of having the opportunity to allow hyphenation of chosen words ...
4
votes
2answers
81 views

Is it possible to control the minimum tolerance (allowed space between words)

I have learned to use \pretolerance and \tolerance but sometimes TeX decides to "compress" the broken line of text within the paragraph by simply using less space between the words on the line, and I ...
0
votes
1answer
28 views

White marks around leaders in PDF

Why are there white bars between the leaders and each of the rules in this code when compiled with LuaTeX to a PDF file? When compiled (with LuaTeX) to a DVI file no white bars can be seen. a \vrule ...
5
votes
1answer
75 views

Overlapping hboxes

How can I change the following macro to get a rule in hbox 2 that is just as wide as the text in hbox 1 and remove parameter #2? \def\m#1#2{ \leavevmode \hbox to#2{ \hbox ...
5
votes
2answers
80 views

Implicit \hfil at the end of each paragraph?

Why do Alpha \hfil\ Omega\par and Alpha \hfil\ Omega not flush "Omega" to the right?
3
votes
1answer
56 views

TeX commands and currency symbols

Why does the code \documentclass{memoir} \usepackage[latin1]{inputenc} \usepackage[danish]{babel} \usepackage[T1]{fontenc} \def£#1£{``#1''} \def€#1€{<#1>} \begin{document} Hi, £this£ is nice, ...
2
votes
3answers
76 views

eplain access to \li number

What is the best way to get the "marker" for the current item in a list in the eplain format? \numberedlist \li Here's an item \li And this is another and it's marker is: \marker \endnumberedlist ...
3
votes
3answers
84 views

Vertical line in \halign with interrow spacing - LaTeX error

\documentclass[12pt, russian]{article} \tracingall \tracingassigns=5 \tracingmacros=2 \tracingcommands=2 \tracingrestores=1 \tracingstats=0 \tracingoutput=10 \tracinggroups=10 \tracingonline0 ...
4
votes
2answers
117 views

Define a special verbatim commmand

To learn more about Plain TeX, I try to define a special verbatim command \verb{code}, which puts code inside braces. When there is no braces in code, It's easy. But when there are some balanced ...
14
votes
2answers
481 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 ...
8
votes
5answers
219 views

Vertical alignment of text within a table cell

How can I move the text in the following table closer to the upper rule (or closer to the lower rule) without changing row height: {\halign {#\cr \hrulefill\cr \font\f=cmr8\f(bla bla bla)\cr ...