TransWikia.com

Convert two-sided document into single-sided with page numbers, header and footer

TeX - LaTeX Asked on February 21, 2021

I want to convert my thesis into a single-sided document with page numbers, header and footer.

documentclass[twosided,12pt]{book}
usepackage{fancyhdr}
usepackage{lipsum}
renewcommand{chaptermark}[1]{markboth{#1}{}}
renewcommand{sectionmark}[1]{markright{#1}}
pagestyle{fancy}
fancyhf{}
fancyhead[LO]{itshapenouppercase{rightmark}}
fancyhead[RE]{itshapenouppercase{leftmark}}
fancyfoot[RO, LE]{thepage}

letheadruleORIGheadrule
renewcommand{headrule}{color{dark-gray}headruleORIG}
renewcommand{headrulewidth}{0.3 pt}
letfootruleORIGfootrule
renewcommand{footrule}{color{dark-gray}footruleORIG}
renewcommand{footrulewidth}{0.3pt}
usepackage{colortbl}
arrayrulecolor{black}
fancypagestyle{plain}{
    fancyhf{}
    fancyhead{}
    fancyfoot[RO, LE]{thepage}
    renewcommand{headrulewidth}{0pt}
    renewcommand{footrulewidth}{0pt}
}
begin{document}
Title page here
Declaration here
Abstract here
TOC
main matter
Bibliography
end{document}

One Answer

I applied the adjustments I suggested in my comments in the below example. Does it look like what you expect? I added some placeholder text to demonstrate the header and footer. Also, I couldn't figure out how to use color{dark-gray}, so I replaced it with color{darkgray} which is defined in the xcolor package.

documentclass[oneside,12pt]{book}
usepackage{fancyhdr}
usepackage{lipsum}
usepackage{xcolor}

renewcommand{chaptermark}[1]{markboth{#1}{}}
renewcommand{sectionmark}[1]{markright{#1}}
pagestyle{fancy}
fancyhf{}
fancyhead[L]{itshapenouppercase{rightmark}}
fancyhead[R]{itshapenouppercase{leftmark}}
fancyfoot[R]{thepage}

letheadruleORIGheadrule
renewcommand{headrule}{color{darkgray}headruleORIG}
renewcommand{headrulewidth}{0.3pt}
letfootruleORIGfootrule
renewcommand{footrule}{color{darkgray}footruleORIG}
renewcommand{footrulewidth}{0.3pt}

usepackage{colortbl}
arrayrulecolor{black}
fancypagestyle{plain}{
    fancyhf{}
    fancyhead{}
    fancyfoot[R]{thepage}
    renewcommand{headrulewidth}{0pt}
    renewcommand{footrulewidth}{0pt}
}

begin{document}

chapter{Testing a}
lipsum[1-6]
section{Testing a1}
lipsum[1-4]

chapter{Testing b}
lipsum[1-6]

end{document}

Screenshot of output of above latex code

Answered by JAK Zero on February 21, 2021

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