Hello LuaTeX experts,
I am facing a classic LaTeX float placement problem in a *twocolumn* document,
and I am wondering if LuaTeX offers a potential solution where traditional
methods seem to fail.
The goal is to have a single-column *figure[t]* and a double-column
*figure*[b]* (using the *stfloats *package) appear together on the same
page, immediately following their definition.
The issue is that LaTeX's behavior is inconsistent.
When the floats are defined early in the document (e.g., on Page 1), they
are split: the *figure[t] *lands on Page 2, but the *figure*[b]* is delayed
until Page 3.
However, an identical pair defined later (e.g., on Page 3) correctly land
together on Page 4.
My requirement is for a completely automated solution.
I cannot rely on manually re-ordering the floats in the source to make the
output routine happy.
My question for this group is: *Could this synchronization problem be
solved using LuaTeX?*
For example, is it feasible to use a Lua callback (perhaps
*build_page_insert_filter*, or something influencing the output routine)
to:
1. Inspect both the single-column and double-column pending float lists?
2. Detect when a *[t]* float is being placed at the top of a page *and* a
*[b]* double-column float is pending?
3. If this condition is met, can Lua somehow *force* or *encourage* the
output routine to reserve space for and place *both* floats on the *same* page,
synchronizing them before the page is shipped out?
I understand this is a complex part of the TeX engine, but this seems like
a timing and look-ahead problem that Lua might be uniquely suited to solve.
Below is the MWE that demonstrates the problem.
*MWE:*
\documentclass[twocolumn]{article}\usepackage{lipsum}\usepackage{stfloats}\usepackage{graphicx,color}\setlength\marginparwidth{4pc}\setlength\marginparsep{1pc}\begin{document}
Para One: ...
Para Two: ...
Para Three: ...
Para Four: ...
Para Five: ...
\marginpar{{\color{red}\textbf{Fig 1\&2 placed here}}}
\begin{figure}[t]\fbox{\vbox to 10pc{\hbox to
.98\columnwidth{}}}\caption{single col
figure}\end{figure}\begin{figure*}[b]\fbox{\vbox to 10pc{\hbox to
\textwidth{}}}\caption{single col figure}\end{figure*}
Para Six: ...
Para Seven: ...
Para Eight: ...
Para Nine: ...
Para Ten: ...
Para 1-One: ...
Para 1-Two: ...
Para 1-Three: ...
Para 1-Four: ...
\marginpar{{\color{red}\textbf{Fig 3\&4 placed here}}}
\begin{figure}[t]\fbox{\vbox to 10pc{\hbox to
.98\columnwidth{}}}\caption{single col
figure}\end{figure}\begin{figure*}[b]\fbox{\vbox to 10pc{\hbox to
\textwidth{}}}\caption{single col figure}\end{figure*}
Para 1-Five: ...
Para 1-Six: ...
Para 1-Seven: ...
Para 1-Eight: ...
Para 1-Nine: ...
Para 1-Ten: ...
\end{document}
*Present Output:*
Figures 1 & 2 are separated. Figure 1 is on Page 2, while Figure 2 is
pushed to Page 3.
[image: Figures 1 & 2] <https://i.sstatic.net/3Kq084Zl.png> [image: Figures
3 & 4] <https://i.sstatic.net/xFbrkgdi.png>
*Link: https://i.sstatic.net/xFbrkgdi.png
<https://i.sstatic.net/xFbrkgdi.png>*
*Required Output:*
Figures 1 & 2 should both appear on Page 2, just like Figures 3 & 4 do on
Page 4.
[image: Required Output] <https://i.sstatic.net/jKr8RYFd.png>
*Link: https://i.sstatic.net/jKr8RYFd.png
<https://i.sstatic.net/jKr8RYFd.png>*
Thanks & Regards
Kumaresh P
Kumaresh P
Engineering Lead
P: +91 44 4596 4800
<https://tnqtech.com/> <https://www.linkedin.com/company/tnqtech/>
>
--
Disclaimer: The entire content of this email message, including any files
transmitted with it are confidential and intended solely for the use of the
individual or entity to whom they are addressed. If you are not the named
addressee or part of the entity, you should not disseminate, distribute, or
copy this email. Please notify the sender immediately by e-mail if you have
received this email by mistake and delete this e-mail from your system. If
you are not the intended recipient you are notified that disclosing,
copying, distributing, or taking any action in reliance on the contents of
this information is strictly prohibited.
_______________________________________________
dev-luatex mailing list -- [email protected]
To unsubscribe send an email to [email protected]