我有以下最小示例。当我编译它时,结果很好,正如预期的那样。
\documentclass[ngerman,12pt,a4paper]{report}
\usepackage[left=2cm,right=2cm]{geometry}
\usepackage{graphicx}
\usepackage{fancyhdr}
\usepackage{setspace}
\usepackage[utf8]{inputenc}
\usepackage[plainpages=false,pdfpagelabels]{hyperref}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{textcomp}
\usepackage{todonotes}
\usepackage{floatrow}
\floatsetup[figure]{capposition=bottom}
\usepackage{float}
\usepackage{fancyvrb}
\usepackage{listings}
\usepackage{color}
\usepackage{pgfplots}
\usepackage[T1]{fontenc}
\usepackage{booktabs}
\usepackage{csquotes}
\usepackage[usenames,dvipsnames]{pstricks}
\usepackage{epsfig}
\usepackage{pst-grad} % For gradients
\usepackage{pst-plot} % For axes
\usepackage{fixltx2e}
\usepackage{subcaption}
\usepackage[linesnumbered]{algorithm2e}
\usepackage[dvipsnames]{xcolor}
\newcommand\myworries[1]{\textcolor{red}{#1}}
\usepackage{pdfpages}
\usepackage[normalem]{ulem}
\usepackage{url}
\usepackage{hyperref}
\usepackage[numbers]{natbib}
\bibliographystyle{plainnat}
\usepackage{courier}
\usepackage[english,ngerman]{babel}
\begin{document}
\section{Se}
In this section, ,,,,,,,,,,,,,,,,,,
In this section, ,,,,,,,,,,,,,,,,,,
In this section, ,,,,,,,,,,,,,,,,,,
In this section, ,,,,,,,,,,,,,,,,,,
In this section, ,,,,,,,,,,,,,,,,,,
\subsection{Constraints}
constraints\\
constraints\\
constraints\\
constraints\\
constraints\\
constraints\\
constraints\\
constraints\\
constraints\\
constraints\\
constraints\\
constraints\\
where n is the minimum/maximum
\begin{algorithm}[H]
\SetAlgoLined
\KwData{RDF}
\KwResult{Violation}
$Violation$\;
\end{algorithm}
The algorithm for . The algorithm for .The algorithm for .The algorithm for .The algorithm for .The algorithm for .The algorithm for .The algorithm for .The algorithm for .The algorithm for .The algorithm for .The algorithm for .The algorithm for .The algorithm for .The algorithm for .The algorithm for .The algorithm for .The algorithm for .The algorithm for .The algorithm for .The algorithm for .
The algorithm for . The algorithm for .The algorithm for .The algorithm for .The algorithm for .The algorithm for .The algorithm for .The algorithm for .The algorithm for .The algorithm for .The algorithm for .The algorithm for .The algorithm for .The algorithm for .The algorithm for .The algorithm for .The algorithm for .The algorithm for .The algorithm for .The algorithm for .The algorithm for .
\subsection{Constraint}
constraints\\
constraints\\
constraints\\
constraints\\
constraints\\
constraints\\
constraints\\
constraints\\
constraints\\
constraints\\
constraints\\
constraints\\
constraints\\
constraints\\
constraints\\
constraints\\
where d is the where d is the where d is the where d is the where d is the
\begin{algorithm}[H]
\SetAlgoLined
\KwData{RDF}
\KwResult{violation}
$Violation$
$Violation$\;
$Violation$
$Violation$\;
\caption{Algorithm to...}
\end{algorithm}
\end{document}
但在我的主文档中,算法转到下一页,而当前页有足够的空间。我还提供了一个示例页面。
有人有什么建议吗?
提前致谢。