quarto-dev / quarto-cli

Open-source scientific and technical publishing system built on Pandoc.
https://quarto.org
Other
3.82k stars 309 forks source link

`equation` environment under `$$` #9366

Open likanzhan opened 5 months ago

likanzhan commented 5 months ago

Bug description

My qmd file contains a julia code cell, and the output of the cell is a equation environment. When I rendered it into a html file, it works correctly. But when I rendered it into a latex file, it creates a latex file with the following environment

$$
\begin{equation}
ZZZ
\end{equation}
$$

When I render a latex file containing such blocks, it gives an error.

Steps to reproduce


```{julia}
using Symbolics
Symbolics.variables(:x, 1:3)

### Expected behavior

```latex

\begin{equation}
\left[
\begin{array}{c}
x_1 \\
x_2 \\
x_3 \\
\end{array}
\right]
\end{equation}

Actual behavior


$$ \begin{equation}
\left[
\begin{array}{c}
x_1 \\
x_2 \\
x_3 \\
\end{array}
\right]
\end{equation}
 $$

Your environment

No response

Quarto check output

Quarto 1.4.553 [✓] Checking versions of quarto binary dependencies... Pandoc version 3.1.11: OK Dart Sass version 1.69.5: OK Deno version 1.37.2: OK [✓] Checking versions of quarto dependencies......OK [✓] Checking Quarto installation......OK Version: 1.4.553 Path: /Applications/quarto/bin

[✓] Checking tools....................OK TinyTeX: (external install) Chromium: (not installed)

[✓] Checking LaTeX....................OK Using: TinyTex Path: /Users/likanzhan/Library/TinyTeX/bin/universal-darwin Version: 2024

[✓] Checking basic markdown render....OK

[✓] Checking Python 3 installation....OK Version: 3.10.13 (Conda) Path: /Users/likanzhan/.julia/conda/3/aarch64/bin/python Jupyter: 5.7.1 Kernels: julia-1.10, python3

[✓] Checking Jupyter engine render....OK

[✓] Checking R installation...........OK Version: 4.3.1 Path: /Library/Frameworks/R.framework/Resources LibPaths:

[✓] Checking Knitr engine render......OK

mcanouil commented 5 months ago

Symbolics.jl/Jupyter is the one emitting this bad code.

{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$$ \\begin{equation}\n",
       "\\left[\n",
       "\\begin{array}{c}\n",
       "x_1 \\\\\n",
       "x_2 \\\\\n",
       "x_3 \\\\\n",
       "\\end{array}\n",
       "\\right]\n",
       "\\end{equation}\n",
       " $$"
      ],
      "text/plain": [
       "3-element Vector{Num}:\n",
       " x₁\n",
       " x₂\n",
       " x₃"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "using Symbolics\n",
    "Symbolics.variables(:x, 1:3)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Julia 1.10.0",
   "language": "julia",
   "name": "julia-1.10"
  },
  "language_info": {
   "file_extension": ".jl",
   "mimetype": "application/julia",
   "name": "julia",
   "version": "1.10.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
JupyterJulia
````qmd --- title: "Quarto Playground" format: pdf engine: julia --- This is a playground for Quarto. ```{julia} using Symbolics Symbolics.variables(:x, 1:3) ``` ```` ````qmd --- title: "Quarto Playground" format: pdf engine: jupyter jupyter: julia-1.10 --- This is a playground for Quarto. ```{julia} using Symbolics Symbolics.variables(:x, 1:3) ``` ````