1

In my report i have a last section that only contains spectra, which i add via \includepdf[]{}. Often there is a pagebreak before the section so there is an almost empty page with only the section title and then the added pdfs. How do I prevent latex from making a pagebreak before this section if anyhow possible?

\section{Section}
Bla bla
\nopagebreak
\section{Spectra}
\pagebreak
\includepdf[angle=90]{spectra/dummyspectrum}

does sometimes work but it seems not in the current case... I don't have a MWE because it would not be very "minimal" and if I put some dummy text instead it seems to work. Hope in the picture one sees what the problem is.

enter image description here

edit: added "minimal" working example (still not complete Praeambula) that reproduces the issue.

It seems I also found a workaround. When adding

\FloatBarrier
\subsection{Massenspektrometrie}

then it works. But I have no clue why. Of course there is the float in the previous subsection (the big black box in the MWE). But wth should it prevent the next section title to be set on a page that oviously has enough whitespace available? Also, it prevents the float to float past upcoming subsections which is totally fine in the current case but which is I do not really intend here.

\documentclass[12pt,a4paper]{scrartcl}
\usepackage[left=1.5cm,right=1.5cm,top=2cm,bottom=2cm,includeheadfoot]{geometry}
\usepackage[british,ngerman]{babel} %Letzte Sprache = Hauptsprache
\usepackage{graphicx}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\setkomafont{disposition}{\normalfont\bfseries} %Section Titel in Serifen
\setkomafont{caption}{\footnotesize\sffamily\bfseries}  %Captions in Serifenlos und fett
\setkomafont{captionlabel}{\usekomafont{caption}}   %Text nach caption gleich wie caption
\usepackage{textgreek}  %Aufrechte griechische Buchstaben: upgreek, textgreek
\usepackage{color, lipsum, pdfpages}
\usepackage{tabularx}
\usepackage{float}
\usepackage[section]{placeins}
\usepackage[format=plain]{caption}
\usepackage[onehalfspacing]{setspace}   %Zeilenumbruch Abstand
\parskip=0.5\baselineskip   %Abstand zwischen Abschnitten
\usepackage{siunitx}
\usepackage{chemmacros}
\chemsetup{
    modules={spectroscopy,scheme,isotopes},
    greek=textgreek,
    nomenclature/iupac = strict,
    }
\RenewChemIUPAC{\D}{\chemDelta}
\RenewChemIUPAC{\L}{\chemLambda}
\newcommand\question[1]{\noindent\textcolor{blue}{\textbf{#1}}\par}

%HEADER, FOOTER
\usepackage{lastpage}
\usepackage{scrlayer-scrpage}
\clearpairofpagestyles
\lohead{Baron von Tannenhausen}
\rohead{Experiment 3.14}
\lofoot*{}
\rofoot*{\pagemark\ von \pageref{LastPage}}
\pagestyle{scrheadings}
\setkomafont{pageheadfoot}{}

\begin{document}
\begin{titlepage}
\Huge Titlepage
\end{titlepage}

\section{Ziel des Versuchs}\lipsum[1]\section{Einleitung}\lipsum[1-2]\section{Experimentelle Durchführung}\lipsum[1-3]\section{Diskussion}\lipsum[1]\section{Schlussfolgerung}\lipsum[1]\bibliography{bibliography}\section{Beantwortung der Fragen}\subsection{Template Synthese}\lipsum[1]\subsection{Stabilität von Komplexen}\lipsum[1]
\subsection{Isomerie}
\question{Welche Isomere existieren für die unten gezeigten Verbindungen? Zeichne die Strukturen aller Isomere und benenne sie.}

\begin{figure}[!hp]
%\includegraphics[width=0.9\textwidth]{images/question3-2}
\rule{0.7\textwidth}{0.6\textwidth} %NEWLY ADDED FOR MWE
\caption{1a: \ch{\L-[Rh(acac)3]}, 1b: \ch{\D-[Rh(acac)3]}, 2a: \ch{\cis-[PtCl2(PMe3)2]}, 2b: \ch{\trans-[PtCl2(PMe3)2]}, 3a: \ch{\fac-[TiCl3(THF)3)]}, 3b: \ch{\mer-[TiCl3(THF)3)]}, 4a: \ch{\cis-[IrClCO(PPh3)2]}, 4b: \ch{\trans-[IrClCO(PPh3)2]}, 5a: \ch{\L-[Fe(phen)3]^{2+}}, 5b: \ch{\D-[Fe(phen)3]^{2+}}, 6a: \ch{\cis-\L-[RuCl2(bpy)2]}, 6b: \ch{\cis-\D-[RuCl2(bpy)2]}, 6c: \ch{\trans-[RuCl2(bpy)2]}, 7: \ch{CoCl2Br2}; 8a: \ch{\L-[Cu(etbpy)2)]^{+}}, 8b: \ch{\D-[Cu(etbpy)2)]^{+}}.
}
\end{figure}

