How to create your own command in latex class file

Today I have learn how to create new command in latex using Latex class file.

There is simple code.

  • First create your class file like:- example.cls
  • Add this code for new command in class file
\newcommand{\name}[1]{
\centerline{\Huge{#1}}
}
  • Now there {name } is your new command and [1] is parameter. With help of parameter you call this command. like this \name{hello}
  •  Now create your Latex document like:  example.tex
\documentclass{example.cls}
\begin{document}
\section{Education}
\subsection{University Of India}
\section{Work}
\datedsection{hello}{hitesh}
\datedsectio{hello}{hitesh}
\name{Guru Nanak Dev Engineering}
\workitems{hitesh}{kumar}{sofat}
\subsection{ABC Limited}
\end{document}

So now you learn how to create the new command in latex.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s