lvjr / tabularray

Typeset tabulars and arrays with LaTeX3
https://ctan.org/pkg/tabularray
259 stars 22 forks source link

Tables typeset by `longtblr` is interrupted by other floating environments #409

Open abbas-shams opened 1 year ago

abbas-shams commented 1 year ago

Tables typeset by longtblr is interrupted by other floating environments

Hi everybody,

When codes of a couple of floating environments (like figure) are written before a longtblr environment, there is a possibility that the long table is interrupted by those floating environments.

Long tables may start everywhere on the page of at the beginning (it's a matter of taste); but logically must be continued to the end without being interrupted by any object.

According to the below code, there are a couple of code lines for typesetting four figures and a long table. As a result, the table (made by tblr environment) is interrupted by three out of four figures.


Click to see the Minimal Code
```latex % This is to reveal a bug of `longtblr` environment. The issue is that tables % made by `longtblr` logically should be stopless continued to the end; while it % may be interrupted by another floating environment. \documentclass{article} \usepackage{tikz} \usepackage{tabularray} \begin{document} \begin{figure} \centering \begin{tikzpicture} \draw (0, 0) rectangle (12, 7); \draw (0, 0) -- (12, 7); \end{tikzpicture} \caption{The First Rectangle} \end{figure} \begin{figure} \centering \begin{tikzpicture} \draw (0, 0) rectangle (9, 7); \draw (0, 0) -- (9, 7); \end{tikzpicture} \caption{The Second Rectangle} \end{figure} \begin{figure} \centering \begin{tikzpicture} \draw (0, 0) rectangle (11, 11); \draw (0, 0) -- (11, 11); \end{tikzpicture} \caption{A Square} \end{figure} \begin{figure} \centering \begin{tikzpicture} \draw (0, 0) rectangle (4, 8); \draw (0, 0) -- (4, 8); \end{tikzpicture} \caption{The Third Rectangle} \end{figure} \begin{longtblr} [ caption = {List of Physics Scientists and Their Inventions}, note{a} = {This table summarizes some very important persons.}, note{$\star$} = {Albert Einstein was a famous physicist.}, note{$\dagger$} = {Pythagoras was an ancient philosophers and mathematician. His theorem is a fundamental relation in Euclidean geometry.}, note{$\ddagger$} = {Ibn Sina, commonly known in the West as Avicenna, is the father of early modern medicine.}, ] {hlines, vlines} Scientist Name & Discoveries & Year \\ Albert Einstein & Photon & 1905 \\ J.J.\ Thomson & Electron & 1897 \\ Ernest Rutherford & Proton & 1919 \\ John Dalton & Atom & 1808 \\ James Chadwick & Neutron & 1932 \\ Isaac Newton & Law of Motion & 1687 \\ Charles-Augustin de Coulomb & Coulomb & 1779 \\ Georg Simon Ohm & Ohm's Law & 1827 \\ Michael Faraday & Electromagnetic Induction & 1831 \\ Thomas Edison & Thermionic Emission & 1880 \\ Henri Becquerel & Radioactivity & 1896 \\ Marie Sklodowska-Curie & Radium & 1898 \\ Max Planck & Quantum theory & 1900 \\ Heinrich Rudolf Hertz & Photoelectric Effect & 1905 \\ R\"ontgen & X-Ray & 1895 \\ Albert Einstein & Relativity & 1905 \\ Neils Bohr \& Rutherford & Atomic Structure & 1913 \\ Enrico Fermi & Nuclear Reactor & 1942 \\ Scientist Name & Discoveries & Year \\ Albert Einstein & Photon & 1905 \\ J.J.\ Thomson & Electron & 1897 \\ Ernest Rutherford & Proton & 1919 \\ John Dalton & Atom & 1808 \\ James Chadwick & Neutron & 1932 \\ Isaac Newton & Law of Motion & 1687 \\ Charles-Augustin de Coulomb & Coulomb & 1779 \\ Georg Simon Ohm & Ohm's Law & 1827 \\ Michael Faraday & Electromagnetic Induction & 1831 \\ Thomas Edison & Thermionic Emission & 1880 \\ Henri Becquerel & Radioactivity & 1896 \\ Marie Sklodowska-Curie & Radium & 1898 \\ Max Planck & Quantum theory & 1900 \\ Heinrich Rudolf Hertz & Photoelectric Effect & 1905 \\ R\"ontgen & X-Ray & 1895 \\ Albert Einstein & Relativity & 1905 \\ Neils Bohr \& Rutherford & Atomic Structure & 1913 \\ Enrico Fermi & Nuclear Reactor & 1942 \\ Scientist Name & Discoveries & Year \\ Albert Einstein & Photon & 1905 \\ J.J.\ Thomson & Electron & 1897 \\ Ernest Rutherford & Proton & 1919 \\ John Dalton & Atom & 1808 \\ James Chadwick & Neutron & 1932 \\ Isaac Newton & Law of Motion & 1687 \\ Charles-Augustin de Coulomb & Coulomb & 1779 \\ Georg Simon Ohm & Ohm's Law & 1827 \\ Michael Faraday & Electromagnetic Induction & 1831 \\ Thomas Edison & Thermionic Emission & 1880 \\ Henri Becquerel & Radioactivity & 1896 \\ Marie Sklodowska-Curie & Radium & 1898 \\ Max Planck & Quantum theory & 1900 \\ Heinrich Rudolf Hertz & Photoelectric Effect & 1905 \\ R\"ontgen & X-Ray & 1895 \\ Albert Einstein & Relativity & 1905 \\ \end{longtblr} \end{document} ```

Click here to see the result: minimal-code.pdf

muzimuzhi commented 1 year ago

Hmm another example showing that the output routines of longtblr from tabularray package and longtable from longtable package are different. See also https://github.com/lvjr/tabularray/discussions/403#discussioncomment-5853962.

lvjr commented 1 year ago

The LaTeX format doesn't provide a public interface for clearing existing floats without creating a new page. Therefore tabularray can do nothing for this problem.