我的文档中间有一张空白页,我不确定如何删除它。
开始
\documentclass{article}
\usepackage[a6paper, top=1cm, bottom=1cm, left=1pt, right=1cm]{geometry}
\renewcommand{\familydefault}{\sfdefault}
\usepackage[table]{xcolor}
\usepackage{tabularx}
\usepackage{graphicx}
\DeclareGraphicsExtensions{.pdf,.jpeg,.png}
\newcommand{\tab}[1]{\hspace{.19\textwidth}\rlap{#1}}
\pagenumbering{gobble}
\begin{document}
{\bf \huge Pick List for Test Client}
\\
{\bf Prepared on Wed, 26 Mar 2014 15:13:33 -0400}
\\
\noindent\makebox[\linewidth]{\rule{2\paperwidth}{0.4pt}}
\\
{\large Total Orders: 6}
\\ \\
\def\arraystretch{1.3}%
\begin{tabularx}{\textwidth}{l !{\color{white}\vrule}!{\color{white}\vrule} X}
\rowcolor{black}
{\bf \large} & {\bf \large} \\
\rowcolor{black}
\textcolor{white}{\bf \huge Product} & \textcolor{white}{\bf \huge Quantity} \\
12345 - test SKU do not use & 33\\
SKU4 - test SKU do not use & 12\\
SKU3 - test SKU do not use & 14\\
SKU1 - test SKU do not use & 23\\
SKU5 - test SKU do not use & 6\\
SKU2 - test SKU do not use & 5\\
\end{tabularx}
\\ \\ \\
{\bf \large \hfill Picked By: \makebox[2.0in]{\hrulefill}}
\\ \\
{\bf \large \hfill Checked By: \makebox[2.0in]{\hrulefill}}
\newgeometry{left=0cm,top=0.2cm}
\includegraphics[scale=.225]{fake-label-easypost.png}
\restoregeometry
{\bf \huge PF Test}
\\ \\ \\
{\bf \large Packaging Slip}
\\
{\large Order \#: Test03.25.14-1}
{\large Order \#: Order Date: Mar 26th, 2014}
\\ \\
{\bf \large Ship To: }{\large Recipient Name}
\tab{\large 1234 Random Street}
\tab{\large City, ST, 12345-1234}
\tab{\large US}
\\ \\
\def\arraystretch{1.3}%
\begin{tabularx}{\textwidth}{l !{\color{white}\vrule}!{\color{white}\vrule} X !{\color{white}\vrule}!{\color{white}\vrule} l}
\rowcolor{black}
{\bf \large} & {\bf \large} & {\bf \large} \\
\rowcolor{black}
\textcolor{white}{\bf \large SKU} & \textcolor{white}{\bf \large Description} & \textcolor{white}{\bf \large Quantity} \\
12345 & test SKU do not use & 5\\
\end{tabularx}
\end{document}
问题区域
\newgeometry{left=0cm,top=0.2cm}
\includegraphics[scale=.225]{fake-label-easypost.png}
\restoregeometry
来源:https://gist.github.com/dasickis/aaa8937b38b349689814
编辑:我找到了一个可行的解决方案,所以我添加了代码审查标签。我知道这段代码有点儿黑客化(轻描淡写),我想知道如何改进它。
答案1
谢谢 Werner,以下解决了我的问题:
\newgeometry{margin=0pt,top=0.2cm}
以防被埋没的原始评论:
这很可能是由于您的图像不适合页面。即使您指定 scale=.225 并且您认为这使其能够很好地适合文本块边距,但实际上可能并非如此,即使它适合页面边界。也许可以使用 \newgeometry{margin=0pt,top=0.2cm} 来确保除顶部边距之外的所有边距都不存在。或者,使用 width=\linewidth 之类的命令(并在 \includegraphis 之前添加一个前置 \noindent)来查看是否能解决问题。只是猜测...