ltxcmds
Provides essential LaTeX kernel utility commands in a format-independent way, making core functionality accessible across different TeX environments.
Overview
A fundamental utility package that bridges different TeX formats by extracting and standardizing important LaTeX kernel commands. It serves as a compatibility layer that ensures consistent behavior of basic operations across various TeX-based systems.
- Makes core LaTeX functionality available to plain TeX and other formats
- Helps package developers create more portable and maintainable code
- Provides a standardized interface for common operations
- Particularly useful when writing packages that need to work across different TeX formats or when maintaining compatibility between traditional LaTeX and modern implementations
Getting Started
To use ltxcmds
, include it in your document preamble:
\documentclass{article}
\usepackage{ltxcmds}
This package is primarily intended for package authors. The main functionality is to provide LaTeX kernel commands in a separate namespace that can be used in other formats like plain TeX.
Examples
Using ltxcmds to access LaTeX kernel commands in a format-independent way.
% Demonstrate using kernel commands through ltxcmds
\noindent Original LaTeX kernel command: \verb|\@ifnextchar|\\
Accessed via ltxcmds: \verb|\ltx@ifnextchar|
\bigskip
\noindent Testing \verb|\ltx@ifstar| to create a custom starred command:
\makeatletter
\newcommand{\mycommand}{%
\@ifstar{\@mycommandstar}{\@mycommandnostar}%
}
\newcommand{\@mycommandstar}[1]{Starred version with argument: \textbf{#1}}
\newcommand{\@mycommandnostar}[1]{Regular version with argument: \textit{#1}}
\makeatother
\noindent\mycommand{Hello World} % Regular version
\noindent\mycommand*{Hello World} % Starred version