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

20
votes
2answers
627 views

The role of %&latex at the beginning of a source latex file

Could someone please explain what is the role of %&latex which is put in a source LaTeX file before \begin{document} command?
2
votes
1answer
83 views

Count “a” in text not in math mode, verbatim or lstlisting

I would like to count the "a" word in a text and put output to the PDF file, eg. This is a document about processing text in TeX. The document has a new macro but $a = 10$ is not counted, nor ...
10
votes
2answers
94 views

\csname not working as expected

The following code prints ==atname== \def\atname{atname} \def\xxx{name} \def\at{at} ==\csname\at\xxx\endcsname== \bye but this does not: \def\@name{atname} \def\xxx{name} \def\at{@} ...
12
votes
1answer
313 views

Is Knuth's *The TeXBook* complete?

Suppose I want to learn TeX. Then, is The TeXBook a complete source? Does it cover all relevant aspect of TeX? Or is there something worth learning about TeX which is not present there? Does also ...
1
vote
1answer
45 views

Pre-compiling with a different syntax [closed]

I am looking for a pre-compiler to introduce a customized syntax into LaTeX. Hope that an example will be worth a thousand words: I would like to compile this \thm The sum $ 1+2+3 is equal to ...
6
votes
2answers
69 views

Different Behaviors Digesting \csname x\endcsname and Digesting \x (expansion issue)

This question has been significantly EDITED, as I learned more of the problem. If I was good, I would be able to create macros with multiple optional arguments, but not only can't I, but in this ...
17
votes
2answers
372 views

Why does this simple \ifx test fail?

This should be easy, but I don't understand why the test below fails... I expected Hurrah! to be printed when the \currentchar count reaches 90 (i.e. the character code of Z). There must be some ...
44
votes
4answers
2k views

What is “expansion”?

I'm relatively new to (La)TeX, but I have a reasonable amount of experience with computational programming languages. Until I began learning (La)TeX, I'd never heard of "expansion"... So, what is ...
2
votes
0answers
91 views

Why does LaTeX impose a memory limit of 8,000,000 and can I circumvent it? [duplicate]

A few people have already asked the question of how to increase the maximum memory LaTeX is allowed to use (see here and here) because it is quite common for LaTeX to run out of memory when using, for ...
33
votes
4answers
691 views

How does a TeX engine read and render the input stream?

I am new to TeX programming and I have not finished reading the TeXBook yet. I need at a glance tutorial about how a TeX engine reads, processes, and produces its output. My mental model as a newbie ...
23
votes
1answer
370 views

The \lowercase trick

We have a number of questions or rather answers using (and explaining) the \lowercase “trick”. \begingroup \lccode`\~=`\. \lowercase{\endgroup\def~}#1{foo with #1} However, after reading on ...
9
votes
1answer
79 views

Namespace in luatex

Is it possible from luatex access registers where all names of command sequences are stored. Is it possible to pull out this list of names? I am looking for a way to trace how namespace changes during ...
3
votes
1answer
77 views

What can I do if I want to have a system for compilation to (AMS) LaTeX regarding restrictions to user-defined macros?

