{latex-kernel} is about the inner workings of the LaTeX kernel. Do not use this tag for general questions about LaTeX or {macros}.

learn more… | top users | synonyms

24
votes
3answers
519 views

Do fontsize environments exist?

Without any doubt there are fontsize switches in the form of control sequences (described here for instance.) But, from time to time I ran into code examples where environment versions of those were ...
4
votes
0answers
46 views

What does `\escapechar` do? [duplicate]

In latex.ltx you can find several situations where \escapechar is set to -1 -- from what it's clear that it has to be a count register. But, what does it actually "count" or control? A small ...
5
votes
2answers
64 views

Where is \@makefntext defined?

I was studying how footnotes come about in LaTeX and what processes exactly run behind the curtain, and noticed \@makefntext. But in fact, in latex.ltx there are only two occurences of this macro ...
11
votes
1answer
229 views

Why the new changes to LaTeX kernel breaks zref-perpage package?

Consider the following minimal example: \documentclass{book} \usepackage{zref-perpage} \zmakeperpage{footnote} \begin{document} \chapter{Test} \footnote{A footnote} \footnote{A footnote} \newpage ...
11
votes
1answer
117 views

Can one safely redefine \jobname?

I want to access labels from an external document -- in general this is not a problem with the xr package. But in this case both documents are compiled on sharelatex, and there \jobname is always set ...
17
votes
1answer
169 views

! Corrupted NFSS tables

Update The LaTeX-bug described in this question has been resolved. With the new LaTeX in TeXlive 2015 (tested on 2015-05-14) there is no longer an error. Original Question The following code gives ...
1
vote
1answer
76 views

How to write totally expanded macro to file (with LaTeX kernel)

I want to write value of the macro \@authortofile to a file. Inside the macro it is another macro which is defined as separator between some words: \def\@separator{\def\@separator{, }} When I try ...
3
votes
0answers
63 views

Undefine a command in LaTeX [duplicate]

LaTeX, of course, has a protective mechanism that prevents you from doing some stupid things: \newcommand\a{a} \newcommand\a{b} %% LaTeX Error: Command \a already defined. Of course, if you know ...
5
votes
1answer
373 views

What do \@mkboth and \markboth do?

What do the toc related commands \@mkboth and \markboth do?
1
vote
1answer
135 views

What is LaTeX's \if@nobreak mechanism for and how does it work?

many LaTeX sectioning-related commands have a block in manipulating the \@nobreak flag. Taking the following example for the sake of example: \begingroup \parindent \z@ \rightskip \@pnumwidth ...
24
votes
1answer
276 views

Why is the .toc file created at end document?

To create a Table of Contents (for example), LaTeX2e follows the process: Run 1 .aux file is created from scratch after \begin{document}. When processing section headers, write \addtocontents to ...
9
votes
1answer
204 views

Is there a generic dummy command?

I would like to add in the title field of some bib entries a dummy command which I can redefine to force e.g. a linebreak in certain cases. I need a command which normally doesn't do anything, doesn't ...
16
votes
1answer
257 views

Why is there a \null in \verb?

