Replies: 8 comments 36 replies
-
@tbeason can you provide a example of somewhat problematic table that you have? |
Beta Was this translation helpful? Give feedback.
-
I tried this out and had the same result. Nothing when I include a LaTeX table in a qmd (or Rmd) file. I even tried
This makes no sense. Pandoc coverts simple LaTeX tables just fine to HTML. It is often used as a LaTeX to HTML coverter. @cscheid Any idea what's wrong? I don't think it's a Quarto specific issue as I saw it in R Markdown too. Pandoc knows how to convert LaTeX tables to HTML, but for some reason is not 'doing its magic' on them here. Usually it is pretty smart about dealing with LaTeX embedded in markdown. |
Beta Was this translation helpful? Give feedback.
-
Hmm, it seems to me that Both of these render fine to html and the
But yes, I would like Note the reason I find this interesting is that if a block like |
Beta Was this translation helpful? Give feedback.
-
I want to come back to
How are you getting these
Unfortunately, we don't control that syntax; Pandoc does.
Can you tell me about some of these new things? We've been thinking about a similar feature but we could only think of tables as a valid use case for it. |
Beta Was this translation helpful? Give feedback.
-
I believe that I understand what @tbeason and @eeholmes want and why this is "hard" to implement. They want to have Quarto/knitr/Jupyter generating the
and Pandoc create the internal structure
instead of
In other words, they want Pandoc to also convert the LaTeX or TeX raw blocks created when reading the input as Markdown to The best solution is the lua filter route suggested by @cscheid. Why does Pandoc process LaTeX equation but not LateX tables in Markdown?Render math in the web has being challenge since the creation of the web. W3C addopted MathML but all browsers didn't implemented it. The solution that people used for years was to have authors writing the equations in LaTeX and the server processing the LaTeX equations and create images. Recently, MathJax allowed LaTeX equations to be processed in the reader's web browser. Because of this, Pandoc's implements "special" support for LaTeX math part. For example, consider the following
The output of
Pandoc will keep all LaTeX math elements. Now compare it to the output of
Note that Pandoc removed the display (
Pandoc will use raw TeX block for the display math element. Today, most projects use MathJax, including Quarto, and the call to Pandoc is
With |
Beta Was this translation helpful? Give feedback.
-
We had a similar issue in a JOSS submission. Our solution was to parse all raw LaTeX blocks and inlines into pandoc's internal document format, except when we converting to/via LaTeX. I've published the filter as a quarto extension: tarleb/parse-latex. If I understand the discussion correctly, then this could be sufficient to resolve the issue: quarto install extension tarleb/parse-latex Then in the filters:
- parse-latex |
Beta Was this translation helpful? Give feedback.
-
@cscheid It was the cross-reference part that is not being used. The OP's question was about cross-references. I know there are probably other ways to do this for html but not for latex. ```{=html} #| label: tbl-one #| tbl-cap: This is table one. My point here was that, "oh, if this cross-ref syntax worked for html, then it should be easy to get this to work for latex by extending somehow the OP's lua filter." if I do this ```{r} #| label: tbl-one #| tbl-cap: This is table one. --code that outputs html or latex-- ``` Then the cross-reference works, but it doesn't work if I put the html or latex there raw. |
Beta Was this translation helpful? Give feedback.
-
Here is a test of @tarleb 's filter. @tbeason --- title: "test" format: html: default pdf: keep-tex: true editor: source filters: - parse-latex --- This is a reference to Table @tbl-one. ```{=latex} \begin{table} \caption{caption of table.}\label{tbl-one}% \begin{center} \begin{tabular}{ c c c } cell1 & cell2 & cell3 \\ cell4 & cell5 & cell6 \\ cell7 & cell8 & cell9 \end{tabular} \end{center} \end{table} ``` PDF output: Note if I use HTML output: |
Beta Was this translation helpful? Give feedback.
-
Markdown tables work well for simple tables. I also like the
@tbl-name
cross-reference ability provided by Quarto. However, I have some tables that are somewhat problematic to write using Markdown and have them look nice. I know I can just put the raw latex in the file, but then I lose the ability to reference it using the same syntax. Is there a way to hack things together so that I can still reference latex tables using the@
syntax?Beta Was this translation helpful? Give feedback.
All reactions