- Tex Commands Reference
- Tex - Tutorial Home
\newcommand - Tex Command
newcommand
\newcommand - Used to create your own commands (control sequences, macros, definitions).
SYNOPSIS
{ \newcommand\myCommandName [ <optional # of arguments, from 1 to 9> ] { <replacement text> } }
DESCRIPTION
\newcommand command is used for defining your own commands (control sequences, macros, definitions); \newcommand must appear (within math delimiters) before it is used; if desired, you can use the TeX.Macros property of the configuration to define macros in the head. The bracketed # of arguments is omitted when there are no arguments.
EXAMPLE
\newcommand\myHearts {\color{purple}{\heartsuit}\kern-2.5pt\color{green}{\heartsuit}} \myHearts\myHearts
$ \newcommand\myHearts {\color{purple}{\heartsuit}\kern-2.5pt\color{green}{\heartsuit}} \myHearts\myHearts $\newcommand\myHearts[2] {\color{#1}{\heartsuit}\kern-2.5pt\color{#2}{\heartsuit}} \myHearts{red}{blue}
$ \newcommand\myHearts[2] {\color{#1}{\heartsuit}\kern-2.5pt\color{#2}{\heartsuit}} \myHearts{red}{blue} $
Advertisements