Page Layout\partmark in class article?

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
mikz54
Posts: 2
Joined: Wed Mar 09, 2011 6:02 pm

\partmark in class article?

Post by mikz54 »

Hi everybody,

I was trying to layout something quite difficult (it seems!) in my headline... I can't find any solution...

Actually, I'm working in the class "article" and I want to have the name of the current part in my headlines like this :

Part 1 : Présentation of the software
----------------------------------------------------------------- (\hline)

PART 1 Presentation of the software
Text ...

How can I do that?
(it seems the LaTeX doesn't know the command \partmark in the documentclass "article", I read it was possible in the documentclass "book" for instance, I tried to do \newcommand, but it didn't work out, so... Last thing : LaTeX can put the number of the current part with the command \thepart, so that I think it should be possible to print the name of the part too...)

Thank you for your help and sorry for my possible language mistakes.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Re: \partmark in class article?

Post by gmedina »

Hi,

how are you currently setting the headers for your document? Which package(s) do you use? A simple minimal and compilable document showing all the settings related to this problem could save valuable time.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
mikz54
Posts: 2
Joined: Wed Mar 09, 2011 6:02 pm

\partmark in class article?

Post by mikz54 »

I found something today which seems to be part of the solution...

I put that command :

Code: Select all

\newcommand\partmark[1]{\markboth{\MakeUppercase{#1}}{}}
Then, using the default package to do headlines and footlines, it worked using :

Code: Select all

\makeatletter
\newcommand{\ps@rapport}{
\renewcommand{\@evenhead}{}
\renewcommand{\@oddhead}{\itshape \leftmark \hfil}
\renewcommand{\@evenfoot}{\@oddfoot}
\renewcommand{\@oddfoot}{\hfil - \thepage\ - \hfil}
}
\makeatother
\pagestyle{rapport}
The only thing I want to do now is to draw a line under
\renewcommand{\@oddhead}{\itshape \leftmark \hfil}
like the lines you can draw using the package fancyhdr with the command \renewcommand{\headrulewidth}{0.2pt}.

I could try to use fancyhdr instead of the default package, but it doesn't work... I wrote :

Code: Select all

\usepackage{fancyhdr}
\fancypagestyle{rapport}{
\renewcommand{\headrulewidth}{0.2pt}
\fancyhead[L]{\itshape \leftmark \hfil}
\fancyhead[R]{}
\fancyfoot[C]{- \thepage\ -}
}
\pagestyle{rapport}
but when there are some sections (if no, it works), it prints the name of the section instead of the part. I don't really understand why.

Actually I don't really understand what leftmark and rightmark do... In the first case, leftmark gives me the right thing I want, in the second one, it gives me something else. That's a little bit strange ^^'

Thank you for you help!
Post Reply