Some context: I use Inkscape to produce pictures in pdf format, that I import in latex using the usual function \includegraphics{pdffile}. Apart from keeping the picture in a vectorial format, it also sets the right size for the picture without any intervention from me.
The problem is, sometimes I am obliged to produce a pdf whose dimension go over the width of the page. That can easily be corrected manually, using
\includegraphics[width=\pagewidth]{pdffile}
, but what I would like, it some trick to tell latex to set automatically all figures to the width of the page if it goes over, or to keep the original sizes if not.
Here is an MWE:
\documentclass[10pt,a4paper]{article}
\usepackage{fontspec,graphicx}
\usepackage[left=2cm,right=5cm,top=5cm,bottom=2cm]{geometry}
\begin{document}
Some text.
\begin{figure}[h]
\begin{center}
\includegraphics{example-image-a.pdf}
\end{center}
\caption{Some too long PDF.}
\end{figure}
\end{document}

example-image-borexample-image-cor one of the other exciting options included in themwepackage ;). Also, you needgraphicx. – cfr Sep 29 '15 at 00:27