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

0
votes
0answers
58 views

How to go about learning to program in Tex? [duplicate]

I have been using Tex for a few years now and enjoyed the work of others (e.g., ctan packages, templates, styles). My question sees to practical code to learn from. What would be a good primer, or ...
8
votes
1answer
60 views

Is it possible to adjust the “quantization” of allowable skip lengths?

In plain TeX and derivative formats, the concept of stretchable/shrinkable length, AKA a glue or a skip or a rubber length exists, in general defined as <dimen> plus <stretch-dimen> minus ...
3
votes
1answer
58 views

TeX expert needed: how to \setto(optimal)width?

there is a problem I have been trying to solve for a while but without success so far. As far as I know, TeX is very good at appropriately breaking text lines with respect to a fixed container width. ...
0
votes
0answers
26 views

Stack Exchange latex equations how [migrated]

What are the , sorry my terminology may be of, latex 'tags' used on this site? E.g. on TeXworks on my pc its \( to open and \) to close. its \begin{equation} to open and \end{equation} to have an ...
2
votes
0answers
42 views

Rendering text as image to protect e-mail address

I want to protect my e-mail address against spammers by including it as image instead of a (parsable) text. Normally I would have to create the image (with text) by myself and include this as figure. ...
8
votes
5answers
314 views

A more elegant version of the \ifnot macro

A TUGboat article of 15 years ago mentions an \ifnot macro by David Kastrup whose implementation is: \def\ifnot#1{#1\else \expandafter\expandafter\fi \iffalse\iftrue\fi} However, this macro ...
14
votes
2answers
220 views

How can own commands be aware of \global?

