Questions tagged [tex-core]

{tex-core} is for questions for syntax, semantics and expected behavior of TeX primitive control sequences, regardless of extensions (eTeX, etc.) formats (Plain or LaTeX) and macro packages (tikz). 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}.

Filter by
Sorted by
Tagged with
6
votes
4answers
308 views

Appending a character to a token list using its charcode

Is there any way to obtain the actual character token from its character code representation? In particular, I would like to have a macro \prepend#1#2 that takes a token list #1 and prepends the ...
2
votes
0answers
45 views

Which significance does 100000000 have as overflow boundary in Pascal?

A recent conversation about bug-free software at work has lead to a discussion about TeX (which is considered virtually bug-free, while it might technically be false). Since TeX's source code is ...
1
vote
2answers
123 views

Get Height/Width of Parent Box

In cases when input text to be typeset is separate from the structured template, can the input determine the height and width of its containing box? An example input. Question marks (?) to be ...
5
votes
3answers
208 views

What is the purpose of a <filler> in TeX's syntax?

Many of TeX's primitives require a <general text> as their argument (e.g. \uppercase), which is defined as (TeXbook p. 276) <general text> -> <filler>{<balanced text><...
12
votes
5answers
656 views

“Clever tricks” for using \outer macros

From TeX by Topic, p. 111: For certain applications, however, it is inconvenient that some of the plain macros are outer, in particular macros such as \newskip. One remedy is to redefine them, ...
5
votes
2answers
207 views

How to find out the number of lines in a paragraph for \hangafter

I want to have the last line in a paragraph be filled with an \hrulefill which sticks out 1cm to the right of the paragraph margin, like in this picture: To typeset the above, I used \hangindent and \...
1
vote
1answer
106 views

Lower diacritics sometimes centering as opposed to upper diacritics

It seems there are some inconsistencies in how upper diacritics (\", \u, etc.) behave as opposed to lower diacritics (\c, \k, etc.). Upper diacritics are placed on the first character (or \i/\j) of ...
38
votes
2answers
2k views

Typesetting curiosity: word change on one line does not affect how that line is set, but affects how the next line is set

The following two paragraphs differ only in that the first one uses "his" on the first line and the second one uses "her". \documentclass[12pt]{book} \RequirePackage[adobe-utopia]{mathdesign} \...
4
votes
2answers
80 views

Text variant vs font switch - bfseries

I stumbled into the following sample \documentclass[a4paper,11pt]{article} \usepackage[english, ngerman]{babel} \begin{document} Quick test - not yet bold "\textbf{Bold text for test - part 2} ...
10
votes
1answer
245 views

Shortest code to make INITEX produce printable output

What is the shortest sequence of characters that will lead to a printable page of output when processed by INITEX? Meaning no formats like plain.tex preloaded, and with output of positive width and ...
0
votes
1answer
31 views

How to decide the location of an image in LaTeX document?

I am new to LaTeX and stuck on this image formatting thing for my algorithms class. My source looks like this: \documentclass{article} \usepackage{graphicx} \begin{document} \title{COMP3027 ...
2
votes
1answer
43 views

When do curly braces disappear in macro definitions? (e.g. \documentclass expansion)

I've been looking into how \documentclass and friends are actually defined, and I noticed something peculiar which I'd like to understand. Let's say I have \documentclass[11pt, titlepage]{article}. ...
0
votes
0answers
43 views

Operator space mismatch

Operator space differ for first number and subsequent numbers in inline math, how to fix it throughout in inline math? e.g., $-3 -3$ \documentclass{article} \begin{document} analyse the effects of ...
1
vote
2answers
70 views

What's wrong with `\string`?

I am using the algorithm2e package to typeset my algorithms. I want to be able to control the caption numbering style. More specifically, I want the caption number to be enclosed in curly braces and ...
1
vote
1answer
38 views

How do parskip and similar parameters behave

Im trying to format a twocolumn article document with some twocolumn spanning graphics, small tables etc. I used \raggedbottomfor evading huge whitespace/glue in my text, but sometimes the space this ...
0
votes
0answers
56 views

`LaTeX` documentation and reference guide [duplicate]

Is there anything such as LaTeX documentation? When I am looking for some syntax on google, I only get to forums, but never a site with actual documentation, such as when looking for the meaning of \...
0
votes
0answers
48 views

Why does \if in a tikzpicture evaluate to true for \if 33 \empty? [duplicate]

I have the following code: \documentclass[11pt]{article} \usepackage{tikz} \begin{document} \newcount\x \x=-1 \begin{tikzpicture} \foreach \percentA in {33} { \if \percentA \empty \else \...
4
votes
3answers
158 views

Trying to understand a line in latex.ltx (regarding \string, \escapechar and \csname in the definition of \newif)

I'm trying to understand how exactly TeX parses documents, and with respect to that, the definition of \newif confuses me quite a lot (in latex.ltx, line 929ff): \def\newif#1{% \count@\escapechar \...
3
votes
0answers
81 views

How is TeX/LaTeX parsed?

I have some questions about TeX/LaTeX parser and parsing TeX/LaTeX after reading the following: Limitations when parsing TeX as a context-free grammar This is a PEG parser, which means it ...
0
votes
1answer
94 views

When a string may be assigned to an array?

In section 51 of tex.web there is this: name_of_file ← pool_name; { we needn’t set name length } where name_of_file is (sectoin 26): name_of_file : packed array [1 .. file name size ] of char; and ...
5
votes
2answers
83 views

Why are spaces needed in the end of string array?

In section 11 of tex.web is this: @!pool_name='TeXformats:TEX.POOL '; {string of length |file_name_size|; tells where the string pool appears} and in section 519 is this: for ...
2
votes
1answer
50 views

Additional hrule in halign after page break

I try to spread a halign over more than one page. I use \filbreak after every line. \tracingonline=1 \advance\vsize by -15cm \def\tablerule{\noalign{\hrule height .3mm\filbreak}} \newcount\posno\...
1
vote
2answers
77 views

Three identical copies of a page

I need to print one page three times. Is it possible, in plain TeX, to output two exact copies of the last page without incrementing the page number?
1
vote
0answers
47 views

Can you adjust how TeX does write line-endings into external text files (carriage return/linefeed)?

Since I typed the title of the question the TeX-LaTeX StackExchange-Website says: The question you're asking appears subjective and is likely to be closed This is one of the very unpleasant things ...
4
votes
1answer
72 views

Different vsize for first page

Is it possible to alter the vsize for the first page? I tried this: \vsize=20cm \def\pagebody{% \ifnum\pageno=1% \advance\vsize by -8cm% \vskip13cm\vbox to \vsize{\boxmaxdepth=\maxdepth ...
96
votes
4answers
16k views

Are there any dangerous commands in LaTeX?

I encountered this question: What is the most dangerous command in SQL?. And a similar one came to my mind, Are there any dangerous commands in LaTeX? By dangerous we may mean any or all of these ...
0
votes
1answer
39 views

Prevent LaTeX from adding paragraph after blank line

I like to put a lot of comments inside my documents, even between sentences. To make the comments more visible I would like to put a blank line between the comment and the sentence before like this: ...
3
votes
1answer
85 views

Alternating command

Is it possible to have a command alternate its behaviour? My idea is something like this: \documentclass{article} \def \current {c} \def \abc { \ifx\current{a} \def\current{b} \...
2
votes
3answers
74 views

Change separator in tex code / for loop

I found this very useful macro to add rows to a table (while defining the rows externally from the table): Command to continually add to table with a command/macro In my case the macro has only some ...
1
vote
3answers
72 views

Allow spaces between arguments in a macro definition

I don't know if it's right to allow this kind of practice, but I've been asked many times. How do you allow spaces between square brackets and parentheses in the code below? I try to use \@ifnextchar ...
0
votes
0answers
124 views

Getting text to flow around images in either TeX or LaTex

For years I've been using HTML to produce web pages with text flowing nicely around images. Here's an example of the sort of thing: As you can see, the images are floated left and right, and may ...
8
votes
4answers
162 views

How to safely check by means of expansion-methods whether a list of tokens contains a token which is defined in terms of \outer?

I take the following question for a moot thing. Nonetheless it makes me sick that I don't see a good and robust solution myself. ;-) Assume something like this: \def\unfold{\umbrella My bald head ...
0
votes
0answers
20 views

My content is overlapping on footer?

I'm trying to generate a pdf of my college report in Latex. In some pages the content is getting overlapped on footer.
4
votes
1answer
197 views

When error lines are divided into three parts?

Usually TeX divides error lines to two parts. But sometimes three. When and why this happens? Consider the following example. If final \hfil is removed, only two lines are displayed at the top, but ...
0
votes
0answers
34 views

How to put upper dot to a kannada font in XeLaTeX?

I'm a beginner in XeLaTeX programming. I need to put an upper dot to some kannada fonts in a PDF. I used the following code snippet to do that. But the output is negative. Please help me in this. ...
0
votes
1answer
69 views

Why does \ifdim work here but \if doesn't?

I'm very new to LaTeX, and need to compare a length I've defined with a default value (and set another length accordingly). Consequently, I'm exploring the murky (to me anyway) world of LaTeX ...
2
votes
1answer
92 views

How \show must print null control sequence?

On p.46 of TeXbook it is said \csname\endcsname is the same as empty (aka null) control sequence. But why they are printed differently by \show? Compare \endlinechar=-1 \def\ {a} \def\x{\ } \show\x ...
3
votes
1answer
61 views

Inserting tokens after \input

The answer for this should be pretty simple, but I just can't seem to find how to do it. I'm trying to use \afterassignment to make syntax for a section header and then use TeX's lexing for \input to ...
1
vote
1answer
40 views

Compiling lextex example

I am trying to use the lextex macros. For this, I started by taking a look at the example file. I tried to follow the instructions and run tex &plain example1.tex but this gives the message ...
2
votes
1answer
112 views

How TeX sets glue for \halign entries?

On p.235 of TeXbook it is said: TeX reads an entire \halign{...} specification into its memory before typesetting anything, and it keeps track of the maximum width of each column, assuming that ...
4
votes
1answer
92 views

Why is \halign not centered in display math mode?

This is centered: $$\vbox{\halign{#\cr A\cr}}$$ Why this is not centered? $$\halign{#\cr A\cr}$$ BTW, why \hbox{\halign{#\cr A\cr}} does not work?
5
votes
1answer
246 views

Plain TeX vs. ,,primitive`` TeX

I'm using LaTeX for my day-to-day needs, but in order to avoid cargo-cult document creation, I'm trying to gain a better understanding of the TeX engine itself. As part of this I'm experimenting with ...
10
votes
1answer
174 views

How to interpret ``underfull'' warnings in alignment?

I'm trying to figure out why there are warnings for 125pt case of AT&T table example in TeXbook. While trying to understand the meaning of these warnings, I came across p.302 of TeXbook, that says:...
2
votes
1answer
47 views

How to use \errorcontextlines interactively?

On p.34 of TeXbook it is said: By setting \errorcontextlines=0 at the beginning of your file, you can reduce the amount of information that is reported; TEX will show only the top and bottom ...
3
votes
1answer
47 views

Any way of calculating MD5 or any other checksum of the final output text

At the bottom of the final pdf, I would like to have the md5 of the entire text for control purposes. Anybody came across any similar/same task?
1
vote
1answer
73 views

Why is hyphenation not tried for words followed by em-dash?

Consider the following mystory.tex: \tolerance=10000 \hsize=.7in \leavevmode\nobreak\hskip0pt Drofnats---or ``R. J.,'' \end This is the log: (mystory.tex Overfull \hbox (17.41133pt too wide) in ...
2
votes
1answer
87 views

What does \leavevmode do?

Based on this question and the amazing @egreg's answer, I decided to make some tests to study and learn some boxes behavior. More precisely, to understand the \leavevmode. In the first example, one ...
5
votes
1answer
80 views

Purpose of \expandafter in a particular macro

Consider the following set of definitions... \documentclass[12pt]{article} \def\foreach{% \begingroup \catcode`\^^M=12 \xforeach} {\catcode`\^^M=12 \gdef\xforeach #1^^M{% \first #1,,\...
2
votes
1answer
84 views

Plain TeX macro with float calculation

I am trying to take this TeX snippet and use it as the basis for a macro. \centerline{\def\epsfsize#1#2{0.7#1} \epsfbox{1.01couet.eps}} I am struggling with a bit that is required because I am ...
2
votes
1answer
50 views

Test if a pgfkey is empty in a safe way

I have this little example to check if a key is empty: \documentclass[]{article} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{tikz} \makeatletter \newcount\cnt\cnt=0\relax \...

1
2 3 4 5
30