![使用 Titleps 包将标题放在横向页面上](https://linux22.com/image/311540/%E4%BD%BF%E7%94%A8%20Titleps%20%E5%8C%85%E5%B0%86%E6%A0%87%E9%A2%98%E6%94%BE%E5%9C%A8%E6%A8%AA%E5%90%91%E9%A1%B5%E9%9D%A2%E4%B8%8A.png)
我使用了 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}