Skip to content

Commit 11923f2

Browse files
docs(paper): keep floats near their references
Tables and figures used to drift pages away from the prose that cites them: every table was a double-column table*[t], which stock LaTeX can only place at the top of a LATER page, and the default float limits pushed them further still. - fix_longtables.py: tables narrow enough for one column (Table 2 fold economics, Table 6 whole-core area) become single-column table[!t] floats, which can sit on the page where they are cited; the wide six stay table*, now [!t]. - ieee/preamble.tex: dblfloatfix lets double-column floats appear at the top of the SAME page as their source; float fractions/counters relaxed (topfraction .9, dbltopnumber 4, ...) so a results page may carry several tables. Outcome (visually audited page by page): Table 1, Table 2 and Fig. 1 share the page with §4; Tables 5-6 sit on the §6 page and Table 7 beside the comparison discussion; Fig. 2 tops the §8 Discussion page; every float is on its reference page or the one after. 10 pages, zero LaTeX errors, zero missing glyphs, no overfull >30pt. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 6c888c5 commit 11923f2

2 files changed

Lines changed: 25 additions & 1 deletion

File tree

docs/paper/ieee/fix_longtables.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,23 @@ def take(tok, s):
3434
cap = ''
3535
if caption:
3636
cap = "\\caption{%s}\n" % ' '.join(caption.split())
37-
return ("\\begin{table*}[t]\n\\centering\\footnotesize\n%s"
37+
global tblno
38+
tblno += 1
39+
if tblno in SINGLE_COL:
40+
# narrow enough for one 3.5in column: a single-column float can sit
41+
# on the same page as (or right after) its reference
42+
return ("\\begin{table}[!t]\n\\centering\\scriptsize\n%s"
43+
"\\begin{tabular}{%s}\n%s\n\\end{tabular}\n\\end{table}"
44+
% (cap, colspec, inner))
45+
return ("\\begin{table*}[!t]\n\\centering\\footnotesize\n%s"
3846
"\\begin{tabular}{%s}\n%s\n\\end{tabular}\n\\end{table*}"
3947
% (cap, colspec, inner))
4048

49+
# tables (in order of appearance) whose natural width fits one column;
50+
# the rest must span both columns
51+
SINGLE_COL = {2, 6}
52+
tblno = 0
53+
4154
pat = re.compile(
4255
r'(?:\\textbf\{Table\s+[0-9]+\.\s+(?P<cap>[^{}]*?)\}\s*\n\s*\n)?'
4356
r'(?P<tbl>\\begin\{longtable\}.*?\\end\{longtable\})', re.S)

docs/paper/ieee/preamble.tex

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,14 @@
3434
% prose references say "Table 1"; keep captions arabic (IEEEtran defaults to
3535
% Roman numerals)
3636
\renewcommand\thetable{\arabic{table}}
37+
% keep floats near their references: allow double-column floats on the SAME
38+
% page as their source (stock LaTeX defers them to the next page), and relax
39+
% the float limits so a results page may carry several tables
40+
\usepackage{dblfloatfix}
41+
\renewcommand{\topfraction}{0.9}
42+
\renewcommand{\dbltopfraction}{0.9}
43+
\renewcommand{\textfraction}{0.05}
44+
\renewcommand{\floatpagefraction}{0.8}
45+
\setcounter{topnumber}{3}
46+
\setcounter{dbltopnumber}{4}
47+
\setcounter{totalnumber}{5}

0 commit comments

Comments
 (0)