0

When using the package graphics instead of graphicx (which is absent for MikTeX 2.9, given that it should be included in graphics) the figure does not show on the pdf.

\documentclass[11pt,a4paper]{article}

\usepackage{lipsum}
\usepackage{graphics}

\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\setlength\headheight{80.0pt}
\addtolength{\textheight}{-80.0pt}
% when using graphicx next line works:
%\chead{\includegraphics[width=\textwidth]{fig1.jpg}}
\chead{\includegraphics[width=\textwidth][0,0]{fig1.jpg}}

\begin{document}
\title{Title} 
\date{September 2013}
\author{Sergio}
\maketitle

\thispagestyle{fancy}
\lipsum[1-9]
\end{document}
  • 2
    graphicx has been part of every latex distribution since 1994. Why do you say it is absent? – David Carlisle Jul 29 '16 at 11:28
  • 2
    I'm sorry: MiKTeX always had graphicx in its distribution. It's part of the ‘required’ series of packages. – Bernard Jul 29 '16 at 11:29
  • 1
    If you want to use graphics syntax (I wouldn't recommend it) then \resizebox{\textwidth}{!}{\includegraphics{fig1.jpg}} – David Carlisle Jul 29 '16 at 11:30
  • I confirm that graphicxis not listed in the packages for MiKTeX 2.9 which I reinstalled yesterday. As you can see in CTAN the package graphics is part of "latex-graphics - The LaTeX standard graphics bundle" which includes graphics, graphicx and 5 more packages. – sbac Jul 29 '16 at 11:57
  • Off-topic: You need to use geometry to get proper support for a4paper. Otherwise the layout will not match the paper properly. But then you should not change \headheight or \textheight directly but use \geometry{headheight=80pt}, for example. – cfr Jul 29 '16 at 12:30
4

graphicx has been part of every latex distribution since 1994. Why do you say it is absent? I would recommend that you use this syntax.

If you want to use graphics syntax (I wouldn't recommend it) then to scale a figure use:

\resizebox{\textwidth}{!}{\includegraphics{fig1.jpg}}
| improve this answer | |
  • Sorry, this doesn't work. Until now the only good result was obtained using graphicx (not graphics) and TeXLive. – sbac Jul 29 '16 at 12:10
  • 1
    @sbac "doesn't work" isn't very informative. miktex has graphicx (it is a condition of the latex distribution that it be included) so if you really don't have it you have a completely broken installation and should fix that first. – David Carlisle Jul 29 '16 at 12:13
  • 1
    @sbac apart from the fact that graphicx.sty should be in the same directory as graphics.sty, if you do use graphics then the \resizebox version in this answer will work. If you find it does not post a real example (using example-image as the file name so we can run it) and post the exact error message that you get. It would also be useful to post the error message you get from \usepackage{graphicx} – David Carlisle Jul 29 '16 at 12:19
  • if you go to the MiKTeX repository you would not see graphicx. So I think the problem has not to do with my installation. And as I said I have no problem when using graphicxwith another TeX installation using TeXLive. Please see this similar problem. – sbac Jul 29 '16 at 13:57
  • @sbac as explained there and as you commented under the question graphics and graphicx are not distributed on their own, they are distributed as part of latex-graphics so that is the unit that you see on ctan and in texlive and miktex package installs, you install latex-graphics (which will be done already) and you have graphicx, graphics, trig, color latex packages. If you do not have graphicx your installation is broken. – David Carlisle Jul 29 '16 at 14:03

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.