TeXipedia

etexcmds

Resolves naming conflicts between e-TeX primitives and existing LaTeX macros by providing prefixed command alternatives.

Overview

Provides a crucial compatibility layer for LaTeX documents by managing potential naming collisions between e-TeX's primitive commands and existing LaTeX macros. The package systematically renames potentially conflicting e-TeX commands with a distinct prefix, ensuring reliable functionality across different TeX engines and implementations.

  • Offers safe, prefixed alternatives to e-TeX primitives (e.g., \etex@unexpanded for \unexpanded)
  • Essential for package developers working with both traditional TeX and e-TeX features
  • Helps maintain backward compatibility while enabling access to enhanced e-TeX functionality
  • Commonly used in modern LaTeX package development and complex document implementations

Getting Started

To use etexcmds, include it in your document preamble:

\documentclass{article}
\usepackage{etexcmds}

This package is primarily intended for package authors. The main functionality is:

% Access e-TeX primitives with prefix to avoid name clashes
\etex@unexpanded{text}

Examples

Using etexcmds to safely access e-TeX primitives in a way that avoids name clashes.

% Demonstrate the use of etexcmds to safely access e-TeX primitives
\makeatletter
% Using the protected version of \unexpanded provided by etexcmds
Original text: \texttt{Hello \$\{World\}}

With etex@unexpanded: \texttt{\etex@unexpanded{Hello \$\{World\}}}

% Using the if-primitive to check if e-TeX is available
\ifetex@unexpanded
  e-TeX's \texttt{\string\unexpanded} primitive is available.
\else
  e-TeX's \texttt{\string\unexpanded} primitive is not available.
\fi
\makeatother