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
13 votes
2 answers
251 views

Can I get at stuff in "current page" or "recent contributions"?

When I compile the following, \documentclass[a4paper]{article} \usepackage{atbegshi} \AtBeginShipout{\showlists} \showboxdepth\maxdimen \showboxbreadth\maxdimen \usepackage{lipsum} \newcommand\...
29 votes
4 answers
2k views

Why isn't a command defined by \newcommand with an optional argument expandable?

In trying to fix a problem with a nested macro repeatedly calling itself, I tried expanding the inner call before passing it as an argument to the outer one. This failed miserably because the macro ...
11 votes
2 answers
173 views

Does a space belong after pt?

Does a space always belong after pt, e.g. as used in \hskip1pt? If a space is used, are there situations where a space will appear where it is not intended? If no space is used, will pt be ...
27 votes
2 answers
1k views

Benchmarking various operations of TeX

TeX offers plenty of ways of doing some things, and it is sometimes difficult to predict which one will be quickest. For instance, how do a macro assignment a toks assignment a macro expansion a toks ...
27 votes
2 answers
4k views

Difference between \let\foo\relax and \def\foo{} for disabling

When I want some macro to (temporarily) do nothing, I normally write \let\foo\relax But somebody asked me why I don't just do \def\foo{} and I realized I couldn't answer his question. So, I have ...
4 votes
2 answers
364 views

Writing/Modifying Package

There is a package I'm trying to modify that essentially displays a grid. It uses counters to increment the distance. I want to change the distance each step instead of adding a constant value. In ...
7 votes
3 answers
2k views

LaTeX command with optional arguments

