Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tbl-pos is ignored when set with layout-ncol on a crossref divs #10001

Closed
cderv opened this issue Jun 13, 2024 Discussed in #10000 · 1 comment · Fixed by #11180
Closed

tbl-pos is ignored when set with layout-ncol on a crossref divs #10001

cderv opened this issue Jun 13, 2024 Discussed in #10000 · 1 comment · Fixed by #11180
Assignees
Labels
bug Something isn't working crossref latex LaTeX engines related libraries and technologies layout triaged-to Issues that were not self-assigned, signals that an issue was assigned to someone.
Milestone

Comments

@cderv
Copy link
Collaborator

cderv commented Jun 13, 2024

Discussed in #10000

Originally posted by friosavila June 13, 2024
Hi,
I think i found a bug when trying to created multiple tables and render them into latex.

Here the example

---
title: "Untitled"
format: 
    pdf:
        header-includes: | 
            \usepackage{lipsum}
---

## Case 1

\lipsum[1-2]

:::{#tbl-tm1 tbl-pos="H"}
| A | B | C |
|---|---|---|
| 1 | 2 | 3 |

Nice Table: Right where it belongs
:::
\lipsum[1-2]

## Case 2

\lipsum[1-2]

:::{#tbl-tm2 tbl-pos="H" layout-ncol="2"}

:::{#tbl-tm2a}
| A | B | C |
|---|---|---|
| 1 | 2 | 3 |

Table1: 
:::

:::{#tbl-tm2b}
| A | B | C |
|---|---|---|
| 1 | 2 | 3 |

Table2: 
:::

Not so nice: Where Latex Wants it
:::

\lipsum[1-2]

Interestingly, this doesn't happen if i do not use layout-ncol="2".

For Reference, I'm using Quarto 1.4.554

and here the rendered Document
Untitled-3.pdf

@cderv cderv added the latex LaTeX engines related libraries and technologies label Jun 13, 2024
@cderv
Copy link
Collaborator Author

cderv commented Jun 13, 2024

Putting back example I shared

It seems to be related to tbl-pos handling.

---
title: "Untitled"
format: pdf
keep-tex: true
---

## Case 1

{{< lipsum 1 >}}

:::{#tbl-tm tbl-pos="H"}

:::{#tbl-tma}
| A | B | C |
|---|---|---|
| 1 | 2 | 3 |

Table1: 
:::

:::{#tbl-tmb}
| A | B | C |
|---|---|---|
| 1 | 2 | 3 |

Table2: 
:::

This table as `tbl-pos`
:::

{{< lipsum 1-2 >}}

:::{#tbl-tm2 tbl-pos="H"}

::: {layout-ncol=2}

:::{#tbl-tm2a}
| A | B | C |
|---|---|---|
| 1 | 2 | 3 |

Table1: 
:::

:::{#tbl-tm2b}
| A | B | C |
|---|---|---|
| 1 | 2 | 3 |

Table2: 
:::
:::

This table also as `tbl-pos` an a layout
:::

{{< lipsum 1-2 >}}

:::{#tbl-tm3 tbl-pos="H" layout-ncol=2}

:::{#tbl-tm3a}
| A | B | C |
|---|---|---|
| 1 | 2 | 3 |

Table1: 
:::

:::{#tbl-tm3b}
| A | B | C |
|---|---|---|
| 1 | 2 | 3 |

Table2: 
:::

This table as lost `tbl-pos`
:::
  • First table have \begin{table}[H]
  • Second table also have \begin{table}[H]
  • But latest one does not : \begin{table}

It seems the latest syntax should be working... 🤔

but it seems we are only considering fig-pos on Panel and not tbl-pos

-- determine the environment (and pos) to use for a latex panel
function latexPanelEnv(layout)
-- defaults
local env = latexFigureEnv(layout)
local pos = attribute(layout.float or { attributes = layout.attributes or {} }, kFigPos)
return env, pos
end

So this works

---
title: "Untitled"
format: pdf
keep-tex: true
---

## Case 1

{{< lipsum 1-2 >}}

:::{#tbl-tm3 fig-pos="H" layout-ncol=2}

:::{#tbl-tm3a}
| A | B | C |
|---|---|---|
| 1 | 2 | 3 |

Table1: 
:::

:::{#tbl-tm3b}
| A | B | C |
|---|---|---|
| 1 | 2 | 3 |

Table2: 
:::

This table as lost `tbl-pos`
:::

{{< lipsum 1-2 >}}
 

I think we should compute based on the prefix of the float ref
Like in here:

-- Computes the figure position for a figure environment
-- margin figures use offset instead of position
function latexFigurePosition(el, env)
if env == kMarginFigureEnv then
return attribute(el, kOffset, nil)
else
local prefix
if el.t == "FloatRefTarget" then
prefix = ref_type_from_float(el)
else
prefix = refType(el.identifier) or "fig"
end
return attribute(el, prefix .. "-pos", nil)
end
end

@cderv cderv added crossref triaged-to Issues that were not self-assigned, signals that an issue was assigned to someone. layout labels Jun 13, 2024
@cscheid cscheid added the bug Something isn't working label Jun 17, 2024
@cscheid cscheid added this to the v1.6 milestone Jun 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working crossref latex LaTeX engines related libraries and technologies layout triaged-to Issues that were not self-assigned, signals that an issue was assigned to someone.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants