[Tex/LaTex] Custom Page Numbering in LyX (for thesis requirement)

lyxpage-numbering

I would like to place the page number in the top right corner of my page (inside the margin). My margins are 1 inch from the top and 1 inch from the right. I can put page numbers in the upper right corner by using a horizontal fill, but I would like the page number to be as close to my margin as possible. When I print out the document it is over 1.5 inches from the top of the page. How can I make the number appear higher in the page?

MWE
My source code for the following LyX screen and pdf is

\begin{center}
\newpage{}\hfill{}\hfill{}1\thispagestyle{empty}\vspace{1in}
\par\end{center}
\section{\noindent {\normalsize{INTRODUCTION}}}

My LyX screen is enter image description here

And my PDF is enter image description here

Best Answer

In Page Margins set margins to 1 in. (you may need to adjust to get it exactly right). In Page Layout set headings style to default. In Preamble

\pagestyle{myheadings}
\markboth{}{}

Add a thin space and a vertical space if you want the introduction to be a little down.

Page numbers should appear at right edge, starting at 1 on first page.

After that, I believe you can put a

\pagestyle{empty}

or otherwise, to remove the page numbers...

% Preview source code

%% LyX 2.0.8 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[english]{article}
\usepackage[latin9]{inputenc}
\usepackage{geometry}
\geometry{verbose,tmargin=1in,bmargin=1in,lmargin=1in,rmargin=1in}

\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\pagestyle{myheadings}
\markboth{}{}
\usepackage{lipsum}

\makeatother

\usepackage{babel}
\begin{document}
~ \vspace{3in}



\section{Introduction}

\lipsum

\lipsum
\pagestyle{empty}
\lipsum
\end{document}