1

enter image description here

As you can see in the picture above, there is a lot of spacing between the start of a new page and the figure. However, this only seems to happen when the figure lands at a new page (I have set my topMargin to 0cm,so that can't be the problem). I have created this figure with Inkscape and the height of the total figure is almost the height of the sphere, so that can't be the reason. Here the contents of my document:

\documentclass[11pt]{extarticle}
\usepackage[left=3cm,right=3cm,top=0cm,bottom=2cm]{geometry}
\setlength{\parskip}{1em}
\usepackage{import}
\usepackage{graphics}
\usepackage{xifthen}
\usepackage{pdfpages}
\usepackage{transparent}
\usepackage{amsmath} 
\setlength{\parindent}{0mm}
\newcommand{\incfig}[1]{
    \def\svgwidth{\columnwidth}
    \import{./figures/}{#1.pdf_tex}
}

\begin{document} \section{Sphere} \begin{figure} \def\svgwidth{\columnwidth} \fbox{\incfig{next}}
\caption{Sphere} % \vspace*{-20pt} I have tried this but it doesn't seem to work % it only gets the sphere on the page before if there is some space left

\end{figure}

\end{document}

Kaisan
  • 43
  • There's at least one reason for this spacing: you nest a center environment, which adds some vertical spacing, in a figure environment, which also adds some vertical spacing. See what you obtain if you replace the center environment with the \centering directive. – Bernard May 25 '21 at 12:14
  • Given that we do not have your figure we can only speculate. I'd also see of \fbox{...} around the image would reveal the actual size (as seen from LaTeX) of the image. And that size can be a lot of white space. – daleif May 25 '21 at 12:19
  • @Bernard it still remains the same, even when I delete any center commands – Kaisan May 25 '21 at 12:20
  • @daleif I added it, as you can see, the margin of the image itself is not the problem. – Kaisan May 25 '21 at 12:21
  • You don't show us where the rest of the document is. Can we see the file such that we can compile the entire example ourself? – daleif May 25 '21 at 12:26
  • @daleif that's literally my hole file, the first page has the section with the title sphere, but there is no more text and the hole page is blank until the next page, which is the image I appended – Kaisan May 25 '21 at 12:39
  • 4
    figures on float pages are vertically centred by default ther eis presumably as much space below as above – David Carlisle May 25 '21 at 12:43
  • https://tex.stackexchange.com/questions/28556/how-to-place-a-float-at-the-top-of-a-floats-only-page/28565#28565 – David Carlisle May 25 '21 at 12:44
  • @DavidCarlisle thanks a lot! – Kaisan May 25 '21 at 12:49
  • @DavidCarlisle the only thing that remains unclear is why my figure doesn't appear on the first page of my document but gets "pressed" to the second page even though my first page only contains the title – Kaisan May 25 '21 at 13:00
  • \section calls \@afterheading which affects the next paragraph. Try adding \null\par or \hrule height0pt after \section to create an invisible next paragraph, – John Kormylo May 25 '21 at 14:08
  • as you have provided no example, we can't easily comment on particular page break choice. For you example replace \fbox{\incfig{next}} by \rule{3cm}{4cm} using a rule of a size that shows the problem. Then we can run the test exampe and debug – David Carlisle May 25 '21 at 14:27
  • @HerkulesOl See this still underrated question about the problem – Fran May 25 '21 at 15:03

0 Answers0