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

3
votes
2answers
859 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
5answers
295 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
72 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
67 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
60 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
62 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 ...
5
votes
1answer
66 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
27 views

Add notes in the equation under brace [duplicate]

How to write the equation shown in the image
7
votes
1answer
52 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
3answers
197 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 ...
5
votes
3answers
112 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
48 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
123 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
265 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
73 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
89 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
455 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
88 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
78 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
28 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
176 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
18 views

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

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 ...
4
votes
1answer
36 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 ...
4
votes
0answers
63 views

How can I retrieve the number of currently defined macros?

The following will max-out TeX's memory: % arara: pdftex \nonstopmode \input expl3-generic \relax \ExplSyntaxOn \int_zero:N \l_tmpa_int \int_while_do:nn { \l_tmpa_int < 490000 } { ...
1
vote
0answers
54 views

Is there an alternative to {} that also expands to nothing?

I have a weird bug in my text editor that causes it to incorrectly indent any lines that start with special characters, such as greek letters. % My editor will indent the leading spaces in this line ...
0
votes
1answer
61 views

Where can I get a LaTeX command explanation? [duplicate]

For example, I do not know the definition of the LaTeX command \ensuremath. Where can I get its accurate meaning? Is there one professional website to offer some information about this?
9
votes
1answer
140 views

Where do arguments of \kern, \hskip etc. end?

In TeX, code like I\kern37ptlike\hskip100ptcake works perfectly well. That makes me wonder how exactly the syntax of primitive commands like \kern, \hskip etc. work? How does TeX determine where their ...
3
votes
1answer
43 views

Where can I find documentation on what “\char” does?

I've seen samples of TeX using \char`\\ to produce a literal backslash. Where can I find documentation on what the \char command does? Is it a generic construct to safely produce reserved literals? ...
4
votes
1answer
66 views

How to expand control sequence in argument of a macro

Consider the following: \def\foo#1#2 {% \if#1a% \message{#2} \fi} \def\x{abc} \edef\y{\foo\x} \y The result: ! Argument of \foo has an extra }. The expected result: bc
5
votes
1answer
56 views

Equivalent Leaders construction

What is the equivalent construction of \leaders\hrule height 1pt depth 1 pt\hskip 20pt \relax in terms of the following construction or something similar \leaders\hbox{\vrule height 1pt depth ...
2
votes
0answers
34 views

Listings - Getting the colors right for custom language

I have lots of bookkeeping transactions that I would like to typeset in a color coded format. I am using the listings package to accomplish what I want. I tried the following code. ...
27
votes
3answers
503 views

How to define phantoms for depth and height?

In the third "dangerous bend" on page 178 of of The TeXbook there's the following description of \vphantom: Even more useful than \phantom is \vphantom, which makes an invisible box whose height ...
2
votes
0answers
22 views

Does LuaTeX change the message in “Output Routines Part IV: Horizontal Techniques”?

In the excellent article "Output routines: examples and techniques Part IV: Horizontal techniques", David Salomon explores three techniques for dealing with communication from horizontal mode to the ...
26
votes
1answer
306 views

Exercise 17.21 of Knuth’s TeXbook: a (known) error?

Exercise 17.21 of The TeXbook asks a question concerning \delcode: Appendix B defines \delcode‘< so that there is a shorthand notation for angle brackets. Why do you think Appendix B doesn’t ...
2
votes
1answer
81 views

How do LaTeX macros interact with the TeX engine? [duplicate]

From wiki on LaTeX the basic requirement is to have a TeX compiler (which is used to generate output files from source), fonts, and the LaTeX macro set. Assuming I have a TeX engine and I ...
9
votes
1answer
144 views

Rearranging blocks (poetry) in OTR (Plain TeX)

I have a problem that I think would best be solved by an output routine. It seems like an act of moderate TeX wizardry so before I get stuck in the weeds on a wrong approach I thought I would describe ...
2
votes
0answers
25 views

Penalty between paragraphs

How do I modify the penalty given to a pagebreak between paragraphs? I looked everywhere and could not figure out. If I really need to I can redefine \par but I'm unsatisfied with such a hack.
23
votes
1answer
1k views

Knuth “Some Implementations of TeX”…

In Appendix D of The TeXBook, p. 387, in a discussion about automatic column sizing, Knuth tantalizes us with this: Some implementations of TeX display the output as you are running, so that you ...
5
votes
1answer
70 views

TeX: Lining up three boxes

This question is really a continuation of my previous question. Basically, I'm wondering why this does not work: \hbox{\vbox{\hbox{This is}\hbox{A line}}\hfil\vbox{\hbox{And so}\hbox{Is ...
9
votes
1answer
148 views

Somewhat versatile usage of \@gobble and \@firstofone found in several macros

I was doing search about my question (see here for more detail) and found a thread commath and \ifinner. In the thread, there is a macro named \spx , the definition and usage of which are extracted ...
0
votes
0answers
76 views

Can not update packages in Tex Live Utility after installing Tex Live 2015 [duplicate]

since Tex Live 2015 was released these days, I updated it. I´m using a Mac. Now I wanted to check for package updates in the Tex Live Utility. But that does not work, unfortunately. First strange ...
7
votes
0answers
71 views

Feed fontdimen parameters to TeX

I have decided to use \fontdimen parameters as an array of numbers (to store data about Unicode Character Properties). The question now is to fill in those \fontdimen parameters in the most efficient ...
9
votes
1answer
118 views

Question about exercise 7.5 in TeXbook

Consider this extract from TeXbook: EXERCISE 7.5 Experiment with TEX to see what \string does when it is followed by an active character like ~. (Active characters behave like control ...
7
votes
1answer
40 views

What's the most plain way to define a parametrized macro within an outer macro definition

I often want to pass some arguments into a macro definition that defines an inner macro with parameters. For example \def\outmac #1,#2.{% \def\argone{#1} \def\argtwo{#2} \def\inmac ...
28
votes
1answer
644 views

What does “expanding” mean in (La)TeX?

You can often read about expanding a macro or when a macro does expand, sometimes about expansion. But what does this mean - in English?
13
votes
0answers
153 views

What type of Chomsky hierarchy is TeX? [duplicate]

There are four types of chomsky hierarchy (specified for formal languages): Type-0 Recursively enumerable Type-1 Context-sensitive Type-2 Context-free Type-3 Regular I consider that, it should ...
4
votes
1answer
124 views

In LaTeX, what is the most efficient way to search for an optional token in given input?

My question is inspired by this comment by Joseph Wright. Let's say we have input strings with varying character combinations, such as: ...
1
vote
1answer
34 views

Writer2Latex table border removal

I'm using Writer2Latex to convert my .odt file, created in Google Docs and downloaded as .odt format, to .tex. It works but because there is no way to create columns of text in Google Docs other than ...
4
votes
0answers
111 views

Which algorithms does (La)TeX use? [closed]

People often talk about the many "typesetting wonders" (La)TeX can do because of the countless algorithms it uses. But exactly what are these typesetting algorithms? Concrete examples I have gathered ...