我想在横向页面上绘制此页面(不带点),我发现了如何从页面的极端点绘制,但它不适用于横向页面。
我尝试在顶部画一条水平线:
\usepackage{pdflscape}
\usepackage{tikz}
\pagestyle{empty}
\begin{document}
\begin{landscape}
\begin{tikzpicture}[remember picture, overlay]
\draw [thick, cap=round] ([yshift=-5mm] current page.north west) -- ([yshift=-5mm] current page.north east);
\end{tikzpicture}
\end{landscape}
\end{document}
答案1
此解决方案采用普通的 tikzpicture 并将其置于横向页面的中心。要填充页面,您只需确保其\paperheight
宽度和\paperwidth
高度。
\documentclass{article}
%\pdfpagewidth=\paperwidth
%\pdfpageheight=\paperheight
\usepackage{pdflscape}
\usepackage{tikz}
\newlength{\margin}
\begin{document}
\begin{landscape}
\pagestyle{empty}%
\ifodd\value{page}\relax
\margin=\oddsidemargin
\else
\margin=\evensidemargin
\fi
\noindent\hspace{\dimexpr 1in+\topmargin+\headheight+\headsep+\linewidth-\paperheight}% left side of page
\rlap{\raisebox{\dimexpr 1in+\margin+\topskip-\height}[0pt][0pt]{%
\parbox[c][\paperwidth][c]{\paperheight}{\centering% center contents
\begin{tikzpicture}
\draw[red] (0,0) -- (\paperheight,\paperwidth);
\draw[blue] (\paperheight,0) -- (0,\paperwidth);
\end{tikzpicture}%
}}}
\end{landscape}
\end{document}
为了方便使用,我创建了环境 LSpage。lrbox 仅用于放置其中的内容\raisebox
等。
\documentclass{article}
\usepackage{pdflscape}
\usepackage{tikz}
\newsavebox{\LSbox}
\newenvironment{LSpage}{\begin{lrbox}{\LSbox}\ignorespaces}% BODY goes here
{\end{lrbox}%
\begin{landscape}%
\thispagestyle{empty}%
\ifodd\value{page}\relax
\dimen0=\oddsidemargin
\else
\dimen0=\evensidemargin
\fi
\noindent\hspace{\dimexpr 1in+\topmargin+\headheight+\headsep+\linewidth-\paperheight}% left side of page
\rlap{\raisebox{\dimexpr 1in+\dimen0+\topskip-\height}[0pt][0pt]{%
\parbox[c][\paperwidth][c]{\paperheight}{\centering\usebox\LSbox}}}
\end{landscape}}
\begin{document}
\begin{LSpage}
\begin{tikzpicture}
\draw[red] (0,0) -- (\paperheight,\paperwidth);
\draw[blue] (\paperheight,0) -- (0,\paperwidth);
\end{tikzpicture}
\end{LSpage}
\end{document}