2

I want to insert a huge picture into my article. The size of this picture is about 670pt*2200pt, so it cannot be shown in one page (using figure environment), I adjusted its width to \textwidth so that I'm fatisfied with the effect in horizontal direction,but in vertical direction, the picture is still cropped at the end of the page. I don't want to adjust the height because i need this picture to be shown in several pdf pages in a continuous way.

Markdown language can do this job perfectly, I only insert this picture and convert markdown to pdf. But most of my work is completed in LaTeXenvironment, so any one can tell me how to realize this function?

  • Do you need a \caption with every part of the split image? – Werner Mar 4 '17 at 4:37
  • no, I just want to split the image in a continuous way. Because the image i am using is a flow chart. – heroinhell Mar 4 '17 at 5:48
  • 1
    Just to be clear, a high resolution does not necessarily mean that the picture has to be big (compared to the physical dimensions of the page, e. g. DiN A4). You can always tell LaTeX which width and/or which height it should use. – Dr. Manuel Kuehner Mar 4 '17 at 10:55
4

You can use the pictrue in usual way, but the \includegraphics has clip option that makes it possible to show only some region of the picture. see below:

\includegraphics[trim={Lmm Bmm Rmm Tmm}, clip, width=\textwidth]{picture}

L, B, R, and T means Left, Bottom, Rigth, Top margin respectively.

| improve this answer | |
  • I once tried to use this way, but it seems to be difficult for me. How can i calculate the exact part of the picture? That is, 1) Is the height in the 1st page is \textheight, then trim shoud be trim=0 pictureheight-\textheight 0 0,?and the 2nd page, i should use trim=0 pictureheight-2\textheight 0 \textheight ... and so on? – heroinhell Mar 4 '17 at 5:34
  • 2)The problem is how can i know the exact height of the picture, if i do not use a fixed picture,that is, the picture maybe chage very time ,In this case, i need recaculate how many parts the picture should be divided into. Is there a more flexible way to do this? – heroinhell Mar 4 '17 at 5:40
  • you mean your picture is produced automatically with the other program and you don't know anything about its dimensions and every time you want to set it in several pages just by some computation. – javadr Mar 4 '17 at 10:27
  • Yes,that is exactly what i want to ask. – heroinhell Mar 4 '17 at 13:05
4

enter image description here

\documentclass{article}
\usepackage{adjustbox}
\usepackage{blindtext}
\begin{document}
\blindtext \blindtext \blindtext
\noindent

\adjustbox{trim=3pt {\dimexpr\height-9\baselineskip} 0pt 0pt, clip}{\includegraphics[width=\linewidth]{example-image-b}}
\noindent
\adjustbox{trim=3pt 0pt 0pt 9\baselineskip, clip}{\includegraphics[width=\linewidth]{example-image-b}}

\blindtext

\end{document}
| improve this answer | |
3

Here is a way to manually stitch the pieces on subsequent pages.

Procedure:

  1. Store the original image in a box (called \origimgbox). This gives us something to work with throughout the construction.

  2. On every page but the last page where the image will reside, construct a box containing the "current image" (called \curimgbox) and adds this "current image" to a "cumulative image" box (called \cumimgbox).

  3. The last image is just set in place as the remaining \curimgbox.

We construct boxes to keep a measure of the height of already placed and remaining content. Also, minipages are set at their [b]aseline since the images are placed from the bottom of the page upward (via \smash). Of course, full-page placement may use \textheight, so we only calculate the first, partial image \curimgbox using zref's savepos module (via \zsaveposy and the expandable \zposy macros).

enter image description here

\documentclass{article}

\usepackage[paper=a6paper, showframe]{geometry}% Just for this example
\usepackage{lipsum,zref-savepos}
\usepackage[export]{adjustbox}

\newsavebox{\curimgbox}
\newsavebox{\cumimgbox}
\newsavebox{\origimage}

\begin{document}

\savebox{\origimage}{\begin{minipage}[b]{\textwidth}
  \nointerlineskip
  \makebox[\textwidth]{-- top 1 --} \\
  \includegraphics[width=\textwidth]{example-grid-100x100pt}\\
  \makebox[\textwidth]{-- gap 2 --} \\
  \includegraphics[width=\textwidth]{example-grid-100x100pt}\\
  \makebox[\textwidth]{-- gap 3 --} \\
  \includegraphics[width=\textwidth]{example-grid-100x100pt}\\
  \makebox[\textwidth]{-- gap 4 --} \\
  \includegraphics[width=\textwidth]{example-grid-100x100pt}\\
  \makebox[\textwidth]{-- bot 5 --}
\end{minipage}}

\sloppy
\lipsum[1]

\mbox{}\zsaveposy{top}

\vfill

\noindent\zsaveposy{bot}%
\savebox{\curimgbox}{\begin{minipage}[b]{\textwidth}
  \adjustbox{trim=0pt % llx
                  {\dimexpr\ht\origimage-\zposy{top}sp+\zposy{bot}sp-.5\baselineskip} % lly
                  0pt % urx
                  0pt, % ury
                  clip}{\usebox{\origimage}}%
\end{minipage}}%
\smash{\usebox{\curimgbox}}%
\savebox{\cumimgbox}{\usebox{\curimgbox}}%

%%% next page
\clearpage

\mbox{}

\vfill

\noindent
\savebox{\curimgbox}{\begin{minipage}[b]{\textwidth}
  \adjustbox{trim=0pt % llx
                  {\dimexpr\ht\origimage-\ht\cumimgbox-\textheight} %lly
                  0pt %urx
                  {\ht\cumimgbox},% ury
                  clip}{\usebox{\origimage}}%
\end{minipage}}%
\savebox{\cumimgbox}{\begin{minipage}[b]{\textwidth}
  \nointerlineskip
  \usebox{\cumimgbox}\\\usebox{\curimgbox}
\end{minipage}}%
\smash{\usebox{\curimgbox}}

%%% next page
\clearpage

\mbox{}

\vfill

\noindent
\savebox{\curimgbox}{\begin{minipage}[b]{\textwidth}
  \adjustbox{trim=0pt %llx
                  {\dimexpr\ht\origimage-\ht\cumimgbox-\textheight} %lly
                  0pt % urx
                  {\ht\cumimgbox},% ury
                  clip}{\usebox{\origimage}}%
\end{minipage}}%
\savebox{\cumimgbox}{\begin{minipage}[b]{\textwidth}
  \nointerlineskip
  \usebox{\cumimgbox}\\\usebox{\curimgbox}
\end{minipage}}%
\smash{\usebox{\curimgbox}}

%%% last page
\clearpage

\noindent
\savebox{\curimgbox}{\begin{minipage}[t]{\textwidth}
  \adjustbox{trim=0pt %llx
                  0pt %lly
                  0pt % urx
                  {\ht\cumimgbox},% ury
                  clip}{\usebox{\origimage}}%
\end{minipage}}%
\usebox{\curimgbox}

\lipsum[2]

\end{document}

In the above example, a fake original image is constructed and consists of a number of line separations (top 1, gap 2, ..., bot 5) and rectangular images (example-grid-100x100pt from mwe).

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.