\newcommand - Tex Command


Advertisements

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

  1. \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 $
  2. \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} $
Print
Advertisements