# Create a command for header titles

how can i be able to create this one by simply making this into command?

ouput:

\begin{center}
\myname{Mike Backlund}
\myschool{School 1}
\myschool{School 2}
\end{center}


display would be:

                            Mike Backlund
School1
School2


Hope you could help me

-

I provide two possible and simple solutions. The first disregards from your three commands \myname and \myschool and makes one new command with three input variables. the second uses three input variables \myname, \myschoolone and \myschooltwo. The MWE will provide two identical layouts using these two approached.

\documentclass{article}
% Single command
\begin{center}
#1\\ #2\\ #3
\end{center}
}
% defining three variables
\newcommand{\myname}{Mike Backlund}
\newcommand{\myschoolone}{School 1}
\newcommand{\myschooltwo}{School 2}

\begin{document}

% alternative 1:
\vskip5mm % just to separate them a bit

% alternative 2:

\end{document}


Since it is possible to feed the header macro with both commands and text, you could mix them as well. I assume that you want the name and school definitions so that you can use them elsewehere in the document which makes the second approach more appropriate.

-

If you mean 'the' header, you could do this with fancyhdr (or perhaps with your documentclass's facilities):

\documentclass{article}

\newcommand{\myname}{Mike Backlund}
\newcommand{\schooli}{School 1}
\newcommand{\schoolii}{School 2}

\usepackage{lipsum,fancyhdr}
\pagestyle{fancy}
\chead{\myname\\\schooli\\\schoolii}% or in one of the other fancyhdr locations