So I want to have a system where some user document is fully processed by TeX engine (full TeX engine!) and some data is collected to some helper file (saying "helper" just not make you think it's ...
76
votes
2answers
6k views

What's new in TeX, version 3.14159265?

The new Knuth TeX has been released in early this month, and its version number is 3.14159265 now. It can be downloaded here. What's new in this release? And a further-more question, where can one ...
7
votes
1answer
362 views

debug No room for a new \write problem

I have a template with an extensive documentation. (See TemplateDocumentation.pdf). It compiled several month ago. Now with updated packages it does not compile anymore because of the famous No room ...
8
votes
1answer
148 views

Cut last word from sentence one by one

I want to execute particular command for some space separated list as argument. And then execute the same command for the same list without last element and do it until list is empty. As extra point ...
6
votes
2answers
188 views

Counters and macros?

Not sure how I should post my question but here it is: I've seen that in plain TeX, \newcount is illegal inside a macro \definition. Is there a way to allocate a register inside a macro? Also, if I ...
3
votes
0answers
153 views

Can (La)TeX be a compelling technology for the humanities, journalism, and other non-technical disciplines? [closed]

All over the web, I see how LaTeX has been successful as a way of describing mathematical notation, which makes it pretty easy to argue that it is a compelling technology for science, technology, ...
6
votes
2answers
154 views

Allowing first undelimited argument to be empty

Consider the following macro definitions: \def\mymacro#1{\mymacroii#1\nil} \def\mymacroii#1#2\nil{% \ifx\\#1\\% empty% \else #1% \fi }% \mymacro{foo}% -> f \mymacro{} \bye This is ...
3
votes
1answer
62 views

Alignment problem or the height of one text line for \footnotesize text

I want to align the arrows so that it goes directly through the "x". How can I do this? It works if I use \normalsize font. The background is that I want to separate my Tikz document in text rows ...
8
votes
1answer
81 views

Hyphenation of the word “paraboloid”

It seems like my TeX does not hyphenate the word "paraboloid" on its own. After adding \hyphenation{para-boloid} (I hope that's the right hyphenation...) to the preamble everything is fine. My ...
23
votes
2answers
527 views

Backward definition of (La)TeX commands

Again and again I see, that TeXnicians define commands and do several things with them in the reverse order, I would do this as amateur. See this example: In his answer to scrpage2: Three ...
5
votes
6answers
478 views

A meta-language for LaTeX

Whenever I write TeX/LaTeX documents, I always find that annoying because I can't really focus on the content, It's not that I don't like TeX or what it does for me, it's just the fact that the ...
5
votes
1answer
302 views

Changing page margins in {pdf-,Xe-}TeX

In TeX, changing the \hsize and the \vsize changes the main text size and the page size of the dvi output. When I compile a document with pdftex or xetex, the page size remains at A4. How can I change ...
12
votes
2answers
484 views

All about \shipout

While reading about packages that allow to hook macros to certain events, I came across this command, \shipout. Searching on the internet didn't help a lot but if I'm not so wrong it's somehow related ...
6
votes
2answers
387 views

Can you do all what you want with TeX?

With LaTeX, I know you can put pictures in the documents, use different fonts, ... and practically do whatever you want (except the fact that your document must have a predefined style, imposed by the ...
7
votes
1answer
85 views

Getting the page breaks right for a \beginsection macro

I've found this code in the question No indent in the first paragraph in a section in Plain TeX \def\mysection#1{% \goodbreak \vskip2\baselineskip \noindent #1\par \nobreak ...
7
votes
3answers
209 views

How can I parse the first word in a token stream, token by token?

Some programming editors and IDEs highlight legal and illegal variable names in different ways. I wish listings easily allowed for such syntax checking and highlighting, but it doesn't, at least at ...
11
votes
1answer
158 views

XeTeXpicfile in vertical mode

Given a minimal like \line{% \vtop{\hsize=.6\hsize Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse tempor lectus sit amet laoreet convallis. Quisque at est lacinia, porttitor ...
0
votes
0answers
37 views

How can the following table be created in LaTeX [duplicate]

I have asked this question here, and asking it once again, as it was marked as duplicate, although it is different from the links that were pointed to be the same as the question. So, how can I ...
6
votes
3answers
156 views

Why cannot the word in the last column be centered

I have the following table: \begin{tabular}{|p{3cm}|p{1.5cm}|p{1.5cm}|p{1.5cm}|p{1.5cm}|} \hline \centerline {image} & \multicolumn{2}{c|}{ABC} & \multicolumn{2}{c|}{DEF} \\ \hline & ...
14
votes
2answers
196 views

What is the easiest way to modify catcodes in a string?

Assume that a token register contains a sequence of letter tokens, each having a catcode of 12. I want to store in a second token register the same sequence of letter token, altering some catcodes on ...
5
votes
2answers
261 views

How to get character code defined with \let (! Improper alphabetic constant)

Here's a example with the "! Improper alphabetic constant" error: %% this is ok \newcount\mychar \mychar=\number`a\relax \showthe a % shows You can't use `the letter a' after \the ...
4
votes
2answers
123 views

How to define a command \exponent that transforms $\exponent^e$ to $a^eb^ec^e$?

I have tried to define a command $\exponent$ that would look for next exponent and would put a copy of this exponent after a, another after b and a last one after c. $\exponent^e$ would transform to ...
9
votes
3answers
334 views

How to force LaTeX only commands?

Recently, I learned that for a long time I have been doing all of my mathematics in LaTeX incorrectly! I was using the $ TeX commands instead of the \( and \) LaTeX commands! I immediately went back ...
3
votes
0answers
57 views

Tex document that displays its own source code [duplicate]

Just out of curiosity, I was wondering how it is possible to write a LaTeX document which, when compiled, generates a document that contains exactly its own source code (i. e. a quine). Since LaTeX ...
39
votes
2answers
535 views

How to implement (low-level) arrays in TeX

Update: I have revised my question based on the comment by Bruno Le Floch and some further research. As some may know, I'm implementing a huge TeX macro package which has to do a lot of internal ...
12
votes
1answer
409 views

What does \empty do? [duplicate]

What does it do and what are its applications? I am currently testing the subtitle of my beamer presentation for its string length to decide about line spacings. Could it be simpler using \empty? If ...
10
votes
1answer
127 views

TeX doesn't recognize built-in control sequences?

I'm trying to learn to build things from the ground-up with TeX (not LaTeX---I've used LaTeX before, so I know how easy a solution "\usepackage{amsthm}+\begin{theorem}" is) and I'm trying to build my ...
6
votes
0answers
83 views

Testing if inside \halign [closed]

I am trying to write a macro that has a different behavior when called from text mode, math mode, display math, and math tables. The first three are easy enough with \ifmmode and \mathchoice. But the ...
0
votes
0answers
262 views

Weird behaviour in Texmaker (Changing the papersize) [closed]

I'm trying to change the page size in a tex document (I want a letterpaper size). I'm using Texmaker and the sequence Latex -> Dvips -> ps2pdf and my code is \documentclass[letterpaper]{report} ...
14
votes
2answers
2k views

\llap (or \rlap) at the begining of an indented paragraph

If I use a \llap{text} command at the begining of an indented paragraph, the text is not indented and is put on the line above the paragraph. \documentclass{article} \begin{document} \parindent=2cm ...
2
votes
1answer
196 views

ConTeXt: How to display last page number (Page # of #) in header/footer?

In LaTeX, I could do something like: \fancyhead[R]{\HeaderFont{\thepage{}/\pageref{LastPage}}} and/or \fancyfoot[R]{\FooterFont{\thepage{}/\pageref{LastPage}}} How to achieve the same with ...
0
votes
1answer
164 views

ConTeXt: How to maximize width of column depending on fixed sizes of other columns?

In LaTex, I could do something like: \newcolumntype{C}[1] {>{\centering\let\newline\\\arraybackslash\hspace{0pt}}p{#1}} \newcolumntype{L}[1] ...
7
votes
1answer
1k views

\newcounter vs \newcount [duplicate]

What are the differences between \newcounter vs \newcount? So far as my knowledge goes \newcounter is from LaTeX and \newcount is from TeX. Also, I find that \newcounter has an optional automatic ...
11
votes
1answer
513 views

What is the function of \noalign?

The use of \noalign is quite common. For example here \noalign is used with \vskip{}to control the height of a table cell. How does \noalign work in general, and how does it work with \vskip? ...
5
votes
2answers
155 views

Obtaining “greedy” pattern-matching in macros

Consider the following input to TeX: This is TeX, Version 3.1415926 (TeX Live 2013) **\def\a#1\par{[#1]} *\def\b#1\par{(#1)} *\a\b five\par\par *\end Two definitions have the same delimiter, so ...
4
votes
1answer
94 views

Expanding a variable within a protected label

I have some trouble with expanding variables within a protected label. I need a automatisated caption with a label all inside a command. Within the caption I want to have a two digit number ...
9
votes
1answer
148 views

How can I create a better cryptogram environment?

I put together a macro that takes two arguments. The first argument is a string of letters which defines a cipher. The second argument is a message to be encrypted using this cipher. ...
11
votes
1answer
88 views

\toks register expansion issue - or is it?

I am trying to assemble a table that occurs multiple times throughout a document. It always consists of some fixed columns, followed by a set of columns that appear in one table but are not needed in ...