-
Notifications
You must be signed in to change notification settings - Fork 391
crossref, latex - correctly table env for raw table produced by computations #12103
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
tests/docs/smoke-all/crossrefs/float/latex/latex-raw-table-env-3.qmd
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| --- | ||
| title: Crossref Raw LaTeX table with table env and position when produced by cell computation | ||
| format: pdf | ||
| keep-tex: true | ||
| _quarto: | ||
| tests: | ||
| pdf: | ||
| ensureLatexFileRegexMatches: | ||
| - ['\n\\begin\{table\}\n', 'See Table~\\ref\{tbl-test\}'] | ||
| - [] | ||
| --- | ||
|
|
||
| `\begin{table}` should be catched and remove as Quarto does add its own, when this produced from a cell | ||
|
|
||
| ## Example with Julia Cell | ||
|
|
||
| Derived https://github.com/quarto-dev/quarto-cli/issues/12085 | ||
|
|
||
| ::: {#tbl-test .cell execution_count=1} | ||
| ```` { .cell-code} | ||
| ```{{julia}} | ||
| #| label: tbl-test | ||
| #| output: asis | ||
| struct Latex | ||
| s::String | ||
| end | ||
|
|
||
| Base.show(io::IO, m::MIME"text/latex", l::Latex) = print(io, l.s) | ||
|
|
||
| Latex(raw""" | ||
| \begin{table} | ||
| \setlength\tabcolsep{0pt} | ||
| \centering | ||
| \begin{tabular}{@{\extracolsep{2ex}}*{5}{ccccc}} | ||
| \toprule | ||
| $\theta 1$ & $\theta 1$ & $\theta 1$ & $\theta 1$ & $\theta 1$ \\ | ||
| \midrule | ||
| $\theta 2$ & $\theta 2$ & $\theta 2$ & $\theta 2$ & $\theta 2$ \\ | ||
| $\theta 3$ & $\theta 3$ & $\theta 3$ & $\theta 3$ & $\theta 3$ \\ | ||
| $\theta 4$ & $\theta 4$ & $\theta 4$ & $\theta 4$ & $\theta 4$ \\ | ||
| $\theta 5$ & $\theta 5$ & $\theta 5$ & $\theta 5$ & $\theta 5$ \\ | ||
| \bottomrule | ||
| \end{tabular} | ||
| \end{table} | ||
| """) | ||
| ``` | ||
|
|
||
| ```` | ||
| ```{=tex} | ||
| \begin{table} | ||
| \setlength\tabcolsep{0pt} | ||
| \centering | ||
| \begin{tabular}{@{\extracolsep{2ex}}*{5}{ccccc}} | ||
| \toprule | ||
| $\theta 1$ & $\theta 1$ & $\theta 1$ & $\theta 1$ & $\theta 1$ \\ | ||
| \midrule | ||
| $\theta 2$ & $\theta 2$ & $\theta 2$ & $\theta 2$ & $\theta 2$ \\ | ||
| $\theta 3$ & $\theta 3$ & $\theta 3$ & $\theta 3$ & $\theta 3$ \\ | ||
| $\theta 4$ & $\theta 4$ & $\theta 4$ & $\theta 4$ & $\theta 4$ \\ | ||
| $\theta 5$ & $\theta 5$ & $\theta 5$ & $\theta 5$ & $\theta 5$ \\ | ||
| \bottomrule | ||
| \end{tabular} | ||
| \end{table} | ||
| ``` | ||
| ::: | ||
|
|
||
|
|
||
| See @tbl-test |
68 changes: 68 additions & 0 deletions
68
tests/docs/smoke-all/crossrefs/float/latex/latex-raw-table-env-4.qmd
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| --- | ||
| title: Crossref Raw LaTeX table with table env and position when produced by cell computation | ||
| format: pdf | ||
| keep-tex: true | ||
| _quarto: | ||
| tests: | ||
| pdf: | ||
| ensureLatexFileRegexMatches: | ||
| - ['\n\\begin\{table\}\n', 'See Table~\\ref\{tbl-test\}'] | ||
| - ['\\begin\{table\}[\!ht]'] | ||
| --- | ||
|
|
||
| `\begin{table}` should be catched and remove as Quarto does add its own, including when option position are used and when this produced from a cell | ||
|
|
||
| ## Example with Julia Cell | ||
|
|
||
| From https://github.com/quarto-dev/quarto-cli/issues/12085 | ||
|
|
||
| ::: {#tbl-test .cell execution_count=1} | ||
| ```` { .cell-code} | ||
| ```{{julia}} | ||
| #| label: tbl-test | ||
| #| output: asis | ||
| struct Latex | ||
| s::String | ||
| end | ||
|
|
||
| Base.show(io::IO, m::MIME"text/latex", l::Latex) = print(io, l.s) | ||
|
|
||
| Latex(raw""" | ||
| \begin{table}[!ht] | ||
| \setlength\tabcolsep{0pt} | ||
| \centering | ||
| \begin{tabular}{@{\extracolsep{2ex}}*{5}{ccccc}} | ||
| \toprule | ||
| $\theta 1$ & $\theta 1$ & $\theta 1$ & $\theta 1$ & $\theta 1$ \\ | ||
| \midrule | ||
| $\theta 2$ & $\theta 2$ & $\theta 2$ & $\theta 2$ & $\theta 2$ \\ | ||
| $\theta 3$ & $\theta 3$ & $\theta 3$ & $\theta 3$ & $\theta 3$ \\ | ||
| $\theta 4$ & $\theta 4$ & $\theta 4$ & $\theta 4$ & $\theta 4$ \\ | ||
| $\theta 5$ & $\theta 5$ & $\theta 5$ & $\theta 5$ & $\theta 5$ \\ | ||
| \bottomrule | ||
| \end{tabular} | ||
| \end{table} | ||
| """) | ||
| ``` | ||
|
|
||
| ```` | ||
| ```{=tex} | ||
| \begin{table}[!ht] | ||
| \setlength\tabcolsep{0pt} | ||
| \centering | ||
| \begin{tabular}{@{\extracolsep{2ex}}*{5}{ccccc}} | ||
| \toprule | ||
| $\theta 1$ & $\theta 1$ & $\theta 1$ & $\theta 1$ & $\theta 1$ \\ | ||
| \midrule | ||
| $\theta 2$ & $\theta 2$ & $\theta 2$ & $\theta 2$ & $\theta 2$ \\ | ||
| $\theta 3$ & $\theta 3$ & $\theta 3$ & $\theta 3$ & $\theta 3$ \\ | ||
| $\theta 4$ & $\theta 4$ & $\theta 4$ & $\theta 4$ & $\theta 4$ \\ | ||
| $\theta 5$ & $\theta 5$ & $\theta 5$ & $\theta 5$ & $\theta 5$ \\ | ||
| \bottomrule | ||
| \end{tabular} | ||
| \end{table} | ||
| ``` | ||
| ::: | ||
|
|
||
|
|
||
| See @tbl-test |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cscheid unrelated to this PR but I added this note because while debugging, I found that we don't go there as
tbl-prefixed id will always be matched byisFigureDiv()So I figured we should remove this part, but for now at least mark it as stale to avoid spending much time wondering if we go there at next debugging.
Hopefully the fact that
isTableDiv()is now no more useful whenisFigureDiv()is used before is expected.Though, it may not as the
isFigureDiv()is used to do a fixup on nestedImage- maybe we don't want do that on all type of crossref ?For reference
isFigureDiv()isquarto-cli/src/resources/filters/common/figures.lua
Lines 37 to 50 in d9319b8
and uses
hasFigureRef()usingisFigureRef()quarto-cli/src/resources/filters/common/refs.lua
Lines 7 to 19 in d9319b8
where
isFigureRef()matches all known crossref type.Sharing in case this is raising question to you too. I added as topic for next Thursday meeting as not urgent. I can merge current PR with the note, and remove it later if necessary