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
0
votes
1answer
243 views

Aligning and Wrapping Text with TabularX

I'm trying to create a tabularx environment that will align a two column table table like in the picture, but I want the text on the right to wrap at a certain width. What I've done: I've tried using ...
4
votes
3answers
365 views

\edef\relax{\relax} makes \relax hang forever

Previously I thought it is always safe to \edef a macro to its existing definition. But \edef\relax{\relax} makes \relax hang forever and CPU is very busy. So what is TeX doing there?
3
votes
1answer
176 views

backslash in macro name

Very simple code: \def\a{12} \def\a\b{34} \a\b % ok: 34 \a % error \bye Very simple question: I would like to know how \def\a\b{34} is processed by the tex engine and why \a no longer ...
3
votes
3answers
177 views

Why does tex have an “expansion-only” mode?

The example comes from another thread with some modification: \documentclass{article} \newcommand\abc{\\xyz} \newcommand\foo[1]{\def\abc{#1}\ifx\abc\empty T\else F\fi} \begin{document} \...
2
votes
2answers
116 views

Understanding TeX and LaTeX horizontal rules

I just want to have a horizontal rule at the top of the text frame, closed to the top margin. I am trying to know why this is not a trivial issue. As I understand, LaTeX \rule command makes a filled ...
1
vote
0answers
45 views

How do I add shortcuts to TeX Maker?

For example, I want to create a shortcut for \(...\) command and or more specific one _{\circ} etc. Because it is hard to write in a minute. But I cannot create a new shortcut. I only configure the ...
12
votes
1answer
325 views

Comma as a decimal separator in (La)TeX dimensions

My girlfriend showed me dimensions in LaTeX documents typeset like this : \hspace{1,5cm} instead of what I would have thought was the correct \hspace{1.5cm} (we are french). It seems that both ...
13
votes
2answers
608 views

Fun titles by splitting in letters (or words)

I want to display titles using a spelling routine I have found in this interesting discussion. The idea is that different simple effects can be easily selected. Unfortunately the code below has some ...
1
vote
1answer
89 views

How to Reset line numbers in minted code?

i have a portion of code in minted package: \begin{minted}[ frame=single, numbersep = 1pt, breaklines=true, framesep=1mm, baselinestretch=1, bgcolor=LightGray, fontsize=\footnotesize, linenos ...
0
votes
0answers
22 views

LuaLateX callback for linebrea. use this within editor to represent line like in pdf [duplicate]

LuaLateX is able to run custom code and attach it to callback, in particular it could discover line break, receiving a list of hlist that compose a line of text. I'm not an expert at all, but I was ...
2
votes
1answer
27 views

Function which types optional argument only if it is provided

The idea is to create a command with an optional argument that would only write it if it IS provided. I've tried simply using [] as an optional argument when defining the command: \newcommand{\partc}...
0
votes
0answers
58 views

classification of basic latex commands

Related to but not duplicating Standard pre-defined macros in LaTeX: where to find them all, based on how and where they are defined, what is a top-level classification of all commands, separate from ...
1
vote
3answers
50 views

How to dynamically generate loop length with newcommand

Basic loop in latex with variable counter. I want to insert x amount of spaces... \newcommand{\insertspace}[1]{ \newcount\foo \foo={#1} \loop ~ \advance \foo -1 \...
9
votes
3answers
445 views

Using \let with \csname inside a macro

So, I was looking for a way to set some commands to one of a few alternative definitions (i.e. setting \mycommand to one version of the command or others with a simple command invocation), and was ...
3
votes
1answer
118 views

Plain TeX magnifications

Can I use a magnification like \magnification=2700 in TeX? Or is it restricted to multiples of 500 like \magstephalf, \magstep1 and so forth?
0
votes
0answers
45 views

Set a math symbol in italics

I have an equation that contains the \inf symbol and which I would like to add it in italics mode. When I add in my latex code the following: $\inf$ the result is not in italics though. How, can I set ...
5
votes
1answer
540 views

Where to find the original TEX specification, description?

From Wikipedia: TeX, ..., is a typesetting system (or a "formatting system") which was designed and mostly written by Donald Knuth and released in 1978. Since TeX is also a Turing-Complete ...
6
votes
3answers
327 views

\somepenalty=10000 vs. \somepenalty 10000 vs. \somepenalty10000

Replacing the equality symbol with a space below or omitting the symbol at all \documentclass{article} \pagestyle{empty} \usepackage{lipsum} \begin{document} \interlinepenalty=10000 % or \...
1
vote
1answer
95 views

How to use \ifx and \@currenvir?

Description Hi, I was trying to make a simple \ifx statement to decide whether something was inside and environment and execute commands accordingly. I want the notes in my document to be ...
1
vote
1answer
183 views

TeX: \ref using wrapfig wraptable calls section number instead of table number

I have a problem using the wrapfigure package. As you'll see in the code example below, when I call \ref{My table} what I get is a reference to the section I am in instead of the table. \...
0
votes
1answer
111 views

luatex node library: iterate over whatsit save_pos to get the position of linebreaks

Marcel's answer resolved the original question. I have added followup questions from his answer under my original question. Followup questions begin with a similar block quote as this stating "...
0
votes
0answers
67 views

How to add a cover page in book using tex

I wanted to add a cover page before the title page. but it always create a blank page after the coverimage. what is the proper code for adding a cover page without creating a blank page before title ...
1
vote
1answer
78 views

LuaTeX node insert_before in left margin

After playing with the answer the question here, I noticed some differences in insert_after and insert_before. node.insert_after adds contents to right margin, node.insert_before doesn't seem to add ...
2
votes
1answer
96 views

LuaTeX node library examples: like turn raggedright lines to raggedleft, and more

In addition to posting the right answer for the specific example in my question, please feel free to leave short snippets of code that display capabilities of node library Am new to LuaTeX node ...
7
votes
1answer
44 views

Formula behind tikz's `to [out=, in=]` curve

In the section 14.13 in Tikz manual, they define a parametric curve function like \draw $node1 to [out=90, in=180] $node2. An example from the PDF is like My question is : what kind of mathematical ...
3
votes
2answers
124 views

Why last character in TeX's input buffer must not be blank?

In §31 of tex.web it is said: Trailing blanks are removed from the line; thus, either |last==first| (in which case the line was entirely blank) or |buffer[last-1]!=' '|. Input should be the same ...
1
vote
2answers
122 views

Find the line number inside a vbox (at end of paragraph), and change the behavior of a macro that follows next

Edit: I have added a luatex solution as an answer to my question. I have a \vbox in which I plan to typeset long material (long poetry), the way it is typeset is slightly unique. There is a special ...
8
votes
2answers
237 views

Why curly braces are used when setting \spacefactor manually?

In texbook.tex the following code is used to fake plain TeX format: Subsequent paragraphs {\it are\/} indented.*{\spacefactor=3000} (See?) The computer breaks a paragraph's Obviously, curly braces ...
2
votes
1answer
57 views

Stretchability/shrinkability of \phantom and \llap and \rlap?

if a \hbox{...} contains some glue, e.g., due to space-tokens, the width of that \hbox{...} can spread or shrink. Do \phantom and \llap and \rlap spread/shrink in the same way? In terms of code-...
9
votes
1answer
165 views

TeXbook/Exercise 5.6 issues compiling it in expanded form

Exercise 5.6 of the TeXbook by Knuth reads: If you think you understand local and global definitions, here's a little test to make sure: Suppose \c stands for \count1=, \g stands for \global\count1=...
13
votes
3answers
333 views

TeX rules for determing a \par after comment

I'm confused about how comments, newlines, and \pars interact in TeX. Consider the following: ab a b a b a% b a % b a b a% b which produces the output ab a b a b ab a b a b a b I ...
7
votes
2answers
277 views

Why can I say \input something but not \centerline something?

I am currently reading through the TeXbook (6th printing, March 1986). In chapter 6 Knuth explains that \input story can be used to load/process story.tex. However, in the preceding chapter the ...
0
votes
1answer
82 views

Multiplication and division with counters while also formatting

See the code that follows. The user gives some pairs of numbers. Each time they happen also to be displayed. Finally they are added up in a specific way. \documentclass{article} %\def\Result... \...
1
vote
0answers
56 views

Specific instrument for correcting mistakes [closed]

I'm searching a specific instrument for Latex. My teacher showed me it once, but i cannot remember the name. It's functional in general is for long files, with big amount of code and formula's: when ...
1
vote
1answer
34 views

Why does pdflatex fail with newline in equation source? [duplicate]

I recently encountered behavior I've never seen before. This compiles fine: \documentclass{article} \begin{document} \begin{equation} f = x \end{equation} \end{document} But this fails: \...
2
votes
0answers
83 views

Why is the newline character not printed on terminal after entering batch_mode?

When TeX stops on an error, we can answer Q. In such case in the log file this is printed: OK, entering \batchmode... But on the terminal thsis is printed: OK, entering \batchmode<terminal ...
4
votes
1answer
78 views

Why `interaction` is changed(*) from error_stop_mode to scroll_mode right before exiting TeX?

Consider the following two extracts from tex.web: interaction:=scroll_mode; jump_out; "X":begin interaction:=scroll_mode; jump_out; I can't understand the reason behind interaction:=scroll_mode. ...
6
votes
4answers
439 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
79 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
301 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
277 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
815 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
257 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
132 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 ...
39
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
106 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
259 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
41 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
52 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
51 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 2 3
4
5
34