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
2
votes
1answer
53 views

The effect of triggering the re-writing/creating anew of a text file which currently is processed via `\input` puzzles me?

I tried to create a .tex-file fileb.tex which can be \input by filea.tex and which - when being input - stops being input and triggers rewriting itself. In my first attempts I erroneously omitted \...
3
votes
2answers
104 views

Is there a way to check whether we're inside a table?

I have a syntax highlighting program that outputs LaTeX code. The generated code can be used in regular text or in a tabular to do more advanced layouts. The generated LaTeX output includes \my@eol ...
6
votes
2answers
99 views

Why does `\endinput` bring TeX into interactive mode while there are still tokens to process?

Minimal example consists of two files: fileA.tex: \def\foo#1{#1} \foo{\endinput\input fileB.tex}% fileB.tex: This is file B. \bye I assumed that compiling fileA.tex would lead to a file fileA.pdf ...
3
votes
2answers
120 views

Installing *just* TeX

For a project, I intend to use TeX as a “backend” to layout and generate PDF, i. e., my program would emit core-TeX code to be immediately compiled. I think that means I just need pdftex or xetex + ...
1
vote
1answer
50 views

kpathsea-warning when using filenames containing $&?

The MWE, test.tex: \documentclass{article} \begin{filecontents*}{A$&1file.tex} Hello, World! \end{filecontents*} \begin{document} \input{A$&1file.tex} \end{document} The MWE does not ...
174
votes
5answers
43k views

What exactly do \csname and \endcsname do?

What exactly do \csname and \endcsname do? What are their job? I have glanced at the Texbook and some other books, but none of them was clear enough to me. Can anyone please give a simple example to ...
144
votes
8answers
106k views

How to expand TeX's “main memory size”? (pgfplots memory overload)

I'm compiling one pretty simple LaTeX file with few dozen of pgfplots. Now, I can compile part by part, but am unable to compile it all at once. I really need good precision for all those plots (noise ...
4
votes
2answers
316 views

Can someone explain what is labxx in the source code of tex

As shown above, I saw many labXXX in the source code of tex and pdftex. I'm really confused about them and there is no comments at all. Is there any doc that demonstrate the meaning of every labXXX? ...
0
votes
0answers
32 views

Using [subpreambles]{standalone} causes the document to not compile

Yesterday I had this problem which was quickly resolved, but now the Solution doesn't work anymore. The problem happens with this small piece of code already: \documentclass{article} \usepackage[utf8]{...
5
votes
4answers
245 views

Double hashes inside macro definition?

Assume a macro which is not defined in terms of \long and which is not defined in terms of \outer and which is not defined in terms of \protected and which does not process arguments and whose ...
9
votes
1answer
164 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=...
0
votes
1answer
65 views

Centering text in a valign without finetuned column width

Currently, I have the following valign output from this code (Plain TeX): \def\make#1{{\hsize1.5in\vfil\centerline{\strut #1}\vfil\hrule}} \valign{\hrule\make{#}&&\make{#}\cr\noalign{\vrule} ...
0
votes
0answers
35 views

Use minimum size pdfTeX to output pdf file

I want to use TeX to build .pdf file in my program. But TeX Live is too large and I wanna to embed TeX in my little program - it means the TeX should be as small as it can. I try to sreach in Google, ...
3
votes
1answer
221 views

What does a number in an Undefined control sequence in TeX's prompt do?

$ latex This is pdfTeX, Version 3.14159265-2.6-1.40.18 (TeX Live 2017) (preloaded format=latex) restricted \write18 enabled. **\s666666 entering extended mode LaTeX2e <2017-04-15> Babel <3....
3
votes
2answers
123 views

Determining the “size” of a font

In Plain TeX (and really as a TeX primitive), \font\myfont=cmr8 at 10pt and \font\myfont\cmr10 both create fonts with "sizes" of 10pt. I want to be able to use this value to generate ...
2
votes
1answer
54 views

How to deal with empty values in command arguments

In this MWE, a command argument is directly passed to an environment. That works fine with empty values: \documentclass{article} \newcommand{\minipag}[1]{% \begin{minipage}[b][#1][b]{6em} One ...
0
votes
1answer
227 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 ...
3
votes
3answers
176 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} \...
9
votes
3answers
434 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 ...
4
votes
3answers
364 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
161 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 ...
2
votes
2answers
115 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 ...
8
votes
1answer
2k views

All LaTeX commands list

I'm writing a LaTeX commands highlighter in C#, for this I need all or most of the LaTeX commands. I've searched the web and found many lists of commands but all of them are with comments and ...
1
vote
0answers
44 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
321 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 ...
18
votes
2answers
966 views

productivity tools

I am using latex to write a mathematically dense document which has several hundred differential forms and products. There must be better ways than just typing out the whole equations line by line. ...
1
vote
1answer
78 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
47 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 \...
73
votes
4answers
5k views

What is a token?

Please forgive such a basic question, but I did some Google searching and looked around on this site, and while there are many threads and online resources that involve tokens, I can't seem to find a ...
13
votes
2answers
2k views

On unprotecting (expanding) \protected macros (or, “the space after command name”)

I quite often come into a situation, where I need to obtain some text produced by a package macro as a string, like in say: Expanding (edef) a lipsum command? How do I "unprotect" an ...
7
votes
1answer
43 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 ...
2
votes
2answers
134 views

suppressing messages to standard output from package morewrites

I have to use morewrites and I do not like the fact that it writes to standardout since I miss other messages. Is it possible to suppress the messages concerning .mw? That is [1] (./debug-morewrites....
0
votes
1answer
101 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 "...
3
votes
1answer
110 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
527 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
324 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
87 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 ...
2
votes
2answers
124 views

How to modify \everypar safely in a package?

This is a follow-up to What does the \the\everypar do? and TikZ Overlay: Inject content at the start of the next paragraph? From a quick grep -R '\\everypar' texmf-dist/tex/latex I can see that \...
1
vote
1answer
158 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
0answers
65 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
74 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
95 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 ...
3
votes
2answers
123 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
118 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
236 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
51 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-...

1 2 3
4
5
34