如何强制将图片放置在页面上,而不考虑边距?

如何强制将图片放置在页面上,而不考虑边距?

我有一张想要放在我正在写的学生论文首页上的图片,它正在被 LaTeX 推送到下一页。我想把它放在一个特定的位置,这样它就会穿过文本的左、下和右边距。有没有办法将图像独立于边距放置?

这是一个类似于我正在做的事情的例子

\documentclass[10pt,a5paper]{article}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}[remember picture,overlay]
\draw (0pt,0.3\textheight) -- (0pt,-\textheight) -- (\textwidth,-\textheight) -- (\textwidth,0.3\textheight) -- cycle;
\end{tikzpicture}
{
\hspace{110pt}
\fontsize{120}{120}\selectfont Title
    }

\begin{figure}[h!]
\vspace*{-50pt}
\hspace*{-15pt}
\includegraphics[width=387pt]{imagename}
\end{figure}

\end{document}

编辑:我不知道这里的图像宽度是否适用于这个更简单的例子,但这是我在原始文档中想要的。

答案1

我猜你的 TikZ“图片”是为了在文本块的下部 70% 周围绘制一个矩形。如果是这样,请确保\noindent在绘制矩形之前添加。

由于我无法访问该文件imagename.pdf,因此我修改了下面的代码来绘制一个宽度为的通用黑色矩形\textwidth

在此处输入图片描述

\documentclass[10pt,a5paper]{article}
\usepackage[demo]{graphics} % just for this example
\usepackage{tikz}
\begin{document}
\noindent % need to add this instruction
\begin{tikzpicture}[remember picture,overlay]
\draw (0pt,0.3\textheight) -- (0pt,-\textheight) -- (\textwidth,-\textheight) -- (\textwidth,0.3\textheight) -- cycle;
\end{tikzpicture}
{
\hspace{110pt}
\fontsize{120}{120}\selectfont Title
}


\begin{figure}[h!]
%\vspace*{-50pt}
%\hspace*{-15pt}
\includegraphics[width=\textwidth]{imagename}
\end{figure}
\end{document}

答案2

我找到了一个可行的解决方案。由于 tikz 已经可以为我绘制边距外的图片,所以我也用它来绘制我想要的图片。我将代码中的行改为:

\begin{tikzpicture}[remember picture,overlay]
\node (mypicture) at (194pt,-330pt) {\includegraphics[width=387pt]{picture}};
\draw (0pt,0.3\textheight) -- (0pt,-\textheight) -- (\textwidth,-\textheight) -- (\textwidth,0.3\textheight) -- cycle;
\end{tikzpicture}

图片的坐标和宽度只是我原始文档中有效的坐标和宽度。在这个示例版本中可能无效。

相关内容