TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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


\myname{Mike Backlund}
\myschool{School 1}
\myschool{School 2}

display would be:

                            Mike Backlund

Hope you could help me

share|improve this question

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.

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


% alternative 1:
\myheader{Mike Backlund}{School 1}{School 2}
\vskip5mm % just to separate them a bit

% alternative 2:


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.

share|improve this answer

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


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

\chead{\myname\\\schooli\\\schoolii}% or in one of the other fancyhdr locations
% \renewcommand{\headrulewidth}{0pt}% uncomment to 'remove' line below header



share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.