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

4
votes
2answers
80 views

How to show dimension values in scaled points

TeX stores dimensions internally in scaled points but operation \the expands to the corresponding value in points. Can we avoid the conversion and get the more precise, "original" value instead?
4
votes
1answer
49 views

\halign does not affect \prevdepth?

What is the purpose of restoring the initial value of \prevdepth at the end of a horizontal alignment: \prevdepth=.1234pt \everycr{\noalign{\dimen0=\prevdepth prevdepth in noalign: \the\dimen0}} ...
7
votes
1answer
190 views

How many man-years does it take to implement TeX?

When I first posted messages to comp.lang.postscript about my efforts to write a postscript interpreter I was informed that it takes approximately 5-10 man-years to write a fully-compliant level-3 ...
2
votes
2answers
47 views

Passing the value of a register as a macro argument

I'm looking for a solution to the following problem: \def\m#1{{ \dimen0=200pt \#1=\the#1 % Outputs 200pt rather than 100pt }} \dimen0=100pt \m{\dimen0} EDIT: The code sample above ...
10
votes
4answers
145 views

# in conditionals in alignment tabs?

I am looking for ideas how to make TeX understand that when # appears both in the if-else and in the else-fi part of a conditional in an alignment tab, in the end there will never be more than one # ...
8
votes
1answer
81 views

Incomplete \iftrue is valid input?

Is LuaTeX beta-0.79.1 correct in thinking the following is valid input: \iftrue \bye
4
votes
2answers
134 views

New primitives and grammar for replacing horrible \expandafter

Time and time when I am trying to read or write some macros, I'm always frustrated by lots of \expandafters inside them. Why don't we add some new primitives and grammar into TeX engines to make ...
13
votes
2answers
152 views

ifx, macros and grouping

I do not understand how \ifx interacts with macro definitions. Here is a minimal example: \def\a#1{\b} \def\b#1#2{[#1:#2]} \a ABC The output is [B:C], as expected. If I change the definition of \a ...
7
votes
2answers
99 views

\xrdef and \xref in eplain

I tried to upgrade eplain used in the book "TeX for the Impatient" from version 1.9 to latest version 3.6, but came across the following problem with new eplain. The follwing code could be compiled ...
3
votes
1answer
79 views

Is there a platform-independent way of specifying page dimensions in TeX?

This is partially a follow-up to this question since the answer mentioned tex as executing the "original Knuth TeX". So far, I have seen that the following will work in TeX, but is ignored by ...
5
votes
1answer
54 views

Is it possible to conditionally execute statements based on the translating engine, within Plain TeX?

Note that this question is about Plain TeX, not LaTeX. Consider the following example. \pdfpagewidth 8.5 in \pdfpageheight 11 in foobar \bye Under pdftex, this will work fine. However, this will ...
8
votes
2answers
247 views

Conversion of tex to latex

Quite surprisingly for me, I did not find valuable information on how to convert plain TeX files to LaTeX documents. There is a TeX.SX question, but it was answered with a particular solution. I ...
1
vote
0answers
113 views

List of TeX internal parameters? [closed]

I have come across quite a number of TeX internal parameters, like \clubpenalty, \widowpenalty, \abovedisplayshortskip and so on. Could you provide me with a complete list of them, what they are for ...
13
votes
1answer
259 views

What is the command \span?

I have bumped into the \span primitive a couple of time. I got the impression it is defined in the TeX program, not even in plain.tex. Is that right? And what does that command do and what is it for?
8
votes
2answers
99 views

Why is the character following this macro-defining macro gobbled up?

I have the following plain Tex code: \def\xx{ABC} \def\temp #1 {\def\tempii{#1}} \temp\xx a b c \tempii\tempii I expect to see the following output: a b c ABCABC But I actually see this: b ...
5
votes
0answers
77 views

What is the difference between a typesetting language and a markup language

I remember, I read some article in a technical journal where the author drew the attention on the reader on a lot of people confusing typesetting languages and markup languages. How can I surely tell ...
16
votes
2answers
353 views

Filling gaps by repeating a character

I want to create a macro like \mymacro that has four arguments; first and fourth arguments are any letters, second argument is a character and the third argument is a length. When I say \mymacro{م} ...
5
votes
1answer
40 views

polyglossia + output routine = wrong expansion in file writing (???)

If I use the following custom class: \NeedsTeXFormat{LaTeX2e} \ProvidesClass{upecha}[2014/09/21 v0.8 tibetan modern pecha class] \input{size11.clo} \def\@outputpage{\shipout\vbox{\box\@outputbox}} ...
0
votes
0answers
36 views

Aligning right parenthesis vertically in a multiple-choice test

I am making a test. Some of the problems have choices, and the choices are mathematical expressions. I have included the code for the first two problems; 1.) has six choices, and 2.) has eight ...
8
votes
2answers
78 views

badness for lines without glue?

I want to typeset a special paragraph which have some penalty items inside it but no glue. TeX always produces an overfull box for this paragraph. I have two questions: What is the line badness if ...
26
votes
3answers
240 views

Is there a way to get at the value of \prevdepth from the main vertical list inside the output routine?

To motivate that (admittedly) strange question: When TeX builds a vertical list it keeps track of the depth of the last box added in a special variable called \prevdepth which is used to calculate ...
23
votes
2answers
629 views

Why does a TeX point differ from a Desktop Publishing point?

From this answer to Why does PDFLaTeX and XeLaTeX generates 11.955 font size for 12pt documentclass option?, I found out that PDF and TeX have different ideas about the size of the point (pt). A TeX ...
3
votes
2answers
66 views

How to expand a LaTeX counter when adding to token list

In short: I am trying to append counter values to a token list, but when I print the token list at the end I get the final values of those counters. What I want is the value of the counters at the ...
10
votes
1answer
127 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 ...
15
votes
2answers
169 views

\expandafter with \uppercase ordering

As I understand it, the behavior of \expandafter is such that if \a and \b are macros, then \expandafter\a\b will first expand \b then \a. But my understanding must be wrong, because I don't ...
17
votes
4answers
473 views

Scaling a glue in TeX

is there a possibility to scale a glue in TeX? Consider the following example: \newskip\foo \newskip\bar \foo=10pt plus 2pt minus 3pt \bar=2.5\foo\relax \showthe\foo \showthe\bar \bye When ...
1
vote
0answers
55 views

Geometry package in TeX: How to print (or use) the values of geometry properties in document page?

I have problems with geometry package. I would like to find out parameters of my page (layout) such as textwidth, layoutheight etc. I want to have a dynamic layout of my page without number or ...
5
votes
4answers
193 views

A simple line from start of the page to the end

I need on one specific page a line from the very top to the end of the page (it is for folding). Everything I tried so far stopped at the head/foot room. Someone got an idea?
8
votes
3answers
199 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
148 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
56 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
86 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
53 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
897 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
117 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
130 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
50 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
181 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
84 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
154 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
67 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
109 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
45 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
200 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
70 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
58 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
75 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
137 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
60 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} % ...