\def - Tex Command


Advertisements

NAME

\def - Used for defining your own commands.

SYNOPSIS

{ \def\myCommandName{ <replacement text> } }

DESCRIPTION

\def command is used to define your own commands (control sequences, macros, definitions); must appear (within math delimiters) before it is used;

EXAMPLE

  1. \def\myHearts{\color{purple}{\heartsuit}\kern-2.5pt\color{green}{\heartsuit}}
    \myHearts\myHearts
    
    $ \def\myHearts{\color{purple}{\heartsuit}\kern-2.5pt\color{green}{\heartsuit}} \myHearts\myHearts $
  2. \def\myHearts#1#2{\color{#1}{\heartsuit}\kern-2.5pt\color{#2}{\heartsuit}}
    \myHearts{red}{blue}
    
    $ \def\myHearts#1#2{\color{#1}{\heartsuit}\kern-2.5pt\color{#2}{\heartsuit}} \myHearts{red}{blue} $
Print
Advertisements