TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

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

I am writing a resume in LyX (compiled using MiKTeX). How can I place my name at the top and centered? Also when I output it in PDF, there is always a huge margin space at the top. How can I set the margins?

share|improve this question
up vote 7 down vote accepted

Use fancyhdr to set the header (and/or footer) the way you want. Add the following to your document preamble (Document -> Settings... -> LaTeX Preamble):

\usepackage{fancyhdr}% http://ctan.org/pkg/fancyhdr
\fancyhead{}% Clear all headers
%\fancyfoot{}% Clear all footers
\fancyhead[C]{My Name}% Place "My Name" in Center of header
\renewcommand{\headrulewidth}{0pt}% Remove header rule
%\renewcommand{\footrulewidth}{0pt}% Remove footer rule
\pagestyle{fancy}% Set page style to "fancy"

enter image description here

My code example only modifies the header, although you can do the same for the footer, if needed. Those commands are commented out.

See Setting document width in LyX in order to find out how to adjust the page margins according to your needs. Follow Document -> Settings... -> Page Margins, deselect Default Margins and enter your desired margins.

enter image description here

share|improve this answer
Thanks. To revert to default do I just clear LaTex Preamble? – GTyler Jan 5 '12 at 0:59
To revert back to the default margin settings, you check the Default Margins box. To revert back to the default headings, you can clear the LaTeX Preamble, yes. If this doesn't work for you, most things can be updated in the preamble to fix it. – Werner Jan 5 '12 at 1:04
Just a question: I'm trying to add an image in the header the same way that Lyx adds images regularly in the document (\begin_inset Graphics) but it's not working out, only plaintext seems to work in the header. What am I doing wrong? I also tried placing the image with \includegraphics but that does not work either. – pzkpfw Mar 25 '13 at 10:20
@bigbadonk420: What "does not work either" about using \includegraphics? Do you have \usepackage{graphicx} in your preamble? Are you inserting the content as an ERT? What compiler are you using and what type of image is it? – Werner Mar 25 '13 at 18:10

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.