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

10
votes
1answer
1k views

Newline/linebreak in \message

I want to prompt some messages to my console. I used \message{Hi out there!} Now i want some more Text but with an linebreak. \message{Hello World %some line break here Salut monde } Well i ...
10
votes
1answer
207 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 ...
10
votes
2answers
657 views

Do XeTeX and LuaTeX always use Unicode?

I am writing some functions to manipulate strings. A typical way to produce a character with a given character code is the \lowercase primitive. The following code produces a character with code 234, ...
10
votes
2answers
333 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 ...
9
votes
6answers
1k views

Function like macro?

If you have programmed in a high level programming language, you must be familiar with the concept of functions, subroutines which return a value. For example, if you write in C, you can write a ...
9
votes
4answers
868 views

Writing Roman numbers in Equation

What is the command for writing roman numerals like I, II, IV etc. in an equation ? To be noted that my requirement is to write them within $$ ...$$ and not as counters or page numbers. Any light on ...
9
votes
2answers
358 views

Where to find official (!) and extended documentation for tex/latex's commandline options (especially -interaction modes)?

Today I tried to learn more about the several interaction modes for tex/latex/pdflatex etc. The manpages turned out to be not very helpful: $ man tex ... -interaction mode Sets the ...
9
votes
2answers
599 views

Force the expansion of a macro parameter without \edef or \xdef

Two days I am looking for a solution but I have no more idea. This is my problem. I'm trying to create a macro to automatically define new other macros to write references in a document. I want to ...
9
votes
3answers
146 views

Problem with ^^<HEX>

I have small problem with ^^<HEX>. If I have a <HEX> part of the ^^<HEX> in the macro \def\attemp{<HEX>}, I cannot write ^^<HEX> as ^^\attempt or ...
9
votes
2answers
838 views

What is the plain TeX equivalent of \settowidth?

The \settowidth command, which sets a width equal to the width of some text, is described at Get width of a given text as length and How to set the width of the label of a description to the width of ...
9
votes
2answers
917 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 ...
9
votes
2answers
694 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 ...
9
votes
3answers
387 views

Making register declarations local, Undefining a register (count, toks, etc.)

Is it possible to make \newcount, \newtoks, etc. respect grouping, so that, e.g., \newcount\temp\temp=2{\newcount\temp\temp=1}\showthe\temp gives 2 (instead of 0)? Relatedly, is it possible to ...
9
votes
3answers
317 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 ...
9
votes
1answer
150 views

Can TeX detect a newline at the end of the file?

Is TeX able to distinguish beween a file containing, say, the single character a/ byte 97; and a file containing this same character followed by a newline marker (which is system-dependent)? I had a ...
9
votes
2answers
171 views

Local allocation of registers

I saw the following code in an issue of TUGboat (Volume 9, 1988, No. 3). I have modified it slightly. The motive was to avoid allocating registers globally. My questions are (1) How safe is it for ...
9
votes
1answer
305 views

Is there a \show for catcodes?

In the course of attempting to out-pedant another mathematician, I wanted to \show the catcode of $ to convince myself that it was a "special" character in ordinary TeX as well as LaTeX. I was just ...
9
votes
2answers
149 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 ...
9
votes
3answers
372 views

Verbatim text in token registers

How can I add verbatim text in a token register (I want to accumulate pieces of code in a toks register and print them in an appendix). In the MWE below if you substitute verbatim text it fails. ...
9
votes
1answer
109 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 ...
9
votes
2answers
114 views

How can I specify text to be included in the pdflatex output log during compilation.

I would like to be able to have some kind of logging command that is able to log text to the default pdflatex logfile (<input-base-filename>.log). Is this possible, and if so, how? In ...
9
votes
3answers
274 views

Detecting catcode in parameter text

Say someone has defined \documentclass{minimal} \begin{document} \def\fooA#1@{} \makeatletter \def\fooB#1@{} \end{document} It is easy to test and see that the two are different: ...
9
votes
2answers
186 views

Is it possible to use $ as a macro delimiter?

Experimenting with macro definitions that use strange delimiters (see e.g. this or this question), I thought it would be fun to have a macro that takes an argument of the form "a/b" and turns this ...
9
votes
2answers
779 views

Minimum length of last line of a paragraph

There is a more or less equivalent question to this: Ensure minimal length of last line, but I absolutely need a TeX solution. I more or less stumbled upon the problem mentioned in the discussion of ...
9
votes
2answers
265 views

Missing baselineskips?

Here are some cases where when there is stuff inside a vbox, the baselineskips are sometimes there and sometimes not. Or maybe it's something else that is producing the differences? \setbox0\vbox{% ...
9
votes
2answers
668 views

\def taking next word as argument?

This question is a variant of my previous question requesting a macro that takes the rest of the line as argument. I would like to write a macro that would take the next word as argument, where word ...
9
votes
1answer
140 views

What can and can't occur as macro argument?

The documentation of the environ package says The advantage to using environments is that their contents is not treated as a macro argument, so there are less restrictions on what can exist ...
9
votes
1answer
470 views

Computer Modern font with accented characters (in XeTeX)

I'd like to use Knuth's Computer Modern font with XeTeX in a way where I don't have to type accents in a \'-way and without any gimmick such as making accentuated characters active and then say ...
9
votes
1answer
701 views

Why \leaders and \mkern works strangely in different font size?

I can hardly determine a good title for this question, I'm sorry. Minimal test code: \documentclass{minimal} \usepackage{lipsum} \begin{document} foo {\fontsize{18}{18}\leaders\hbox{$\mkern ...
9
votes
2answers
227 views

Which spaces exactly are ignored by \halign?

Some spaces seem ignored by the \halign primitive. For instance, \setbox0=\vbox{\halign{ # \cr \space b \cr}} \showbox0 indicates that there is no glue before b, but that there are two spaces ...
9
votes
4answers
594 views

How do I get the category code of a character that is the value of a control sequence?

How can I get the category code of a character that is the value of a control sequence? If I do this The catcode for A is \the\catcode`A. I get The catcode for A is 11. If I do this \let\abc=A ...
9
votes
1answer
124 views

vbox disappearing inside hbox

I don't understand why a vbox disappears when it's surrounded by two \hss, for instance in: \hbox to 0pt{\hss abc\hss} \hbox to 0pt{\hss\vtop{def}\hss}% doesn't work \hbox to 0pt{\vtop{ghi}\hss}% ...
9
votes
1answer
134 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. ...
9
votes
1answer
83 views

\centering breaks fragile command (is there a fix?)

Many on this site know (and perhaps find slightly annoying) that I will try to solve any LaTeX problem with the use of my stackengine package. My motto is like one of the overnight delivery services: ...
9
votes
1answer
938 views

Handling \ifnum's “! Missing number, treated as zero.”

Let's say I have a variable, which may - or may NOT - be a number; how can I handle the cases when it isn't a number, without crashing with "! Missing number, treated as zero." ? In practical terms, ...
9
votes
1answer
1k views

Expansion in \numexpr…\relax versus \pdfstrcmp

The \numexpr...\relax construction in eTeX allows to evaluate numerical expressions, and it expands tokens fully as it goes. The \pdfstrcmp{...}{...} construction in pdfTeX lets us compare two lists ...
9
votes
1answer
689 views

Trapping LaTeX error/warning

Is there a way to trap an error/warning in LaTeX during compile time? I'm thinking of something similar to the VB script On Error Goto <blah>, but this time for LaTeX in something like ...
9
votes
1answer
317 views

Making a range macro

Having syntactic sugar for ranges can be useful in programming languages. For example in Ruby, one can use a range by (2..10).map {|elem| elem + 1} to get an array consisting of each element in the ...
9
votes
1answer
246 views

How can I make a PDF of the source of pdftex?

I got the files tex.web and pdftex.web from the texlive svn repo. I ran weave tex.web pdftex tex.tex which produced a file tex.pdf with a nicely typeset, cross-referenced listing of the WEB source ...
9
votes
2answers
205 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 ...
9
votes
1answer
124 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} ...
9
votes
1answer
213 views

Parsing a file name

What is the precise syntax for file names in various common distributions? This is relevant for three primitives: \input<filename> (renamed \@@input in LaTeX) \openin<4-bit ...
8
votes
4answers
268 views

Does macros get applied to the source code before compilation?

I wonder if this is true. The latex compiler first run though the document, and search for all the macro declarations. the compiler then go though the document, apply each macro as a string ...
8
votes
5answers
348 views

What sequence of documents should I read to know “all of” TeX and then LaTeX?

I know that there are a already number of questions on this site about good instructional (La)TeX materials for users at different levels. What I am interested in, though, is what set of documents ...
8
votes
6answers
349 views

When might it be helpful to use implicit braces instead of explicit braces?

We've covered the question "When can one use implicit braces instead of explicit braces?"; this leads immediately in my mind to the question "Why would one want to?" (Remember, implicit braces are ...
8
votes
2answers
202 views

What is wrong with this TeX macro

Still soldiering on with trying to learn these macros. Can someone tell me why this isn't working? The macro \mycline{n-n} is supposed to expand to \cmidrule{1-1} ... \cmidrule{n-n}, but in my code ...
8
votes
1answer
285 views

Can I make TeX completely free-form?

I'm bothered about the language format of TeX. I mean I want to know why the CR is converted into a space and % must be at the end of a line to avoid the matter. To make matters worse, a blank line ...
8
votes
3answers
228 views

Detecting which version of the LaTeX format is in use

ltxcmds provides \ltx@ifpackagelater, \ltx@ifclasslater, \ltx@iffilelater and there is \@ifpackagelater - but is there any "if TeX later" or some other way to (automatically) get the used TeX version ...
8
votes
1answer
1k views

Why does \@gobble take one argument

I understand what \@gobble, \@gobbletwo etc. do, but I don't understand why \@gobble allows for an argument. I believe that the definition of the macro is \long\def\@gobble#1{}. Why is this argument ...
8
votes
2answers
749 views

Selecting optical size?

For some time I've seen LaTeX-produced documents that had slight differences in fonts. When you looked at them, they had the same Computer-Modern or Latin-Modern, however, they looked more stylized ...