While writing lecture notes from statistical physics I found out, that I am often writing very similar long LaTeX sequences like \frac{\partial }{\partial <foo>} \frac{\partial <bar>}{\...
6 votes
2 answers
1k views

Problem with \mathpalette and \mathchoice

When working on an additional answer to this question of mine, I stumbled across the following problem with \mathpalette. For simplicity I give an example where in practice it is ridiculous to use \...
64 votes
1 answer
9k views

Is it \catcode or \catcode`?

I've noticed that \catcode is poorly documented in the TeXbook. The primitive is defined as \catcode but every time it is used, it is used as \catcode` ... the backquote is never discussed. ` itself ...
1 vote
1 answer
554 views

Unexpected conditional branch with \ifdim

I have a problem with the following code: \newtoks\sectoks \sectoks={\noindent} \newtoks\subsubjectstyle \subsubjectstyle={\emitsectglue 1\the\sectoks} \newtoks\postsectoks \postsectoks={\par\...
13 votes
2 answers
913 views

\expandafter within a \begingroup ... \endgroup [duplicate]

Possible Duplicate: What does \begingroup\expandafter…\endgroup do? In many of Heiko Oberdiek's packages one sees this type of construction: \begingroup\expandafter\expandafter\expandafter\...
7 votes
1 answer
260 views

How to extend the \romannumeral-based \fullyexpand to handle empty/all-space arguments?

In Expandable full expansion of tokens that preserves catcodes, Joseph Wright presents the following code: \long\def\fullyexpand#1{% \csname donothing\fullyexpandauxi{#1}{}% } \long\def\...
1 vote
1 answer
965 views

CTAN package 'invoice' on texlive debian/ubuntu

I am trying to use the 'invoice' latex package, which is supposed to be in texlive-latex-extra, however I keep getting the error "invoice.sty not found" at my \usepackage{invoice} line. I installed ...
0 votes
1 answer
3k views

Installing full version of Tex Live

For installing Tex Live by apt-get in Ubuntu, we have two options: basic and full. I installed Tex Live from source. The installed folder is 3.1GB with 104,030 files. Obviously this full version ...
8 votes
1 answer
600 views

Finding INITEX?

In the file plain.tex, in many places there are references like % When INITEX (the TeX initializer) starts up, % it has defined the following \catcode values: % \catcode`\^^@=9 % ascii null is ...
19 votes
3 answers
483 views

Where can I find a documentation for low-level tex conditionals like \if?

I want to understand low-level stuff like \if better. I'm not looking for some random examples off Google showing me some statements but a specification of some sort - something mean and unforgiving. ...
41 votes
6 answers
56k views

What is \iffalse for?

So this is something I've wondered about for a while. What use is a conditional that always evaluates to false? I guess it's a neat way to "hide code from LaTeX" but apart from that, is it ever useful?...
47 votes
6 answers
9k views

What reasons (if any) are there for compiling in interactive mode?

I'm a command-line junkie and often compile with a simple pdflatex filename.tex from a terminal, and I forget (or am too lazy) to type -interaction=nonstopmode or interaction=batchmode. Hence, when I ...
2 votes
2 answers
718 views

A problem for LaTeX's \@ifnextchar

I wanted to construct a command, say \newlet, that I could use to do \newlet\x\y and/or \newlet\x=\y such that \x is unique (ie, not already in use). Here we go \protected\def\newlet#1{% \@...
2 votes
1 answer
175 views

Producing Generic or Portable TEX Source Codes Using - the World Wide Web- Standards [closed]

Is it possible to write or produce a(n) -ultimate- standard coding pattern for TEX source codes those might work well enough across the "World Wide Web" on almost every each of platforms available, ...
16 votes
3 answers
412 views

How to determine which register a count uses

Suppose there is \newcount\c@mycountera \newcount\c@mycounterb \newcount\c@mycounterc Each \newcount uses \alloc@ and that has \wlog{\string#5=\string#2\the\allocationnumber}. Thus to determine ...
4 votes
3 answers
3k views

How do you change indentation in the middle of a paragraph?

I'll start with a little background info. Maybe it will help find an alternative solution. I have made a few macros for simple indented lists, text-editor-efficient (just add or remove an x to change ...
8 votes
1 answer
1k views

How to indent a \halign?

I have a weird problem. I want to indent a \halign, but it seems no matter what I try, it just does not like to be indented! Things I've tried: text \indent\halign{&#\hfil\cr foo& bar\cr ...
13 votes
3 answers
1k views

Can I make a command not gobble spaces?

(I'm using ConTeXt, but I suspect the answer will lie in plain TeX.) I've created an environment that takes one argument myBufferName, and stores its contents in a buffer of that name. Unfortunately, ...
88 votes
4 answers
27k views

What is the difference between 'fil' and 'fill'?

TeX provides the commands \vfil and \vfill (and their corresponding horizontal versions \hfil and \hfill). These commands are actually defined as: \vskip 0cm plus 1fil \vskip 0cm plus 1fill where '...
3 votes
2 answers
159 views

emacs keystroke remapping fails under TeX mode

I've remapped Ctrl-j to next-line with (global-set-key "\C-j" 'next-line) but this doesn't work under TeX mode where Ctrl-j "insert two hard returns (standard end of paragraph) and check syntax of ...
10 votes
2 answers
607 views

Hooks into mathmode

Short version Is there a way to pipe every symbol in a math environment unevaluated to an external program w/o manipulating the (La)TeX file directly (except for adding header files) or patching TeX ...
26 votes
2 answers
1k views

What’s behind \over?

Typically a TeX command have arguments coming after it. But the command \over, which is used to produce fractions, can access the token before it. How exactly is it implemented and can I define a ...
3 votes
1 answer
108 views

Custom numbered paragraphs gives odd page breaks

I was writing a specification document needing numbered paragraphs. I implemented it like this: \reversemarginpar \newcommand\countparagraphs{ \everypar{% \addtocounter{paragraph}{1}% ...
25 votes
3 answers
1k views

Whatsits: when are they used in practice?

This question came up in discussions surrounding the question How to replace a large block of text by an empty block of the same size?, which basically asks for a vmode analog of \phantom. My question ...
11 votes
2 answers
915 views

Difference between unrestricted and internal vertical mode

At any point in the processing of a document, TeX can be in one of seven modes: no mode (only in \write and similar commands, I think), math mode ($...$), display math mode ($$...$$), restricted ...
14 votes
1 answer
1k views

How to change \hsize in the middle of a paragraph at pagebreak, especially for two-column?

The original question is: How to get two columns with different width in LaTeX? I know this older question: How can I create a two-column layout with different widths (and texts) for the two columns? ...
9 votes
2 answers
365 views

How can the contents of a TeX \mark be viewed?

The purpose of marks in TeX is to generate running heads. One inserts material to a mark, simply by: \mark{A running head} If we write a short TeX program, we can see that the contents of \mark ...
14 votes
2 answers
3k views

Tabs versus spaces for indenting TeX documents

The title tells it all. What is a "correct" way to indent TeX documents? Different programming languages have different conventions. Python recommends 4 spaces. Your Makefile will not even work if ...
28 votes
3 answers
1k views

Does TeX always insert the macro \par?

When the input processor encounters two characters with category code 5 in a row (in other words, a blank line), it inserts the \par macro. When \vbox{Abc.} ends, TeX ends the current paragraph, but ...
16 votes
2 answers
358 views

Test whether \end will really end the run

Can I test whether calling the \end primitive will really end the run? The naive \ifdim\pagegoal=16383.99998pt yes\else no\fi is not sufficient (even adding to that mix \deadcycles). According to ...
14 votes
2 answers
482 views

Every possible \meaning that a token can have

In the context of a debugging package that I am writing, I need to analyse an arbitrary token in the input stream. What are the possible outcomes of \meaning<token>? Macro: (\protected) (\long) ...
7 votes
1 answer
235 views

Weird output of \tracingassigns with \font

Setting \tracingassigns to a positive value causes eTeX to write to the log file (and console when \tracingonline is positive) all assignments it performs. Thus, I would expect the following code to ...
6 votes
2 answers
3k views

Is there a command to ignore the following character?

Is there a command that ignores the following character, in the same way that \^ puts a hat over the following character?
8 votes
1 answer
503 views

How to adjust the slant angle of a diacritic

I am trying to change the slant angle of an accent. I have used the fontdimen to adjust the quantity. The first portion of the code that follows adjusts fontdimen5 (the x-height). This works as you ...
3 votes
1 answer
1k views

How to use WEAVE and TANGLE

I have a MikTeX 2.9 installation on Windows 7. I can use CWEAVE AND CTANGLE with no issues. If I try WEAVE sample.web null.ch sample.tex I get an error WEAVE: Read operation failed. The version ...
5 votes
1 answer
739 views

How can I reverse the order of letters/tokens?

I want a simple way to have: \reverseit{abc defg \mycommand} yield \mycommand gfed cba ? (Yes, the original motivation is related to Hebrew and RTL languages, but that can sort of be solved ...
7 votes
1 answer
345 views

Processing input files

What is the easiest technique to get the n-th line from a input file called input and pass it on to a macro called \process. Please note that I'm not asking about outputing the n-th line verbatim but ...
20 votes
1 answer
948 views

Is \toks necessary to define \g@addto@macro? Can token registers be avoided in generel?

In LaTeX2e kernel, there is a useful macro \g@addto@macro: \long\def\g@addto@macro#1#2{% \begingroup \toks@\expandafter{#1#2}% \xdef#1{\the\toks@}% \endgroup} However, I think the ...
22 votes
2 answers
1k views

Why is \baselineskip not inserted before an \unvbox?

It seems that \setbox0=\vbox{\hbox{abc}}\unvbox0 is not equivalent to \hbox{abc}: the former does not insert a \baselineskip in the following situation. \vbox{% \hbox{XY}% \hbox{abc}% \hbox{...
10 votes
2 answers
1k views

How to avoid underfull vbox in combination with \vsplit?

In the following example I am using the command \vsplit. I can't see the reason why \vsplit produced an overfull \vbox \documentclass{article} \parindent0pt \def\exampletext{Text Text Text Text Text ...
10 votes
1 answer
151 views

Why does the list of recent contributions contain exactly two boxes?

In the transcript of \nonstopmode \tenrm \vsize=2cm \output={\shipout\vbox{ \showlists \unvbox255 }} \hbox{blah} \hbox{blah} \hbox{blah} \hbox{blah} \hbox{blah} \hbox{blah} \hbox{blah} \hbox{...
5 votes
1 answer
134 views

Read manuscript in to output

I want to put my source plain TeX file in the output of the same plain TeX file. As I remember coming through a macro, that can put a file's content in to the output, but only \input comes to mind. ...
8 votes
2 answers
400 views

How do I redefine a macro when any group begins, then again when that group ends?

Okay, I know this is a pretty tall order, but I'm working on a package based on my answer here, and I'm including Ahmed Musa's environment which redefines \par. The problems are: Some environments (e....
10 votes
2 answers
2k views

Finding TeX Sources in C

Why is it so hard to find TeX sources in C? I know the full source code is included in the tex.web and pdftex.web files, but isn't there any way to convert them to plain C code?