1

I used fancyhdr and the solution of the how to use fancyhdr package to customize headers in landscape page post to create header on the top of landscape page. but i got familiar with Titleps package and i want to try that but again pdflscape did not work (the attached image)

enter image description here

insted of pdflscape, I used the solution of that post but i got following error:

LaTeX Warning: No \author given.

[1{e:/texlive/2013/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]
(./untitled-2.toc) [1] <pic/male.jpg, id=15, 265.99374pt x 265.99374pt>
<use pic/male.jpg> [1 <./pic/male.jpg>]
! Undefined control sequence.
l.75 \headwidth
           =\textheight

i used the following MWE

\documentclass[12pt]{article}               
\usepackage[left=2cm, right=2cm, bottom=2cm, top=3cm]{geometry}
\geometry{letterpaper} 

\usepackage{amssymb,amsmath}
\usepackage{epstopdf}
\usepackage{setspace}
\usepackage{amsthm}
\usepackage{tikz}
\usepackage{float} %place image here
\usepackage{pdflscape,lipsum} %landscape page
\usepackage[absolute]{textpos}
\usepackage{pdfpages,titleps}
\usepackage[pdfpagelabels,draft,implicit=false]{hyperref}




\newpagestyle{main}{%
  \setheadrule{0.5pt}%
  \sethead{\thesection~\sectiontitle}                      % header left
    {}                                                    % header center
    {\thesubsection~\subsectiontitle\quad$|$\quad\thepage}% header right
}
\pagestyle{main}




\begin{document}


\newpage

\paperwidth=\pdfpageheight
\paperheight=\pdfpagewidth
\pdfpageheight=\paperheight
\pdfpagewidth=\paperwidth
\addtolength{\textheight}{1cm}
\headwidth=\textheight

\begingroup 
\vsize=\textwidth
\hsize=\textheight


\lipsum[1]

\endgroup

\end{document}

I really appreciate any help

  • Headwidth is used by fancyhdr only, if you don't want to use fancyhdr, you can remove that line. There's probably a similar command with the titleps package that you can use to specify the width of the header – Grimler May 17 '15 at 6:48
  • @Grimler thanks i used \widenhead*{0pt}{15pc} and the 15 was experimental :) and after that i used \widenhead*{0pt}{0pc} to reset everything. everything is fine. tnx – alireza May 17 '15 at 7:40
  • Can you extend your MWE with your solution and post it as an answer? It is easier for others to find it and take advantage. – Johannes_B Jun 14 '15 at 11:11
  • Is there any news here? – Johannes_B May 9 '16 at 8:51
1

The OP found that using \widenhead was a work around. To get the correct parameters just use the values of \textheight and \textwidth as follows:

\widenhead*{0pt}{\dimexpr\textheight-\textwidth}

Sample output

\documentclass[12pt]{article}

\usepackage[left=2cm, right=2cm, bottom=2cm, top=3cm]{geometry}
\geometry{letterpaper}

\usepackage{amssymb,amsmath}
\usepackage{epstopdf}
\usepackage{setspace}
\usepackage{amsthm}
\usepackage{tikz}
\usepackage{float} %place image here
\usepackage{pdflscape,lipsum} %landscape page
\usepackage[absolute]{textpos}
\usepackage{pdfpages,titleps}
\usepackage[pdfpagelabels,draft,implicit=false]{hyperref}

\newpagestyle{main}{%
  \setheadrule{0.5pt}%
  \sethead{\thesection~\sectiontitle}                      % header left
    {}                                                    % header center
    {\thesubsection~\subsectiontitle\quad$|$\quad\thepage}% header right
}
\pagestyle{main}




\begin{document}

\lipsum[1]

\clearpage

\paperwidth=\pdfpageheight
\paperheight=\pdfpagewidth
\pdfpageheight=\paperheight
\pdfpagewidth=\paperwidth
\addtolength{\textheight}{1cm}

\widenhead*{0pt}{\dimexpr\textheight-\textwidth}
\begingroup
\vsize=\textwidth
\hsize=\textheight

\lipsum[1]

\endgroup

\clearpage
\paperwidth=\pdfpageheight
\paperheight=\pdfpagewidth
\pdfpageheight=\paperheight
\pdfpagewidth=\paperwidth
\addtolength{\textheight}{-1cm}

\widenhead*{0pc}{0pc}
\lipsum[1]
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.