In source2e.pdf, the definition of \verb is \def\verb{\relax\ifmmode\hbox\else\leavevmode\null\fi \bgroup \verb@eol@error \let\do\@makeother \dospecials \verbatim@font\@noligs ...
16
votes
2answers
621 views

What's the meaning of the macro `\m@th`?

I found this macro from Voss' Math mode v2.47, page 21: \makeatletter \newif\if@borderstar \def\bordermatrix{\@ifnextchar*{% \@borderstartrue\@bordermatrix@i}{\@borderstarfalse\@bordermatrix@i*}% ...
17
votes
2answers
248 views

\@ifnextchar's twin in the kernel

In latex.ltx you can find \let\kernel@ifnextchar\@ifnextchar What was this needed for?
0
votes
1answer
62 views

Vertically centering page with @texttop and @textbottom

I am trying to use \@texttop and \@textbottom to vertically center a page in a manner similar to Use of \@texttop and \@textbottom for vertical positioning. Everything works fine if I do ...
4
votes
1answer
261 views

Documentation of LaTeX2e source

Where are the best places to look if one would like to understand the LaTeX2e source code? Related: Comprehensive online manual for LaTeX2e user macros and environments Are there guidelines on how ...
3
votes
1answer
119 views

Setting initial value of a storage macro

When I create a "storage macro" I often initialize it to be empty with \newcommand{\@mymacro}{} \newcommand{\mymacro}[1]{\renewcommand{\@mymacro}{#1}} Instead of initializing it to empty I could do ...
2
votes
0answers
103 views

Value from LaTeX package to plain TeX [closed]

If I say \usepackage{lastpage} I got \xdef\lastpage@lastpage{53} at the end of .aux-file. I tested and \xdef\sometest@sometest{53} \newcount\tmp \advance\tmp \sometest@sometest \relax \advance\tmp ...
9
votes
2answers
786 views

What the first argument for `\l@subsection` actually is?

Consider for example the code \makeatletter \renewcommand{\l@subsection}[2]{\@dottedtocline{2}{1.6em}{1.6em}{\S#1}{#2}} \makeatother It allows me to obtain in my table of contents records ...
8
votes
1answer
130 views

What's the differences between the kernel commands \trivlist and \list?

LaTeX defines the two environments \trivlist and \list. Both can be used creating own environments. What exactly is the differences between \trivlist and \list?
23
votes
2answers
525 views

Redefining \include

A puzzling choice made by Leslie Lamport was to define \include in such a way as to issue a \clearpage before reading the file. This has been puzzling me for sometime as it is not a very good choice ...
9
votes
1answer
163 views

LaTeX2e \makebox !=\hbox?

The source2e documentation (pg. 233) when describing \makebox states: ... If wid  is missing, then pos is also missing and obj  is put in an \hbox of its natural width... This, ...
9
votes
1answer
429 views

Strange behaviour with \AtEndDocument

I'm creating a document class that has draft and final versions. The final version has a front page generated by \maketitle, but in draft mode \maketitle is \let to \relax. I decided to insert a test ...
13
votes
2answers
322 views

Why is \thepage set to \relax in a \protected@write?

In the kernel the definition of protected@write includes the setting of the \thepage to \relax. Why is this and are there other means to ensure that thepage is not expanded? \long\def ...
8
votes
1answer
804 views

Why does LaTeX make \DeclareMathSymbol and \DeclareSymbolFont preamble-only?

Is there any good and convincing reason to explain why LaTeX restricts usage of \DeclareSymbolFont and \DeclareMathSymbol to the preamble? and I could also ask the question for many other macros. ...
26
votes
3answers
1k views

@tempdima, reserved@a, @tempcnta, what else?

I'm aware that some "temporary" LaTeX dimensions etc. exist. I would, however, like to know all of them. I know \reserved@a (macro), \@tempdima (dimension) and \@tempcnta (counter).
9
votes
1answer
99 views

\@ifnextchar inside pmatrix?

I created a function which handles a superscript followed after the function. I do that by using \@ifnextchar^. Everything works well, except in any pmatrix environment. Why? As a quick-and-dirty ...
12
votes
1answer
281 views

Counters and their “partners”

A counter created via \newcounter{<counter>} is stored internally as \c@<counter>, just like a reference made using \label{<label>} is stored internally using \r@<label>. ...
6
votes
1answer
240 views

Some assignments in the definition of \parbox

Why are these assignments necessary in the LaTeX's definition of \parbox? \let\hss\vss\let\unhbox\unvbox EDIT I should have added that I wondered if the assignments will affect any in-parbox calls ...
9
votes
4answers
159 views

Restore the original array code

The arraypackage redefines array in various ways. I was woundering if anyone had made a package containing a localized (prefixed) version of the kernel array? I have a document were we have a simple ...
10
votes
3answers
1k views

Are commands defined by \newcommand[.][.]{.} robust?

This question is from the comments at the foot of Abbreviations for AM, PM (small caps) for use within \textbf. Readers will get the remaining gist from there. With ...
22
votes
6answers
1k views

\@ifnextchar and friends documentation

While reading this question and its answers I tried to find where, for instance, \@ifnextchar is documented. I'm afraid I couldn't... I looked in TeX: The Program and TeX for the Impatient which can ...
38
votes
2answers
3k views

Understanding \@ifnextchar

I understand the definitions of the \makeatletter and \makeatother commands and also \def and \newcommand somewhat. But, explained in a simple way, what is happening in the following line? ...
8
votes
2answers
492 views

What exactly does \DeclareOldFontCommand and \DeclareRobustCommand do?

In the article class appears the following code related with the font selection: \DeclareOldFontCommand{\rm}{\normalfont\rmfamily}{\mathrm} \DeclareOldFontCommand{\sf}{\normalfont\sffamily}{\mathsf} ...
26
votes
1answer
232 views

Why is there no \provideenvironment?

LaTeX2e provides a \providecommand but there is no \provideenvironment which defines an environment only if it (or a macro with the same name) was not defined before. Is there a specific reason why it ...
16
votes
2answers
573 views

What does the command \@dblarg in a class?

In the definition of a command appears the declaration of \@dblarg, as follows: \def\title{\@dblarg\CJ@title}. What exactly does \@dblarg do?
26
votes
4answers
1k views

Why does the LaTeX kernel define \usepackage *and* \RequirePackage?

The ubiquitous \usepackage command is used to load packages in the preamble of a document; the command syntax is \usepackage[<package-option-list>]{<package-list>}[<version>] ...
42
votes
2answers
4k views

What does \z@ do?

in parcolumns it has \z@ all over the space. I don't see it define it anywhere so I assume it is some internal command or something? I can't really make heads or tails of it though and I can't really ...
12
votes
2answers
214 views

\if@minipage purpose in floats

In floating environments such as the captions of figures, LaTeX has a \global\@minipagefalse, why is this necessary and what does this switch do? \long\def\@makecaption#1#2{% ...
89
votes
2answers
7k views

What are penalties and which ones are defined?

Very often you can find solutions by changing the penalty. One is widowpenalty. However what are penalties and is there a small list of every defined penalty. There is a German site which does ...
5
votes
3answers
697 views

How to extract parts of (La)TeX document?

I want to run queries against LaTeX documents like these: get list of all equations, even if one declares \def\be{\begin{equation}} and uses it; get list of all arguments of some command (e. g. ...
9
votes
1answer
262 views

How to illustrate and execute a MWE within another document

In Show output of a full LaTeX document I provided a partial solution to a similar question. The following code is an attempt to simulate the running of a full MWE within another document as for ...
12
votes
1answer
800 views

Use of \trivlist and \list in defining environments

I did ask a similar question a bit back here but never really had a satisfactory technical answer. Reading through the documentation of xdoc Lars Hellstrom pretty much asked the same question and ...
14
votes
1answer
631 views

Why is \input not expandable?

In latex.ltx I found \def\input{\@ifnextchar\bgroup\@iinput\@@input} where \@@inputis expandable. I would like to know if there is an expandable version of \input. The problem comes from an example ...
12
votes
1answer
429 views

Use of \@texttop and \@textbottom for vertical positioning

There are two macros defined in the LaTeX kernel named \@texttop and its opposite \@textbottom. The first is a bit of a mystery command in that in the source it is let to \relax. There is a note that ...
7
votes
2answers
1k views

What do \m@ne‎ and \@M do in the definition of \@makechapterhead?

What do \m@ne‎ and \@M do in the definition of \@makechapterhead in book class? I took a quick look at latex.ltx and couldn't find any explanation.
18
votes
1answer
739 views

What does \p@ mean in some code?

I have found the source code within octavo.dtx (from the octavo package) and it has some parts called \p@. I have searched throughout the document, but cannot understand what this is defined as or ...
10
votes
2answers
167 views

What is autoload?

In the LaTeX kernel you see this often: %<*2ekernel|autoload> What does it do? There are other similar marks. Is there any documentation for these?
1
vote
1answer
65 views

Finding Information about Class Level Commands [duplicate]

Possible Duplicate: Documentation reference for LaTeX internal commands? I'm working on writing a company-specific class file for reports in LaTeX and I thought I would start by reading ...