\subsection{Massenspektrometrie}
\question{Für Salze der Form \ch{[ML_{x}]X_{y}} (L = Ligand, \ch{X-} = Gegenion) ist es üblich, im Massenspektrum peaks für die Ionen \ch{[ML_xX_{y-1}]+}, \ch{[ML_xX_{y-2}]^{2+}}, usw. zu sehen. Die intensivste Gruppe an Peaks im Massenspektrum von \ch{[Co(en)3]Cl3} ist unten gezeigt. Cobalt hat nur ein Isotop. Erkläre das Muster der Peaks.}

\begin{minipage}{0.4\textwidth}
%\includegraphics[width=0.9\textwidth]{images/question4}
\rule{0.8\textwidth}{1.2\textwidth} %NEWLY ADDED FOR MWE
\end{minipage}
\begin{minipage}{0.6\textwidth}\footnotesize
\begin{tabularx}{\textwidth}{lp{1.2cm}X}
$m/z$   &   ca. Int. / \%   &   Zuordnung   \\ \hline\hline
309.1   &   100 &   Basispeak; \ch{C6H24^{35}Cl2CoN6}   \\
310.1   &   10  &   \ch{^{13}C^{12}C5H24^{35}Cl2CoN6}; ein \isotope*{12,C} durch \ch{13,C} ersetzt  \\
311.1   &   65  &   \ch{C6H24^{37}Cl^{35}ClCoN6} und \ch{^{13}C2^{12}C4H24^{35}Cl2CoN6}; ein \isotope*{35,Cl} durch \isotope*{37,Cl} erstzt oder zwei \isotope*{12,C} durch \isotope*{13,C} ersetzt \\
312.1   &   5   &   \ch{^{13}C^{12}C5H24^{37}Cl^{35}ClCoN6}; ein \isotope*{35,Cl} durch \isotope*{37,Cl} erstzt und ein \isotope*{12,C} durch \isotope*{13,C} ersetzt   \\
313.1   &   10  &   \ch{C6H24^{37}Cl2CoN6}; zwei \isotope*{35,Cl} durch \isotope*{37,Cl} erstzt \\
314.1   &   2   &   \ch{^{13}C^{12}C5H24^{37}Cl2CoN6}; zwei \isotope*{35,Cl} durch \isotope*{37,Cl} erstzt und ein \isotope*{12,C} durch \isotope*{13,C} ersetzt    \\
\end{tabularx}
\normalsize
Natürlich sind auch Isotope von Stickstoff und Sauerstoff vorhanden sowie Spezies mit mehr als zwei \isotope*{13,C}. Diese sind jedoch  vernachlässigbar unwahrscheinlich.
\end{minipage}

\nopagebreak
\section{Spektren}
\includepdf[angle=90]{spectra/dummy}
\includepdf[angle=90]{spectra/dummy}
\includepdf[angle=90]{spectra/dummy}
\end{document}
  • I would imagine that you want \clearpage after \section{Spectra} – David Carlisle Jun 1 '17 at 19:48
  • Well, that still puts the \section{Spectra} on an otherwise empty page while there is still way enough space left on the previous page. – Wulfram Jun 1 '17 at 19:50
  • if it does there is something stopping the section head going on the previous page but without any code pretty hard to guess why, I am assuming that you are using a document class where sections do normally start mid-page. – David Carlisle Jun 1 '17 at 19:52
  • in particular the page before the heading looks like a figure but impossible to tell if it is a float page or a text page – David Carlisle Jun 1 '17 at 19:54
  • i use scrartcl. Usually it works fine. If it doesn't it worked till now with \nopagebreak. The previous page page contains a minipage with an \includegraphics[]{} and a minipage with a \tabularx. – Wulfram Jun 1 '17 at 19:58
2

The problem is due to \usepackage[section]{placeins} because with this option the package redefine \section command by adding \FloatBarrier (-> \clearpage) before the original definition.

  • So to prevent such behaviour I just put \usepackage{placeins} without the option [section] and put all the \FloatBarrier 's manually where needed? – Wulfram Jun 5 '17 at 12:13
  • @Wulfram exactly as far as i know. – touhami Jun 5 '17 at 15:27

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.