Seems like the problem of border around includegraphics has already been brought up. But none of the solutions worked for me. Here's how my border looks like: enter image description here And here's the code:

lsdfjgofgkogkof kgdpgokfdgkdfog pdkpgodkgpodkg pfgkdgkdpgkf dgod k fpgkfdgdpfgod fkgdfgpdokfgop dkgpodkgop dkg dpgdkf gdkpdkog\\
\fbox{\includegraphics[center,cfbox=blue 1pt 1pt,fbox,frame]{name.png}}\\
kfogkdfpogkdf kpfogkfdpogdkf opdfkgpofdkgpodf kpofdgkopfdkgpdfk gpdfokgodfpk gdfopkgpofdkgodpfk pdofgk dfpk dgpokfgdfopgkdpf kpofg podfkgd pfokpfdgkpodfg

I'd be even more grateful if you could add in the comment how to better center the image as well. The above is the closest I could get to centered image.

  • I don't know why but center produces a shorter frame. – Ignasi Apr 26 '16 at 15:37

Just try this:

\fbox{\includegraphics[width=\textwidth,center,cfbox=blue 1pt 1pt,fbox,frame]{name.png}}

Put "width" as first option in your includegraphics.

Another idea is to change margins just for the image using package changepage, like this:

In preamble put:


An then use it adjusting relative to previous margin:

\fbox{\includegraphics[center,cfbox=blue 1pt 1pt,fbox,frame]{name.png}}

Sustitute -1cm for the decrement of margin size you need.

| improve this answer | |
  • But I don't want to make my image smaller. And even if I did, it still doesn't work: imgur.com/DYpu6F7. – user1 Apr 27 '16 at 7:43
  • Thank you. The second solution works. I'm marking the answer as accepted until there is a way to do it without hardcoded values. If there is none, it's a pity. – user1 Apr 27 '16 at 10:08

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.