LaTeX forum ⇒ Graphics, Figures & Tablesunwanted margin after a figure Topic is solved

Information and discussion about graphics, figures & tables in LaTeX documents.
Maxim22
Posts: 3
Joined: Sat Jan 05, 2013 4:26 pm

unwanted margin after a figure

Postby Maxim22 » Sat Jan 05, 2013 4:32 pm

Hi, I'm new to latex. I have the following problem:
After I have inputted a figure, I get a weird margin space on the next line. I'm just using this standard figure code so I don't think the problem lies there.
  1. \begin{figure}[H]
  2. \centering
  3. \includegraphics[width=0.8\textwidth]{image}
  4. \caption{Image}
  5. \label{fig:image}
  6. \end{figure}

Maybe the problem lies in my header since I just copied that from a Latex template.. can anyone help me with this?

Tags:

User avatar
Stefan Kottwitz
Site Admin
Posts: 9416
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Sat Jan 05, 2013 4:44 pm

Hi Maxim,

welcome to the board!

Maxim22 wrote:Maybe the problem lies in my header since I just copied that from a Latex template..


So why don't you post the header? ;-) Yes, the figure code is pretty common and should not cause that problem. But I also think the header doesn't either. Could it be that the image itself has a margin?

Perhaps post a Infominimal working example and attach the image to a post. So we can really test the issue. Otherwise it's quite theoretical.

Stefan
Site admin

User avatar
cgnieder
Site Moderator
Posts: 1988
Joined: Sat Apr 16, 2011 7:27 pm

Postby cgnieder » Sat Jan 05, 2013 4:45 pm

Hi Maxim22,

Welcome to the LaTeX community!

Unfortunately this piece of code won't tell us why that's happening to you. To be honest I'm not sure I even completely understood what you mean. Can you extend the code to a complete but minimal example (= Infominimal working example) that reproduces the behaviour so that we can compile and see for ourselves? Probably we will then be able to figure out what the problem is.

Regards

PS: Stefan was a minute faster :)
Clemens
------------------------------
chemmacros · chemformula · leadsheets · xsim

Maxim22
Posts: 3
Joined: Sat Jan 05, 2013 4:26 pm

Postby Maxim22 » Sat Jan 05, 2013 4:58 pm

  1. \documentclass[12pt]{article}
  2. \usepackage[dutch]{babel}
  3. \usepackage{amsmath} % need for subequations
  4. \usepackage{graphicx} % need for figures
  5. \usepackage{verbatim} % useful for program listings
  6. \usepackage{color} % use if color is used in text
  7. \usepackage{subfigure} % use for side-by-side figures
  8. \usepackage{hyperref} % use for hypertext links, including those to external documents and URLs
  9. \hypersetup{pdfborder={0 0 0}}
  10. \usepackage{float}
  11.  
  12.  
  13. % don't need the following. simply use defaults
  14. \setlength{\baselineskip}{16.0pt} % 16 pt usual spacing between lines
  15.  
  16. \setlength{\parskip}{3pt plus 2pt}
  17. \setlength{\parindent}{20pt}
  18. \setlength{\oddsidemargin}{0.5cm}
  19. \setlength{\evensidemargin}{0.5cm}
  20. \setlength{\marginparsep}{0.75cm}
  21. \setlength{\marginparwidth}{2.5cm}
  22. \setlength{\marginparpush}{1.0cm}
  23. \setlength{\textwidth}{150mm}
  24.  
  25. \begin{document}
  26.  
  27. \begin{figure}[H]
  28. \centering
  29. \includegraphics[width=0.8\textwidth]{senior}
  30. \caption{Image}
  31. \label{fig:image}
  32. \end{figure}
  33.  
  34. text texttexttexttexttexttexttexttext text text text text text v v v v v vtexttexttexttexttexttexttexttexttext
  35.  
  36. \end{document}


here you go :)

User avatar
Stefan Kottwitz
Site Admin
Posts: 9416
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Sat Jan 05, 2013 5:07 pm

Do you mean by margin after the figure the white space below the figure, or the paragraph indentation?

figure.png
figure.png (4.47 KiB) Viewed 6746 times


The first one is pretty normal, the latter is also normal, since a new paragraph starts. It's width is caused by:

  1. \setlength{\parindent}{20pt}


You could set it to 0pt if you don't want paragraph indentation.

However it seems to me that the whole LaTeX template is old, outdated or just bad, as I can see in the preamble code. Perhaps have a look a latex-templates.com for a newer one.

Stefan
Site admin

Maxim22
Posts: 3
Joined: Sat Jan 05, 2013 4:26 pm

Postby Maxim22 » Sat Jan 05, 2013 5:14 pm

thank you, it was the paragraph indentation. I find it weird because it was the only place where I had the problem, not with the other paragraphs...

User avatar
cgnieder
Site Moderator
Posts: 1988
Joined: Sat Apr 16, 2011 7:27 pm

Postby cgnieder » Sat Jan 05, 2013 5:37 pm

Maxim22 wrote:I find it weird because it was the only place where I had the problem, not with the other paragraphs...


I'm quite surprised by that since it really is the default behaviour! See the following example:

  1. \documentclass{article}
  2.  
  3. \begin{document}
  4.  
  5. This is a paragraph which is indented like it is the default for most document
  6. classes. This is a paragraph which is indented like it is the default for most
  7. document classes. This is a paragraph which is indented like it is the default
  8. for most document classes.
  9.  
  10. This is a paragraph which is indented like it is the default for most document
  11. classes. This is a paragraph which is indented like it is the default for most
  12. document classes. This is a paragraph which is indented like it is the default
  13. for most document classes.
  14.  
  15. \section{A section title}
  16. This is a paragraph which is not indented like because it follows a section
  17. title. This is normal for most document classes but may change if one uses
  18. specific language settings.
  19.  
  20. This is a paragraph which is indented like it is the default for most document
  21. classes. This is a paragraph which is indented like it is the default for most
  22. document classes. This is a paragraph which is indented like it is the default
  23. for most document classes.
  24. \end{document}


paragraphs.png
paragraphs.png (57.04 KiB) Viewed 6743 times


Regards
Clemens
------------------------------
chemmacros · chemformula · leadsheets · xsim


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: No registered users and 7 guests