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

59
votes
1answer
2k views

A LaTeX log analyzer application (visualizing TeX expansion)

Consider the following MWE, test.tex: \documentclass[12pt]{article} \begin{document} \tracingassigns=1 \tracingmacros=1 \def\aaa{something} \def\bbb{else \aaa, else} \edef\ccc{third \bbb, level} ...
19
votes
2answers
380 views

Will LaTeX work on any TeX?

As I understand it, latex is simply a macro package for tex, as in tex the program, not the format. (Again, weird, but I understand LaTeX to be a format of TeX.) Does this imply that LaTeX the ...
6
votes
0answers
117 views

Replace paragraphs with boxes [closed]

I would like to replace the paragraphs of a compiled document with framed boxes. Although I read the /tex/latex/base documentations I have no idea how to tackle this problem. In detail I want to ...
27
votes
2answers
2k views

Components of (La)TeX's memory usage

After reading Increase LaTeX capacity and not being able to summon Gandalf1, I am curious to know what contributes to the components of memory usage during a (La)TeX compilation. Take the above post's ...
10
votes
1answer
151 views

How can latex and pdflatex be both symbolic links to same executable (pdftex) and not behave the same?

When I run $ latex my_doc.tex and $ pdflatex my_doc.tex it works, and when I run $ pdftex my_doc.tex it doesn't work. The thing is I noticed that both LaTeX and pdflatex commands are ...
40
votes
1answer
616 views

On the basics of writing to & reading from auxiliary files (.aux, .toc, etc.)

Some actions (such as generating the Table of Contents) require two passes of the TeX compiler: during the first pass, some data get written to an auxiliary file, only to be retrieved during the ...
2
votes
0answers
91 views

How to generate an AFP document by using LaTeX compiler?

I'm working on a new program who have to generate an AFP file. I would like to generate this kind of file by using a powerful language like LaTeX. Because I hate Dialog (HP solution), is there a ...
13
votes
1answer
180 views

What practices are there regarding the use or avoidance of “internal” TeX or LaTeX commands?

What practices are there regarding the use or avoidance of "internal" TeX or LaTeX commands? (About "command" vs "macro", there is some discussion in this TeX.SX answer, though I don't know whether ...
11
votes
1answer
181 views

TeX capacity exceeded, sorry [semantic nest size=500]

Reading through tex.web, I note that there is a difference between grouping levels and semantic nesting (i.e., the nesting of math, horizontal, and vertical modes). I can think of commands which ...
29
votes
1answer
912 views

How to generate “You can't use \unskip in vertical mode”?

We all know (or believe so) that \unskip is not possible in main vertical mode and this statement can be found in various answers on the site. And yes LaTeX does a lot of gymnastics in \addvspace or ...
3
votes
1answer
104 views

How to include a tex file with own formatting options

I have two tex files, tex1 and tex2. I want to include tex1 into tex2. I know \include and \input but those won't allow to include tex files with own formatting. tex1 has a header for example but tex2 ...
2
votes
2answers
10k views

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

I want to test this template http://students.engr.scu.edu/~sschaeck/latexforthesis/. when i run the makefile i get this error .Please what does it mean this error here the code : ...
12
votes
3answers
575 views

Is there a printable version of a reference manual for all TeX primitives?

Everywhere in the TeX community, I see suggestions like \parskip, \obeylines, \parindent, etc. I'd be surprised not to find them even in the most basic LaTeX packages. So I figured they must be deeper ...
83
votes
4answers
15k views

When to use \edef, \noexpand, and \expandafter?

I'm quite happy hacking TeX macros and cobbling together bits and pieces from different style files to suit my own ends, but I have a suspicion that my resulting hacks are not quite as elegant as they ...
4
votes
1answer
127 views

How to make a rich png image from a Latex Math Equation [duplicate]

I have a LaTeX math equation that I have been trying to convert it into a rich .png image by compiling the .tex file into .dvi and then from .dvi to .png. But I noticed that the Image is small and the ...
51
votes
3answers
3k views

2013, year of the TeX bugs report. Will pdfTeX, XeTeX, etc. be changed accordingly?

Barbara Beeton said (TUGboat vol. 34, pag. 4): As noted on Don Knuth's TeX web pages, www-cs-faculty.stanford.edu/~knuth/abcde.html, he "intend[s] to check on purported bugs again in the ...
29
votes
3answers
35k views

Escape character in LaTeX

I need to output the below text but since \ is a special character, I cannot: [RegularExpression(@"\d+")] Also sometimes I need use dollar sign $ as well but it seems to be a special char, too. ...
3
votes
1answer
96 views

Hook tex macro without altering tokens stream

Is is possible to hook a macro with function which writes some info to file or log without altering stream which creates dvi file. For example if i have macro definition \def\foo{\mathop{A}} and i ...
2
votes
1answer
348 views

How to convert an A5 document (PS or PDF) to an A4 document (PDF)?

I have a document with A5 pages (created from a TeX file) and want to combine pairs of A5 pages to A4 pages. That is, without scaling, page 1 and 2 of the A5 document should become page 1 of the A4 ...
9
votes
1answer
101 views

Interactively look up macro definitions

In a TeX document, the primitive command \show will print out the current definition of a macro one level deep (it won't (and can't?) reduce to primitives). This comes with the restriction of actually ...
16
votes
3answers
250 views

