1

I would like to insert figure in another pdf into my document, but the new image is overlapping the text. Can I perfectly insert it?

\documentclass{article}


\title{Product Variety and Quality Under Monopoly}
\author{Zhou}
\date{January 2019}

\usepackage{natbib}
\usepackage{graphicx}
\usepackage[final]{pdfpages}
\setboolean{@twoside}{false}
\usepackage[UTF8]{ctex}
\begin{document}

    \maketitle

    \section{Horizontal Product Differentiation }
    To choose the number of retail outlets $n$, the price $p$ and the location of outlets. Preset the density of consumer $N$ and assume everyone consume only one unit. The distance from consumer $i$ to the closest outlet is $x_i$
    %Here, to insert the cropped pdf.
    \begin{figure}[h]
        \includegraphics[clip, trim=1cm 5cm 1cm 6cm, width=1.00\textwidth]{image1.pdf}
        \centering
    \end{figure}

    \subsection{n == 1}
    \noindent\textbf{\emph{Full Price}}: $p+tx$\\
    There is a theory which states that if ever anyone discovers exactly what the Universe is for and why it is here, it will instantly disappear and be replaced by something even more bizarre and inexplicable.
    There is another theory which states that this has already happened.

    \section{Conclusion}
    ``I always thought something was fundamentally wrong with the universe'' \citep{adams1995hitchhiker}

    \bibliographystyle{plain}
    \bibliography{references}
\end{document}

The original pdf is here:https://1drv.ms/b/s!Alipxzqy9-AoZ1UJUpy7ODd_90A enter image description here

7
  • Tried your code now with the provided PDF. With my freshly updated TeXLive 2018 I get the following message in the log filel: pdfTeX warning: pdflatex.exe (file ./image1.pdf): PDF inclusion: found PDF version <1.6>, but at most version <1.5> allowed. Check your log file for similar messages. Which LaTeX distribution are you using? MikTeX on Windows? In your case maybe just the PDF size is taken incorrectly. Commented Jan 6, 2019 at 7:08
  • The following trim parameters work for me: \includegraphics[clip,trim=2.3cm 0.5cm 2.6cm 7.5cm, width=1.00\textwidth]{image1.pdf}. There might be an issue with the PDF version causing the incorrect size being taken by pdflatex. You can crop the image using pdfcrop by providing the --bbox parameter (see the help text for more details). Also you could just redraw the diagram using TikZ. Commented Jan 6, 2019 at 7:18
  • Some other thoughts: begin{figure}[h] without \caption does not make much sense. The \centering should be first not last anyway. Just add the \includegraphics on its own, e.g. inside a \centerline{ ... }. Or use adjustbox to center it. Commented Jan 6, 2019 at 7:20
  • 1
    I think your trim parameters are wrong. It's trim=left bottom right top. My guess the behaviour you are seeing is because your bottom trim overlaps your top trim. Notice @MartinScharrer's bottom trim is much smaller than your 5cm and your PDF does not have much space below the image to trim off. When the top and bottom trim parameters overlap LaTeX gets calculates the wrong height and you get the overlap. Commented Jan 6, 2019 at 9:03
  • 4
    I'm voting to close this question as off-topic because it was solved in comments.
    – Mensch
    Commented Feb 8, 2019 at 17:06

0

Browse other questions tagged .