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

13
votes
3answers
763 views

What is Tex's gullet?

Chapter 7 of The TEXbook famously talks of Tex as having 'eyes', 'mouth' and 'stomach' and goes on to talk of Tex's 'digestive processes' and keeps reusing these terms. Chapter 8 introduces talk of ...
4
votes
2answers
188 views

Are xelatex, pdflatex, … compilers?

I am just asking for the terminology here. I know the technical details of what pdflatex, xelatex and similiar software really is. But how would you describe that? a "compiler"? does it "compile" ...
3
votes
0answers
63 views

Diagrams of TeX Design

In order to understand TeX better, and in order to procrastinate on stuff that is almost certainly more important, I'm slowly working my way through a YouTube series of Knuth explaining TeX82 ...
6
votes
1answer
440 views

Is there a language standard (ISO, ANSI, …) for LaTeX?

Coming from the C/C++ world, I am used to a standardized language. There are differenct standards, such as ISO or ANSI C. Is there a language standard for LaTeX? (Syntax, keywords, ...)
6
votes
2answers
133 views

How to extend existing macro with \edef?

\edef does expansion, but does not execute the commands. How in the following example make so that \foo will do assignment to \tmp at the moment of its call, not when it is defined? Why \foo produces ...
2
votes
1answer
79 views

Distributing a LaTeX2e compiler in .NET application

Is there a way to wrap a LaTeX compiler with a .NET application, so that the wrapper can compile an output .tex file, and visualize the results? Where can I get a compiler (For free, commercial?) ...
4
votes
3answers
125 views

How to make existing \strut-based code work with accented letters?

\strut-based solutions assume that heights cannot exceed 8.5 pt and depth - 3.5 pt. But with accented letters this assumption is not true. In the second example the last line is lower than in the ...
5
votes
1answer
198 views

Empty/blank lines in LaTeX code

I hope this question is in order here although it rather asks for a "best practice" than for some "solution". I am wondering to what extent blank/empty lines in the code (I am using pdflatex) should ...
8
votes
1answer
169 views

Infinite loop in \everypar

Why the following code enters an infinite loop? \everypar={\hrule} a \bye \tracingcommands=1 gives this: {vertical mode: \everypar} {blank space } {the letter a} {horizontal mode: \hrule} {\par} ...
8
votes
1answer
405 views

A “#1#” argument. What is the meaning of the second hash? [duplicate]

In an answer to this question Automatically replace environment align by equation+aligned combination egreg uses \def\relaxtag#1#{\relaxrelaxtag} \def\relaxrelaxtag#1{} The role of the second # is ...
0
votes
0answers
43 views

LaTeX pgfplots - dimension too large

