TransWikia.com

SOLVED A little problem with fancyhdr `leftmark` in `article` document

TeX - LaTeX Asked by bobicino on February 17, 2021

I am having a problem with the leftmark command of the fancyhdr package. This is a tex sample

documentclass[a4paper,11pt]{article}

usepackage{fancyhdr}
pagestyle{fancy}
lhead{}
rhead{leftmark}

author{Author}
title{Title}

begin{document}
maketitle

tableofcontents
newpage

section{first section}
First paragraph

section{second section}
Second paragraph

end{document}

This is the output

image

As you can see, the problem is that latex (compiling with lualatex) print SECOND CHAPTER instead of FIRST CHAPTER, as the leftmark should give the current section in article mode. If i try to use the builtin pagestyle{headings}, changing the document like so:

...

pagestyle{headings}
%usepackage{fancyhdr}
%pagestyle{fancy}
%lhead{}
%rhead{leftmark}

...

then the output is as expected:

image

What should I try?

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP