diff options
Diffstat (limited to 'macros/latex/contrib/chkfloat/chkfloat.sty')
-rw-r--r-- | macros/latex/contrib/chkfloat/chkfloat.sty | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/macros/latex/contrib/chkfloat/chkfloat.sty b/macros/latex/contrib/chkfloat/chkfloat.sty new file mode 100644 index 0000000000..63f28da894 --- /dev/null +++ b/macros/latex/contrib/chkfloat/chkfloat.sty @@ -0,0 +1,38 @@ +%% +%% This is file `chkfloat.sty'. +%% +%% Author: Tomas "tohecz" Hejda <tohecz@gmail.com> +%% +%% Licenced under LaTeX-Project Public License version 1.3 or newer. +%% +\NeedsTeXFormat{LaTeX2e}[1995/06/01] +\ProvidesPackage{chkfloat}[2012/08/19 v0.1 chkfloat: check for moved floats] + +% tolerances +\PassOptionsToPackage{patch}{kvoptions} +\RequirePackage{kvoptions} +\DeclareStringOption{tolerance} +\def\chkfloat@tolerance{1} +\ProcessKeyvalOptions* + +% store original macros \@float and \@caption +\let\chkfloat@float\@float +\let\chkfloat@caption\@caption +% make \@float remember the page where the float should be +\def\@float{\edef\chkfloat@page{\thepage}\chkfloat@float} +% make \@caption write to a file .fof the information about final page, original page and float caption +\def\@caption#1[#2]#3{\chkfloat@caption{#1}[#2]{#3}% + \addtocontents{fof}{\protect\chkfloat@{\thepage}{\chkfloat@page}{\csname fnum@#1\endcsname: #2}}% +} +% checking macro +\def\chkfloat@#1#2#3{\ifnum#1>\numexpr#2+\chkfloat@tolerance\relax + \begingroup\let\on@line\@gobble\def\nobreakspace{ }\GenericWarning{}{Float misplaced on pages #2->#1, #3}\endgroup +\fi +} +% process the file .fof +\@starttoc{fof} + +\endinput +%% +%% End of file `chkfloat.sty'. +%%
\ No newline at end of file |