i have problem with drawing graphs... \begin{tikzpicture} \begin{axis}[ xtick=\empty, ytick=\empty, minor tick num=0, anchor=origin, % Align the origins axis lines=middle, ...
3
votes
1answer
183 views

How to set margins and page size in pdfLaTeX without geometry?

What is the TeX equivalent of \usepackage[paperwidth=10cm, paperheight=15cm, margin=0mm, bottom=1mm]{geometry} ? I know nothing in TeX and so far, I am playing ...
2
votes
1answer
71 views

Calculation in a TeX function. How to do it?

I don't know anything of TeX but would like to improve a function. Here is the initial function: \newcommand{\setnewvsize}[1]{% \global\paperheight\dimexpr#1+\initialVerticalInset\relax% ...
4
votes
2answers
131 views

How to place amsmath equations at top of page ignoring \topskip?

I need every amsmath equation to place at the top of the page. So I use \noindent to do that. Everything is fine except equation+split environment. Than formula is placed a bit higher (by ...
5
votes
2answers
76 views

Output Location of Element

Suppose I have a LaTeX document, the entirety of whose content is: $\frac{a+b}{c}$ Now, suppose I want to bounding rectangles for the $a$, $b$, and $c$. Is there a way to DEFINE A FUNCTION "bbox" ...
11
votes
2answers
718 views

How are curly braces used?

In TeX, the same characters (namely, { and }) are used for grouping and to define macros (\def{...}). I think that this is because it can be distinguished from context which one is which. So, ...
7
votes
2answers
108 views

\write and \ifmmode

This is related to a previous question of mine (if I understand correctly, \write works a bit like \edef). Consider the following code: \documentclass[varwidth,convert={size=640}]{standalone} ...
5
votes
1answer
180 views

\edef, \xdef and \ifmmode

I don't understand the difference between \edef and \xdef in the following code. Clearly, the \xdef does what I'm expecting but why? AFAIK, $ does not start a group. ...
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 ...
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 ...
14
votes
1answer
379 views

How to write a two-pass system in TeX?

On page 400 of The TeXbook ("Dirty tricks" part) it is said: An output routine can also write notes on a file, based on what occurs in a manuscript. A two-pass system can be devised where TeX ...
4
votes
1answer
61 views

Why depth of \vadjust does not influence interline glue?

Consider the following examples: example1.tex %\input vadjust_hook \def\marginalstar{\strut\vadjust{\kern-\dp\strutbox\specialstar}} \def\specialstar{\vtop to \dp\strutbox{ ...
6
votes
1answer
154 views

How are dimensions converted in multiplication and division?

In the TeXbook it is said (page 118): Multiplication and division are possible too, but only by integers. ... Dimension values are integer multiples of sp (scaled points). Example 1. Result is ...
7
votes
2answers
130 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
49 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 ...
11
votes
1answer
140 views

Why does \moveleft not contribute to width but \moveright does?

Consider example1: \setbox1=\vbox{ \moveleft 1pt \vbox{\hrule width 4pt height 10pt depth 0pt} \hrule width 4pt height 10pt depth 0pt } \showbox1 The output: \vbox(20.0+0.0)x4.0 ...
9
votes
2answers
1k views

What is a macro, really?

From the list of catcodes, \ starts a new control sequence, { starts a group, and } ends a group. In LaTeX, a macro appears as \foo[opt-arg]{arg1}{arg2} However, TeX does not seem to have the ...
8
votes
4answers
411 views

What's the best practice way to test whether parameter is empty?

I have a macro that might work either in LaTeX or in plain TeX and I'd like to test whether one of its parameters, which presumably should be just text, is empty. Currently I do it this way: \bgroup ...
3
votes
1answer
222 views

How to convert pdflatex to word [duplicate]

I have a tex document with math formula, figure, tikz drawings. What is the best way to convert tex to doc format. I tried with latex2rtf, pandoc, ... but nothing works. Can someone write step ...
6
votes
1answer
127 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
72 views

Question about exercise 12.17 in TeXbook

This is exercise 12.17 (This is a sequel to exercise 12.2, but it's trickier.) Describe the result of \line{\hfil A puzzle.\hfilneg} This is exercise 12.2 Describe the result of ...
6
votes
1answer
123 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 ...
0
votes
1answer
68 views

Add notes in the equation under brace [duplicate]

How to write the equation shown in the image
7
votes
1answer
74 views

Question about vertical glue (concerning example from TeXbook)

The question concerns The TeXbook, page 78, 4th dangerous-bend paragraph. For example, let's suppose that \baselineskip=12pt plus 2pt, \lineskip=3pt minus 1pt, and \lineskiplimit=2pt... Suppose ...
12
votes
4answers
269 views

Useful applications of \edef with macro arguments

Well, it's been in my head for some time, but I haven't got anything out of it, so I ask here. At what places could be useful to have \edef\foo#1{..}? What applications could it have? Is it useful at ...
6
votes
3answers
219 views

nested \ifnum commands

I'm trying to make macro to work in biblatex edition field. Logic is following: if edition =1 there is suffix -li (1-li) if edition>1 and if edition<21 there is prefix me- (me-15,me-20 ..etc) if ...
4
votes
1answer
83 views

Question about space factor after \char

The TeXbook page 76: When ligatures are formed, or when a special character is specified via \char, the space factor code is computed from the individual characters that generated the ligature. ...
6
votes
1answer
147 views

Why does \loop behave differently depending on order of its contents?

Just a question out of curiosity. I tested the code below, and first two {\loop...\repeat} commands returned \TeX!\quad six times, and others returned it five times. Why do only first two ...
2
votes
1answer
317 views

How TeX reads what you type

These questions are connected with this answer: Carriage-return and line-feed in web2cTeX Suppose TeX is reading an input file and is at the beginning of new line, in state N. New end-of-line ...
4
votes
1answer
135 views

How is “noindent” different from “parindent0pt + leavevmode”?

Why these two examples produce different results? \parindent=0pt \leavevmode \hbox to 0pt{\hskip -\parindent \bf 8.}% Lorem ipsum dolor sit amet. \bye \noindent \hbox to 0pt{\hskip -\parindent ...
6
votes
1answer
110 views

Why hbox does not start a new paragraph?

These two produce the same result: abc %\null def \bye abc \null def \bye These two are different: abc %\null def \bye abc \null def \bye Does anybody know where this behavior is ...
4
votes
4answers
543 views

One-liner for removing characters from a string

I have a predefined command \mycommand which, for some reason, outputs {"/home/user/di rect ory/"/}. (Yes, there's a slash after the quotation mark, and there are curly braces.) Could one think of a ...
1
vote
0answers
19 views

Three ways of grouping: compare and contrast [duplicate]

Grouping is often important in TeX/LaTeX programming. I know of three ways to delimit a group: Via a \begingroup…\endgroup pair; Via a pair of matched braces {}; Via a \bgroup…\egroup. Now I am ...
6
votes
1answer
319 views

What is the difference between “-interaction=nonstopmode” and “-halt-on-error”?

Scripting with xelatex I know halt-on-error makes it possible to use xelatex in loops within scripts without causing scripts to hang up when a document does not compile, but why do we need ...
1
vote
0answers
104 views

Is there any programming language similar to TeX? [closed]

I know nothing about programming, so TeXMaker's pseudo-WYSIWYG reminded me of a stereotypical programmer.
2
votes
0answers
29 views

Why must parameters for inner macro definitions double each #? [duplicate]

Or "When would an expression like ###1 be useful?" In macro programming, it's a well-known rule that you need to double your parameter identifiers with each successive layer: \def\insult#1#2{% #1 ...
11
votes
2answers
206 views

Is it possible to define a dotted version of `\vrule`?

The \vrule primitive has a nice charcateristic: it has the ability of adapting itself to the height and depth of the enclosing box: \documentclass{article} ...
1
vote
0answers
28 views

More than 3 included .eps files causes single page to be broken into two pages [duplicate]

I am working in MikTex, trying to put more than 3 .eps drawings onto a page. After the third .eps drawing is added, the next drawing gets pushed onto the next page. Here's my Tex code; I can provide ...
6
votes
2answers
96 views

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 ...