我使用了 fancyhdr 和解决方案如何使用 fancyhdr 包自定义横向页面的标题发布在横向页面顶部创建页眉。但我熟悉 Titleps 包,我想尝试一下,但 pdflscape 再次不起作用(附图)
我使用了该帖子的解决方案而不是 pdflscape,但出现以下错误:
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
我使用了以下 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}
我非常感谢你的帮助
答案1
OP 发现使用是一种解决方法。要获取正确的参数,只需使用和\widenhead
的值,如下所示:\textheight
\textwidth
\widenhead*{0pt}{\dimexpr\textheight-\textwidth}
\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}