When I define a command that defines commands \def\makefoobar{ \def\foo{foo} \def\bar{bar} } and prefix it with \global { \global\makefoobar } it is treated like { \global\def\foo{foo} ...
6
votes
1answer
89 views

How do counts differ from numexpr

To do basic arithmetic on numbers, one can utilize TeX counts, \newcount\c \c=2 \advance\c 3 \typeout{\the\c} LaTeX counters \newcounter{c} \setcounter{c}{2} \addtocounter{c}{3} \typeout{\thec} ...
1
vote
1answer
41 views

How could I write a Latex tag in source form in section name?

I tried to use \verb|| and \lstinline[language={[LaTeX]TeX}]{} and they failed. I just want to write a name of latex tags in section names for internal purposes. For example, I couldn't compile a ...
11
votes
2answers
84 views

split off function for variable as separator

How/Possible to change this implementation of \xSplit so that the separator is a variable filled in at the time of definition (\edef somehow?) or at the actual use of the command?? %based on the ...
12
votes
1answer
143 views

Inserting tokens at end of math mode

One can use \everymath and \everydisplay to insert tokens at the beginning of math mode, but what about inserting tokens at end of math mode? Lets say I want to enclose the math mode material in a ...
3
votes
2answers
96 views

Redefining line break (double backslash) for align environment

I am trying to figure out if it is possible to (locally) redefine \\ (double backslash) within amsmath's align environment. On the one hand, I'd like to be able to dynamically insert extra columns, on ...
3
votes
1answer
74 views

How to avoid typesetting any cell if a table is empty

Following How can I define a macro that adds a row to a table that has not yet been printed?, I came up with a macro (\AddToTable) that “builds” a table, i.e. appends its argument as the last row of ...
11
votes
5answers
461 views

Basics of scanning

I'm trying to master the art of scanning text one character at a time. The following is what I've discovered so far. Is this as good as it gets? I would really prefer not to do all those \edefs as ...
0
votes
0answers
18 views

widesplit macro explanation [duplicate]

Could you please explain how this macro function ? \def\widesplit#1{% \cleardoublepage \def\row##1##2{##1}% #1% \clearpage \def\row##1##2{##2}% #1% \clearpage } OK, some things are clear to me. def ...
10
votes
1answer
93 views

assign penalty to one discretionary (not all paragraph)

For a quite complex problem that would be too long to describe, I need to set different penalties for different discretionaries in the same paragraphe. It doesn't seem to be possible with pdfTeX (and ...
19
votes
2answers
406 views

\expandafter and \aftergroup: where do the 2n+1 and n^2-1 rules come from?

Both TeX primitives \expandafter and \aftergroup have "rules of thumb" stating that \expandafter should be used 2n+1 times to look n tokens ahead (is this correct?). A similar "rule of thumb" holds ...
1
vote
0answers
71 views

Memory overload due to pgfplots / tikz

first of all, I need to mention that there are 2 related threads, that I found usefull: 1, 2. I am working with TeXstudio 2.8.8 on Win 7 64bit (i5 @3.3GHz, 8GB RAM - if this matters). My goal is to ...
1
vote
1answer
52 views

Passing values from PythonTeX to LaTeX

I have read in the PythonTeX manual about how to pass LaTeX values to PythonTeX, but I cannot find any documentation (or a way) to do the reverse. For example, in the LaTeX package datenumber, one ...
3
votes
1answer
43 views

Specifying coordinates with \def in PSTricks

I'm starting with PSTricks. I use the following macro to set cartesian coordinates: \def\newPoint#1(#2,#3) { \expandafter\def\csname x#1\endcsname{#2} \expandafter\def\csname ...
0
votes
0answers
72 views

TeX capacity exceeded, sorry [input stack size=5000]

I am trying to compile the first three chapters of my dissertation but I am getting the following error: Errors: ./EQM-TAR.tex:70: Undefined control sequence. [\paginaresumo] ./EQM-TAR.tex:70: TeX ...
7
votes
1answer
152 views

What does mathchar do?

The package cmll defines \with (looks like '&') as $ texdef -t latex -p cmll with \with: \mathchar"2026 \the\with: 8230 When I take a look at \& it is defined as texdef -t latex \& ...
1
vote
0answers
67 views

What is the core of TeX as a programming language? [closed]

Tex (and LaTeX) mix programming elements with typesetting ones. It's often confusing to a beginner to tell them apart. Could anyone show me a list of the very core commands of TeX (and perhaps LaTeX) ...
4
votes
2answers
106 views

plain TeX error. Undefined control sequence. \pgfutil@

I'm trying to compile the fix mentioned by egreg in this thread: Strange behaviour with PGF/TikZ and Plain TeX output routine Here's the code: \input pgf \catcode`@=11 \newbox\pgfutil@@Output@Box ...
19
votes
1answer
376 views

How do I get into XeTeX development?

The support for OpenType fonts has been a great advancement in terms of usability. Unfortunately the microtype package does not offer font expansion for OpenType fonts in XeTeX. I dug a little ...
12
votes
2answers
217 views

Assertions in Latex

I am writing a long latex document and use many macros for defining mathematical symbols. I would like to ensure that there is no clash in the notation. For example, something like ...
3
votes
0answers
60 views

plain TeX and paragraphed notes

The TeXbook proposes, p. 398sq, a system to obtain paragraphed note. That is, instead to obtain Footnote. Footnote. Footnote obtain : Footnote 2. Footnote 3. Footnote. In ...
11
votes
1answer
141 views

Why this output using \string on the empty csname

How does this exactly work? \expandafter\string\csname\endcsname I don't know what I would expect to come from there, but definitely not \csname\endcsname_ where _ is a space. I thought ...
7
votes
1answer
239 views

What is this file and how to compile and tranform it?

I was given some files to update. They were produced in late 1990s and seemed to be related to LaTeX. However, I could not compile them at all. To begin with, there is no \begin{} or \end{}. In ...
2
votes
1answer
70 views

Redefine a primitive parameter

I want to redefine a primitive parameter as a macro, and make the macro behaves the same as the primitive parameter in some situations. \tracingcommands = 1 \the\tracingcommands ...
8
votes
3answers
110 views

Appending active and expansion sensitive characters to a macro

This question comes up pretty often when people want to build tables with empty columns or similarly building up some active characters inside a macro hoping to expand them at the right time right ...
6
votes
1answer
73 views

An insert macro

Once in a while I try to understand how TeX works... Hitherto now success, but sometimes I manage to define a macro. For example, \def\appendto#1#2{\expandafter\def\expandafter#1\expandafter{#1#2}}% ...
1
vote
1answer
108 views

Can openout handle a filename with spaces?

With pdflatex, can \openout handle a filename with a space in it? (We're using MiKTeX and our users seem to think it's clunky to restrict them in this way. We also have tons of legacy TeX files and ...
3
votes
1answer
60 views

Typesetting text in multiple languages without repeating the text

I am working on typesetting an Indian text in three languages using ITRANS + XeTeX. I have pasted an example below. How do I avoid having to repeat the text for getting three different outputs. Can I ...
1
vote
1answer
86 views

cryptic plain TeX: Twelve days of Christmas

Many years ago, probably in TUGboat, I saw a shortish piece of \TeX\ that immediately deploys catcodes and very quickly becomes completely unreadable, but when typeset produces the old "twelve days ...
1
vote
1answer
108 views

\newcommand in imsart package

I am currently using the imsart package provided by http://www.e-publications.org/ims/support/ims-instructions.html However, it seems the pdfLatex/Latex/pdfTex/pdfTexify compilers cannot read one ...
4
votes
2answers
85 views

loop in tabular that uses \the\count to access current line number

I would like to generate an autmatic table using loop. As suggested here before, it is best to first generate the lines in a toks and then pass them to tabular. However, I have problems with accessing ...
0
votes
0answers
32 views

TeX Usage of the Ampersat (@) [duplicate]

I've had trouble finding easily accessible information on what exactly the ampersat does in TeX- it seems to be used frequently in the implementations of the commands I use, yet I've never had to use ...
2
votes
2answers
90 views

define a macro with two parameters delimited by optional spaces

I want to define a macro with two parameters which delimited by optional spaces. For example, from the following code \def\mymacro #1 #2 {#1:#2 } \mymacro one two others I get one:two others. But ...
2
votes
1answer
167 views

Implementing the Sum Function in TeX

How would I go about implementing a function in TeX to add an arbitrary number of numbers? Reading through the \def notes, it seems it can only take up to nine arguments. How would I make a function ...
0
votes
0answers
45 views

Where is this TeX magic line “%&” documented? [duplicate]

I learned about this magic %& line that is supposed to hint at the flavour of TeX a file is using. Where is this magic documented? I have not been able to find it anywhere.
111
votes
10answers
8k views

Why is LaTeX so complicated? [closed]

I have been using LaTeX professionally almost every day for almost 10 years, so I think I can say that, by now, I more or less know what I'm doing. I also do a lot of ordinary computer programming, in ...
40
votes
1answer
899 views

What are the incompatibilities of pdftex, xetex and luatex?

[Please correct me if my statements are wrong] TL;DR: pdftex, xetex and luatex exhibit different behaviour. What are these differences and why are they present. I know of three engines, which ...
5
votes
1answer
238 views

TeX at the Command Line

How does TeX work at the command line? More specifically, after having installed LaTeX, I found that typing tex in the command line opened up an interpreter. However, I have no idea what I can do ...
3
votes
4answers
185 views

Conditional \end or \bye in TeX (plain-tex)

Can someone figure out a conditional \end or \bye in TeX-Code? (plain tex) I want to put in several lines into a TeX-file, each ending with \end , to be compiled before the document is complete, to ...
5
votes
1answer
158 views

Macro in Tex Programming

I am confused whether the below macro is for section or what? If yes can anybody help me to explain this piece of code \def\Section #1 \par { \bigbreak\vskip\parskip \need 1.5 in ...
1
vote
0answers
174 views

TeX Programming [duplicate]

I have lot of confusion regarding TeX and LaTeX. What I have understood is TeX is basically macro instructions, and LaTeX uses that macros or we can say TeX is extended to LaTeX. But, really not very ...
15
votes
0answers
181 views

Test if paragraph has an overfull line

I'd like to test if the last paragraph has any overfull line. The naive approach of looking at the \badness once the paragraph is finished does not work, as it will only give the badness of the last ...
2
votes
1answer
86 views

Are there any ways to embed LaTeX source code from a PDF file [duplicate]

I want to the tex files from PDF files. I have the PDF files that I get in Internet and have a lot of mathematics, so I want to convert PDF files into tex files. I researched in these forum, and ...
6
votes
2answers
174 views

Macro expanding to a file's contents?

How can I define a macro so that it expands to a file's contents?