Questions tagged [latex-base]
{latex-base} is about the inner workings of the LaTeX kernel. Do not use this tag for general questions about LaTeX or {macros}.
210
questions
0
votes
1
answer
77
views
How to make a specific environment disappear? [duplicate]
I have got several Tikz pictures whose compilation takes up much time. More generally, I am wondering whether there is a switch that can make a specific environment foo disappear as if the code would ...
0
votes
1
answer
74
views
Page breaks still occur in samepage
I cannot find any documentation at all on the samepage environment (aside from a cryptic comment on p229 of the LaTeX book that "The \samepage command still works, but is now of little use", ...
0
votes
1
answer
56
views
Get current style (rm, sf, tt)
How to print the current style (rm, sf, tt) in a give position of a document?
\begin{document}
\sffamily
% print current style -> sf
\rmfamily
% print current style -> rm
\ttfamily
% print ...
7
votes
1
answer
271
views
Why is grouping used in the numerator of the definition of \frac but not the denominator?
In the answers to this question: What is the difference between \over and \frac?, one finds the ams and plain latex definitions of \frac, respectively:
\DeclareRobustCommand{\frac}[2]{{\begingroup#1\...
5
votes
1
answer
90
views
Different meanings of "footnotesep"?
What is the difference between footnotesep as option of the geometry package and as native dimension \footnotesep?
It seems that
\usepackage[footnotesep=1em]{geometry} sets the separation between the ...
0
votes
1
answer
59
views
Difference between `\newcommand{..}[1]` and `\NewDocumentCommand{..}{m}` [duplicate]
In this answer, egreg uses
\NewDocumentCommand{\refprefix}{m}{%
\ifinproofref\else #1\fi
}
The command \refprefix is part of code that's written to the aux file. Defining the command with
\...
3
votes
2
answers
406
views
why You can't use `blank space ' after \the
If I define
\newcount\punkt
\def\newpt{\the\punkt\space\advance\punkt by 1}
everything runs fine; but if I do
\newcounter{punkt}
\newcommand\newpt{\the\punkt\space\stepcounter{\punkt}}
I get
You can'...
2
votes
1
answer
41
views
use \def\@plus{plus} etc to save token space
In the LaTeX kernel, we can see these definitions:
\def\@plus{plus}
\def\@minus{minus}
\def\@height{height}
\def\@depth{depth}
\def\@width{width}
It is said that these definitions can be used to save ...
0
votes
1
answer
56
views
How to store Boolean values for later use
I want to define a new command for a package using xparse. My command looks like this:
\NewDocumentCommand{\fancyCommand}{s o m}{
\def\@optional{#2}
\def\@mandatory{#3}
}
This is, because I ...
3
votes
1
answer
88
views
`\global\NewCommandCopy` instead of `\GlobalLetLtxMacro`?
The new LATEX2ε kernel provides \NewCommandCopy (and \Renew... and \Declare... variants) which functions almost like \LetLtxMacro from the letltxmacro package.
Instead of \GlobalLetLtxMacro from ...
8
votes
1
answer
259
views
latex/pdflatex, NewTX, and hyperref: in ⓪ and ①, the circle touches the digit
Feeding
\documentclass{article}
\pagestyle{empty}
\usepackage{newtxtext}
\usepackage{hyperref}%%% it's bizarre that adding a package for referencing (and not using this package) changes the shapes of ...
5
votes
2
answers
116
views
Why does \newcommand on an already defined active character not yield an error?
We (or at least I) usually think of an active character as just another command whose name just happens to a character rather than a control sequence. So why does \newcommand<active character> ...
2
votes
1
answer
63
views
Why does \tensor produce errors when LaTeX Info warns about number of math fonts?
In actuarial documents we use much mathematically oriented notation, for which we need many math fonts. In
What is the meaning of "No math alphabet change to frozen version normal on input line ...
0
votes
1
answer
56
views
Iterate through the tokens of a list not known in advance (\@for + \csname)
If I want to iterate through the tokens of \myList I can simply do
\def\myList{one,two,three}
\makeatletter
\newcommand{\iterateThroughMyList}{%
\@tempswafalse
\@for\next:=\myList\do{%
...
11
votes
1
answer
296
views
What's the difference between \AtBeginDocument and \AddToHook{env/document/begin}?
Here is an MWE:
\documentclass{article}
\usepackage{lipsum}
\AtBeginDocument{\linespread{1}\fontsize{12bp}{23bp}\selectfont}
% \AddToHook{env/document/begin}{\linespread{1}\fontsize{12bp}{23bp}\...
4
votes
2
answers
325
views
Command \MakeUppercase does not work as expected in pdfLatex, but works fine in LuaLaTeX and XeLaTeX
As you can see from the minimal working examples below \MakeUppercase command when compiled with pdfLatex keeps accents for converted Uppercase words, although it shouldn't. When compiled with ...
4
votes
2
answers
118
views
What's the best way to avoid ignoring leading space tokens with arguments of LaTeX commands where command before argument does space-hacking?
In LaTeX there are commands that process arguments but do not produce visible output.
For example, the command \label, or, if you use the package color or xcolor, the command \color.
When the closing ...
3
votes
1
answer
213
views
How 'experimental' is \TrimSpaces today?
The documentation of xparse dated 2022-06-22 describes the argument processor TrimSpaces which can be used to remove leading and trailing spaces with example
\NewDocumentCommand \foo
{ > { \...
5
votes
1
answer
131
views
Unused global option(s) warning with latex 2022-06-01-PL2
I was about to ask this question a few days ago, but at the time the site suggested this question to me and I thought that it is the same problem with mine. But now as PL2 releases, the problem in the ...
4
votes
1
answer
148
views
What causes Unused global option(s) error after updating to latex-base 2022-06-01-PL1?
After applying today's kernel updates (2022-06-01-PL1) it seems loading the doc package now causes an Unused global option(s) warning over options passed to the article document class that was not ...
8
votes
3
answers
495
views
How to use equals sign in custom class options?
I have seen package options such as in geometry that allow the user to specify an option with a certain value. For example, \usepackage[margin=1in]{geometry} will use 1in for the left and right ...
4
votes
1
answer
143
views
\IfTargetDateBefore doesn't use dates from \DeclareRelease and \DeclareCurrentRelease
I am a little confused with the rollback mechanism in LaTeX. I want to let users test the future breaking changes of my package and also I want to keep the future changes in the same package file. So ...
3
votes
1
answer
174
views
Why are \showboxbreadth and \showboxdepth set to 2^{30}-1 in \loggingall?
The plain TeX format defines
\def\loggingall{\tracingcommands\tw@\tracingstats\tw@
\tracingpages\@ne\tracingoutput\@ne\tracinglostchars\@ne
\tracingmacros\tw@\tracingparagraphs\@ne\tracingrestores\...
0
votes
0
answers
132
views
The function and meaning of variable \@afterindenttrue
I do not know the function and meaning of variable \@afterindenttrue (see figure below). What will change if I change it to \@afterindentfalse, how can I see its changes? Thank you very much.
\def\@...
0
votes
0
answers
254
views
LaTeX naming conventions
I have been reading a lot of LaTeX source files recently and I noticed certain naming conventions like \label{fig:...} and \label{tab:...}.
It this used as some kind of scoping to avoid namespace ...
5
votes
2
answers
255
views
Didn't get warning for empty citation
My document has an empty citation \cite{}. I'd expected to get some warning about it.
Is it a bug? (if not - why?)
Is it possible to enable checking for such cases?
MWE:
\documentclass{article}
\...
4
votes
1
answer
202
views
When is textwidth 4.5in in latex?
In latex documentation, I found this:
Then I searched that what does bk mean, and I found this:
After seeing this I thought that bk means book. And textwidth equals to 4.5in in book class (font size ...
0
votes
0
answers
83
views
\include tex file does not allow me to add anything else afterwards [duplicate]
I am trying to include two tex files at the end of my report. The first file is included as usual but anything I write after that does not appear.
This is my code:
\section{Code for Question 1}
\...
1
vote
0
answers
42
views
How to make code conditional on LaTeX kernel version [duplicate]
I want to make use of some kernel features introduced in the latest release (2021-11-15) in a package. In order to maintain some backwards compatibility, I want to issue a warning and use a workaround ...
7
votes
1
answer
815
views
Differences between \newcommand, \NewDocumentCommand and \DeclareRobustCommand
What are the main differences between \newcommand, \NewDocumentCommand and \DeclareRobustCommand?
Could you answer me giving exhaustive examples, please?
I already read this, this and this, but I'd ...
2
votes
0
answers
73
views
History - LaTeX2e - \newcommand - Why does the mechanism for detecting an optional argument not crank out the case of an implicit [?
[Please take this question for a moot point/an "academical" issue.]
The LaTeX-kernel-command \newcommand was invented decades before expl3, xparse and \NewDocumentCommand were available.
\...
1
vote
1
answer
102
views
History - LaTeX2e - \newcommand - Why optional arguments as (]-)delimited arguments?
[Please take this question for a moot point/an "academical" issue.]
The LaTeX-kernel-command \newcommand was invented decades before expl3, xparse and \NewDocumentCommand were available.
\...
3
votes
1
answer
377
views
Defining environments calling other environments (bug in 3.14159265-2.6-1.40.21)
A strange error has suddenly appeared after I upgraded Debian, resulting in an update of texlive. Does anyone know the source of this error? How to fix it? I have used similar constructs for more ...
3
votes
1
answer
296
views
What is so special about "\@tempboxa"?
When storing a box, why do so many folks use \@tempboxa? Why not \@foobar or \@MyGreatTemporaryBox or simply \@temporaryBox0? Is there anything special about this \@tempboxa? Knuth says simply \...
2
votes
2
answers
694
views
Avoid line stretching automatically
I would like to avoid at all cost line stretching, without forcing it manually. I will provide you with an example to clarify what I mean.
Here it is the code:
\documentclass{article}
\begin{...
5
votes
2
answers
835
views
Major changes in LaTeX2e/LaTeX3 kernel
Just out of curiosity.
If it would be possible to summarize the major changes/improvements in LaTeX2e/LaTeX3 kernel during the last decade, which they would be?
4
votes
2
answers
123
views
\NewDocumentCommand without xparse
I noticed that I can use \NewDocumentCommand without loading xparse.
Why is that?
How universal is that?
And where can I read more about this? (My search terms always pointed to xparse.)
\...
2
votes
0
answers
1k
views
How do I solve the Output routine didn't use all of \box255. \newpage ...prevdepth \fi \fi \vfil \penalty -\@M error?
I am currently writing my thesis and am using MikTex to do so. I have not updated MikTex in a whole year of time and it was running fine till I did today. Today I updated the MikTex to the latest ...
1
vote
1
answer
112
views
How to build the binaries pdflatex-dev and friends
pdflatex-dev and variants are helpful for catching issues before new releases, as detailed at What is "latex-dev"?. There appear to be several bugs reported and fixed since the latest pre-...
3
votes
1
answer
131
views
Missing (?) \begingroup in the definition of \enddocument
Disclaimer While re-reading the question before posting it, it occurred to me that I'm referring to the LaTeX kernel of my computer (TeXLive 2017, \fmtversion=2017-04-15). The question is in some ...
4
votes
2
answers
258
views
MacTeX 2020: error with report + hyperref + mathbf in chapter
I am getting an error with the following:
\documentclass{report}
\usepackage{hyperref}
\begin{document}
\chapter{This raises an error: \(\mathbf{x}=y\)}
test
\chapter{Using this instead works: \({\...
1
vote
0
answers
182
views
How to require a LaTeX version that provides the new hooks management system?
A class of mine is loading the biblatex package if the user uses a given option. For this, the class used to rely on \AtEndPreamble{\RequirePackage{biblatex}} and I guess it used to work nicely. It ...
1
vote
2
answers
214
views
Custom class (*.sty) with different document class (e.g. beamer)
I am writing my own class/preamble for LaTeX and need to differ inside if a package is required and therefore loaded based on the document class.
Example:
I want to load \RequirePackage{hyperref} for ...
19
votes
3
answers
13k
views
Mismatched LaTeX support files detected
I just updated my TeXLive installation on my iMac and got the following error message:
/usr/local/texlive/2020/texmf-dist/tex/latex/l3kernel/expl3.sty:77: LaTeX3 Error:
Mismatched LaTeX ...
6
votes
3
answers
265
views
Why is \@secondoftwo used in this example?
I have been studying the code from this TUGboat article by Joseph Wright and Christian Feurersänger (Volume 30, 2009, No. 1) explaining key-value techniques. I understand the use of \expandafter\@...
1
vote
1
answer
166
views
Conditional naming of the output PDF file
My target is to have an output Solved Exam.pdf when \ifSolution is true, and The Exam.pdf when \ifSolution is false.
However, I don't know if this answer is relevant here to change the \jobname and ...
0
votes
1
answer
161
views
Is there a way to get \filedate and \fileversion from \ProvidesPackage{} inside the package source file?
I like to \typeout a message showing my package's version and date. I know about \GetFileInfo but that apparently only works within a .dtx file. Is there a way to automatically extract \filedate and \...
4
votes
1
answer
459
views
latexrelease: Cannot emulate newer kernel
I am trying to emulate LaTeX 2020-10-01 on a system still using LaTeX 2020-02-02 PL 5. I have downloaded the latest version of latexrelease.sty from GitHub. However, the following MWE fails:
\...
2
votes
1
answer
181
views
List of all characters belonging to each TeX category code?
Where can one find a listing of all characters per TeX category code? I need to construct a symbol table for parsing purposes and I have been unable to locate a complete listing. I don't mind if I ...
2
votes
0
answers
129
views
Why does \frac not produce \mathinner atoms?
LaTeX defines \frac as
\DeclareRobustCommand\frac[2]{{\begingroup#1\endgroup\over#2}}
i.e. the fraction is created using \over surrounded by a brace group to contain its effect.
The TeXbook states on ...