明らかに 1 ページに収まる複数のフロートが 2 ページにまたがって配置されている

明らかに 1 ページに収まる複数のフロートが 2 ページにまたがって配置されている

LaTeXで奇妙なレイアウトの問題があり、何らかの理由で、明らかに1 ページに収まらない内容は、大きな vspace を使用しても 2 ページに分散されます。

レイアウトの問題

添付の画像は、次のコードのコンパイル結果を示しています。

\begin{figure}[ht]
\centering
\includegraphics[width=.85\textwidth]{baseline_sensor2}
\caption{Test ID S2.1 - sensor 2}
\end{figure}

\vspace{-5cm}
\begin{figure}[ht]
\centering
\includegraphics[width=.85\textwidth]{baseline_sensor3}
\caption{Test ID S2.1 - sensor 3}
\end{figure}

このテンプレートでは、この問題が何度か発生しました。不思議なことに、フロートを 1 ページにまとめられるほどサイズを縮小できれば、レイアウトを崩すことなく、同じページにテキストを追加できます。縮小したサイズがページに収まらないサイズと 1 % 異なる場合でも同じです。

これは私の前置きです。

\documentclass[a4paper,oneside,10pt]{report}

%% Formatting %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[USenglish]{babel} %francais, polish, spanish, ...
\usepackage[T1]{fontenc}
\usepackage[ansinew]{inputenc}
\usepackage{lmodern} %Type1-font for non-english texts and characters

%% Packages for Graphics & Figures %%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{graphicx} %%For loading graphic files
\usepackage{subfig}
\graphicspath{{images/}}
\usepackage[headheight=70pt,margin=1.0in,top=1.5in,bottom=1.0in,showframe=false]{geometry}

%% Packages for tables:
\usepackage{tabularx} % Include for better table functionality
\usepackage{tablefootnote} % Include to allow for footnotes in tables
\usepackage{multirow} % Write one entry for multiple rows and columns in tables
\usepackage{booktabs} % Insert divider rules in tables

%% Color Packages %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[table,xcdraw]{xcolor}
\setlength{\arrayrulewidth}{0.4mm} % witdh of lines
\setlength{\tabcolsep}{8pt} % width of each row
\definecolor{green}{rgb}{0,0.59765625,0.59765625}
\definecolor{red}{rgb}{0.6875,0.08984375,0.12109375}
\definecolor{blue}{rgb}{0.25390625,0.41015625,0.87890625} 
\definecolor{gray}{rgb}{0.9140625,0.9140625,0.9453125}
\definecolor{gray2}{rgb}{0.75,0.75,0.75}
\definecolor{stoneblack}{rgb}{0.234375  ,  0.2734375 ,  0.29296875}
\definecolor{snow}{rgb}{0.99609375  ,  0.99609375 ,  0.99609375}
\definecolor{sgreen}{rgb}{0,0.59765625,0.59765625}
\definecolor{stonelight}{rgb}{0.67578125,0.7421875,0.79296875}
\definecolor{yellow}{rgb}{0.99609375,  0.72265625,  0}
\definecolor{black}{rgb}{0  ,  0 ,  0}
\definecolor{red2}{rgb}{0.68359375,  0.13671875,  0.37109375}

%% Math Packages %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amsfonts}
\usepackage{xfrac}
\usepackage{siunitx} % Allows for easy unit input

%% Line Spacing %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\usepackage{setspace}
%\singlespacing        %% 1-spacing (default)
%\onehalfspacing       %% 1,5-spacing
%\doublespacing        %% 2-spacing

%% Other Packages %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[pdftex,bookmarks=true,hidelinks]{hyperref} % Allows for inserting urls with \url{}
\usepackage{url}
\usepackage{bookmark}
\bookmarksetup{depth=3} 
\usepackage[absolute,overlay]{textpos} % Used for textblock on frontpage
\usepackage{wallpaper}
\usepackage{fancyhdr}
\usepackage{lastpage} % Included so that \LastPage can be used to get pagenumber for last page
\usepackage{titlesec} % Include to control chapter and section display
\usepackage{tcolorbox} % Included to be able to make colored, rounded textboxes


%% My commands %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand\todo[1]{\textcolor{red}{\textbf{#1}}}

\titleformat{\chapter}[block]
  {\Huge\bfseries}{\thechapter.}{0.5em}{\Huge}
\titlespacing*{\chapter}{0pt}{-15pt}{10pt}

長いコードスニペットで申し訳ありませんが、どこが間違っているのか全くわかりません。

答え1

フロートのデフォルトの位置は(上、下、ページ)であり、多くの場合これが最適である[tbp]。フロートをページ上に配置する方法を変更するためのマクロがある。これらと括弧内のデフォルト値を組み合わせると、

これらを次のように変更します\setcounter:

topnumber(2)ページ上部のフロートの最大数

bottomnumber(1)ページ下部のフロートの最大数

totalnumber(3)テキストページ上のフロートの最大数

dbltopnumber(2)topnumber2列フロートの場合

次のものを次のように変更します\renewcommand:

\topfraction(0.7) 上部フロート用に予約されたページの最大割合

\bottomfraction(0.3) ページの下部フロートの最大割合

\textfraction(0.2) テキストが必要なページの最小割合

\dbltopfraction(0.7)\topfraction2列フロートの場合と同様

\floatpagefraction(0.5)フロートページに必要なフロート数の最小割合

\dblfloatpagefraction(0.5)\floatpagefraction2列フロートの場合と同様

フロートの周囲の間隔を制御するマクロもあります。

クラスmemoirのドキュメント(< texdoc memoir)のセクションで詳細が説明されています。10.4 LaTeXがフロートを配置する場所

適切なレイアウトになるまで上記のパラメータを調整します。

関連情報