在多个页面上自动显示大图像

在多个页面上自动显示大图像

我有一个很长的 UML 图,我使用以下代码。该图大约有两页半长,但只显示了第一页,图的下半部分缺失。如何在多页中显示整个图?

我到底应该添加什么代码?

\usepackage{graphicx} 
......
\includegraphics[height= 81.3cm, width=18cm]{myImage.png}
\captionof{figure}{Sequence Diagram}

答案1

我还没有完全自动化的版本,但以下可以工作:

\documentclass{article}
\usepackage[a5paper,landscape]{geometry}
\usepackage{caption,graphicx,adjustbox}

\newsavebox{\bigincbox}
\newlength{\bigincht}
\sbox\bigincbox{\includegraphics[width=\textwidth]{tiger}}
\setlength{\bigincht}{\ht\bigincbox}
{\count0=\bigincht \dimen0=.8\textheight \divide\count0 by \dimen0
 \typeout{You need \number\numexpr\count0+1\relax\space chunks}}

\begin{document}
\begin{figure}
\centering
\clipbox*{0 {.5\bigincht} {\textwidth} {\bigincht}}{\usebox{\bigincbox}}
\caption{Upper half}
\end{figure}
\begin{figure}
\centering
\clipbox*{0 0 {\textwidth} {.5\bigincht}}{\usebox{\bigincbox}}
\caption{Lower half}
\end{figure}
\end{document}

这里 A5 纸和横向模式仅用于举例。\typeout将在日志文件中写入需要多少块。 一旦知道了这一点,就很容易构建块,记住 的第一个参数\clipbox*是左下角和右上角坐标,确定我们想要的矩形

只是.8\textwidth为了给标题留出一些空间。

tiger.pdf图像可以在 PSTricks 的文档目录中找到。

更具体的代码

让我们尝试使用高 81.3 厘米、宽 18 厘米的图像。看起来文本高度的 90% 处的块应该没问题,所以

\documentclass{article}
\usepackage{graphicx,adjustbox}

\newsavebox{\bigincbox}
\newlength{\bigincht}
\sbox\bigincbox{\makebox[\textwidth]{\includegraphics[width=18cm,height=81.3cm]{tiger}}}
\setlength{\bigincht}{\ht\bigincbox}
{\count0=\bigincht \dimen0=.9\textheight \divide\count0 by \dimen0
 \typeout{You need \number\numexpr\count0+1\relax\space chunks}}

\begin{document}
\begin{figure}
\centering
\clipbox*{0 {.8\bigincht} {\textwidth} {\bigincht}}{\usebox{\bigincbox}}
\caption{Chunk 1}
\end{figure}
\begin{figure}
\centering
\clipbox*{0 {.6\bigincht} {\textwidth} {0.8\bigincht}}{\usebox{\bigincbox}}
\caption{Chunk 2}
\end{figure}
\begin{figure}
\centering
\clipbox*{0 {.4\bigincht} {\textwidth} {0.6\bigincht}}{\usebox{\bigincbox}}
\caption{Chunk 3}
\end{figure}
\begin{figure}
\centering
\clipbox*{0 {.2\bigincht} {\textwidth} {0.4\bigincht}}{\usebox{\bigincbox}}
\caption{Chunk 4}
\end{figure}
\begin{figure}
\centering
\clipbox*{0 0 {\textwidth} {0.2\bigincht}}{\usebox{\bigincbox}}
\caption{Chunk 5}
\end{figure}

\end{document}

前面的部分\begin{document}是你必须放在序言中的部分;记得加载包调整框。之后的代码\begin{document}生成了五个块。更改标题。

相关内容