Can I convert a string to catcode 11?

In the TeX FAQ there's a way to test if the jobname is equal to something (comparing the jobname). The difficulty of the naïve test is that the contents of the \jobname primitive are catcode 12 so to ...
13
votes
1answer
689 views

\jobname, character codes and \detokenize

I recently wanted to compare \jobname to a string (with the xstring package) and was rather surprised that the string never matched. Tho internet told me that I had to use \detokenize on the string. ...
15
votes
2answers
256 views

Use of \everyeof and \endlinechar with \scantokens

The e-TeX \scantokens primitive allows retokenization of input. However, it is almost always used in a group where \everyeof and \endlinechar are set (see for example Can I convert a string to catcode ...
12
votes
2answers
136 views

What would be a suitable replacement for ifcsname in a non-etex situation?

From the pgfkeys.code.tex file: % This is useful: \def\pgfkeys@ifcsname#1\endcsname#2\else#3\fi{\expandafter\ifx\csname#1\endcsnam e\relax#3\else#2\fi}% \ifx\eTeXrevision\undefined% \else% ...
11
votes
2answers
380 views

Is a TeX macro defined?

I am looking for a way in TeX to check if a macro was defined. Currently I use a rather tangled way. I exploit a sort of side effect when comparing two macros via \ifx; this command returns: true, ...
17
votes
1answer
125 views

What primitives can expandably tell us about the current horizontal list?

I've been writing some code that expands macros and catches characters and non-expandable primitives as they reach TeX's stomach, and I encountered an issue: since I gather letters one by one, with ...
20
votes
2answers
2k views

What are the exact semantics of \detokenize?

How does \detokenize work? The e-TeX Short Reference Manual states: When followed by a <general text>, expands to yield a sequence of character tokens of \catcode 10 (space) or 12 ...
11
votes
4answers
164 views

Partially expanding a command

My \john command is defined like so: \def\john{\DontExpandMe} I would now like to repeatedly change its definition, to keep adding some extra stuff on the front. \foreach\i in {ape,bat,cow,dog} { ...
51
votes
2answers
1k views

If LaTeX is only a macro package, why does it have its own executable?

From other answers on this site and the FAQ of the TeX User Group my understanding is that: TeX is the original typesetting program, written by Knuth Omega, eTeX, pdfTeX, XeTeX, LuaTeX are engines. ...
7
votes
2answers
474 views

Highlighting haskell listings in large *.tex document [duplicate]

Suppose, there is a large *.tex document, which has many nested \input directives with many Haskell listings surrounded by \begin{code} \end{code} commands. How can all this code listings be ...
7
votes
1answer
524 views

TeX ignores \vskip at the beginning of document

Here is a simple Plain TeX snippet for demonstration \vskip 3in Aaaaa \vskip 3in Bbbbb \end When I compile this with pdftex, I expect to see a 3-inch-high blank space, then Aaaaa, followed by ...
6
votes
2answers
219 views

Learning how to use TeX for automatic layout of non-technical documents

Whenever I try to learn more about TeX or LaTeX, I am stymied by the general bias of the books and online resources I have seen, and possibly by the bias of LaTeX itself. I am not interested in using ...
59
votes
3answers
51k views

\vspace vs. \vskip

What is the difference between \vspace{-1em} and \vskip -1em, for example? I guess the first is LaTeX, and the latter is TeX. When is the proper time to use one and not the other, and why?
7
votes
0answers
79 views

What is the difference between \def and \newcommand (Part II)? [duplicate]

A previous question What is the difference between \def and \newcommand? has discussed the difference between \def and \newcommand at some length. However, I cannot find in that discussion an ...
13
votes
5answers
274 views

Checking if a string contains # with its original catcode

At comp.text.tex the following scheme was suggested for testing if a string contains the parameter character with catcode 6. \def\endcheck{\endcheck} \def\second#1#2{#2} ...
41
votes
3answers
1k views

Why no vertical-mode Knuth-Plass?

I have only basic knowledge of the TeX internals, so I hope what I am saying here is not complete nonsense. If I understand correctly, in TeX, horizontal positioning / line breaking is done using a ...
8
votes
3answers
1k views

How to make a ruler

In The TeXbook (Ch. 10, after exercise 10.3), DEK shows some nice rulers. But I couldn't figure out how he did them. I'm sure I could look it up from the texbook source, but for some reason I'm ...
8
votes
2answers
110 views

\setbox containing maths interferes with surrounding math mode in XeTeX

I encountered what might be a bug in XeTeX (but I would be glad to be proven wrong) while chasing a strange interaction between bytefield, unicode-math, and mathtools. In general, I do not expect a ...
7
votes
2answers
134 views

Why does TeX attempt to insert 'missing' tokens?

"Missing \cr inserted", but it looks to me like it's already there! Missing $ inserted ... Why does TeX attempt to insert missing tokens? Why doesn't it simply throw up and die? ...
7
votes
2answers
184 views

Stupid error caused by doing stupid things

When I was writing my thesis I wrote the following two commands which I found useful (and still do). They are both ways of defining other commands. \usepackage{ifthen} \makeatletter \def\optional ...
3
votes
0answers
216 views

What is a working python code snippet for escaping a string, so that it can be included in a tex file? [closed]

I'm using python to populate a tex template with arbitrary strings - and I would like to escape the strings so they're interpreted and displayed properly inside the tex file (rather than having them ...
21
votes
5answers
980 views

More Modern Reimplementations of TeX

There is no doubt that the original Pascal/WEB implementation of TeX is a masterpiece and I have learnt a lot reading through the source code (both weaved and tangled) but it definitely shows its age. ...
5
votes
1answer
37 views

How to use tangle to merge to get a single merged file from original source and change files

I'm trying to read and understand the TeX source, but it is difficult to keep track of when I should be reading code from the original file and when I should be reading code from the change file. I ...
24
votes
5answers
855 views

How to find out where a macro is defined?

Using \@ifdefined (in LaTeX), we can check whether a command is defined. Using \meaning, we can get the definition of a command. Can we also get information about where a command was defined? For ...
15
votes
3answers
861 views

Difference between \mskip and \mkern

What are the differences between \mskip and \mkern? The TeXbook writes the following (ch. 18): You can insert math glue into any formula just by giving the command ‘\mskip⟨muglue⟩’. [...] ...
7
votes
3answers
653 views

How do I get the width of \hfill?

In my LaTeX document, I have a first line with a given spacing obtained using \hfill, then a paragraph, and then a third line in which I would like to use the same spacing as in the first line. The ...
19
votes
2answers
438 views

Outright impossible TeX byte sequence

Out of a hacker's interest, I am wondering if there is any byte sequence that can never occur in any valid TeX document before \end is processed. I thought of things like {\catcode`}=9\catcode`\=9 ...
3
votes
1answer
69 views

TeX document allowing any byte sequence being inserted

Out of a hacker's interest, I looked for a TeX document into which an arbitrary byte sequence can be inserted without causing the TeX process to fail, but had a similar issue; I basically set all ...
10
votes
2answers
326 views

Starting point for getting more familiar with TeX/LaTex etc

Background: I've been using what I would call LaTex for ~4 yrs to typeset assignments, reports, essays and tutorial notes. I have been using "TexShop" (for Macs) - mostly because it was simple when I ...
1
vote
0answers
47 views

Errors after TeX Live 2012 update on Ubuntu 12.04 [duplicate]

I wanted to use mdframed package but I was getting the error package not found. I followed the advice here to update to Text Live 2011. However, I figured out there is Tex Live 2012 and therefore ...