Discussion:
page numbbering
Add Reply
k y Fung
2017-06-08 01:59:46 UTC
Reply
Permalink
Raw Message
Anyone knows how to move the page number to the upper right hand corner of the page with a preceding word like "The Article 2", assuming I am using a "article" documentclass. Any input is appreciated. Thanks in advance.
s***@gmail.com
2017-06-08 07:20:10 UTC
Reply
Permalink
Raw Message
Post by k y Fung
Anyone knows how to move the page number to the upper right hand corner of the page with a preceding word like "The Article 2", assuming I am using a "article" documentclass. Any input is appreciated. Thanks in advance.
Which side you want to move? i.e., odd page or even page?
Michael Shell
2017-06-08 08:12:07 UTC
Reply
Permalink
Raw Message
On Wed, 7 Jun 2017 18:59:46 -0700 (PDT)
Post by k y Fung
Anyone knows how to move the page number to the upper right hand corner
of the page with a preceding word like "The Article 2", assuming
I am using a "article" documentclass.
The manual way, which gives you total control, is to define ***@X macros
to set things exactly up as you wish, where X is the page style name
(e.g., headings).

\makeatletter
\def\***@headings{\relax
\def\@evenhead{\scriptsize\thepage\hfil\leftmark}\relax
\def\@oddhead{\scriptsize{\rightmark}\hfil\thepage}\relax
\def\@evenfoot{}\relax
\def\@oddfoot{}}
\makeatother

Adjust \scriptsize to whatever size is desired. The correct
behavior can also depend if the pages are twosided or not.

Then you can use \markboth{}{} to set the \leftmark and
\rightmark strings. You can also directly add "The Article 2" into
the above definitions.

Lastly, invoke the pagestyle via:

\pagestyle{headings}
\thispagestyle{headings}

If you want section titles in the headings, see the sectionmark
code in definition of \***@headings in article.cls.


Cheers,

Mike Shell
Axel Berger
2017-06-08 08:40:20 UTC
Reply
Permalink
Raw Message
Post by Michael Shell
The manual way, which gives you total control,
A simpler and cleaner method is to use the Komascript package scrpage2.
(I believe it too has become deprecated by now and Markus Kohm advocates
successor packages, but I tend to refuse to meddle with things working
perfectly for me.)

Axel
--
/¯\ No | Dipl.-Ing. F. Axel Berger Tel: +49/ 221/ 7771 8067
\ / HTML | Roald-Amundsen-Straße 2a Fax: +49/ 221/ 7771 8069
 X in | D-50829 Köln-Ossendorf http://berger-odenthal.de
/ \ Mail | -- No unannounced, large, binary attachments, please! --
Peter Flynn
2017-06-08 20:18:23 UTC
Reply
Permalink
Raw Message
Post by Axel Berger
Post by Michael Shell
The manual way, which gives you total control,
A simpler and cleaner method is to use the Komascript package scrpage2.
The canonical method is to use the fancyhdr package and write:

================================ 8< ==========================
\documentclass{article}
\usepackage{fancyhdr,textcase}
\pagestyle{fancy}
\makeatletter
\def\@***@ss#1.cls#2\relax{\def\@currentclass{#1}}
\def\@getclass{\expandafter\@***@ss\@filelist\relax}
\@getclass
\fancyhead[R]{\small
The \expandafter\MakeTextUppercase\@currentclass\
\thepage}
\makeatother
\fancyfoot[C]{\relax}
\renewcommand{\headrulewidth}{0pt}
\begin{document}
\title{foo}
\author{bar}
\maketitle

\section{Stuff}
text

\clearpage
\section{More stuff}
text

\end{document}
================================ 8< ==========================

The reason for the \@getclass trickery is that LaTeX does not not store
the name of the current class in an accessible place (thank you David
Carlisle at
https://tex.stackexchange.com/questions/73/which-document-class-is-being-used).


The \MakeTextUppercase macro from the textcase package operates on a
single argument, so to stop it uppercasing the whole of \@currentclass,
you can force \@currentclass to be expanded to separate letters first,
so that \MakeTextUppercase only sees the first letter as its argument.

\fancyhead sets the header for the right-hand corner, and \fancyfoot
blanks out the centered footer position (otherwise you'd still have the
page number there too.

///Peter

Dr Eberhard Lisse
2017-06-08 12:52:22 UTC
Reply
Permalink
Raw Message
RTFM.

el
Post by k y Fung
Anyone knows how to move the page number to the upper right
hand corner of the page with a preceding word like "The Article
2", assuming I am using a "article" documentclass. Any input is
appreciated. Thanks in advance.
Loading...