Weave.jl with texminted escapes LaTeX code


I am trying to start using Julia + LaTeX. I am familiar with R solution for integrating statistics into document typesetting with Sweave and have stumbled upon Weave.jl. For some reason, however, I am not getting an expected output while trying to execute following test document with weave:


\title{Julia Weave}




    \sin(x)&=x-{\frac{x^{3}}{3!}}+{\frac {x^{5}}{5!}}-{\frac {x^{7}}{7!}}+\cdots \\[8pt]
    &=\sum _{n=0}^{\infty }{\frac {(-1)^{n}}{(2n+1)!}}x^{2n+1}


The command I am using is weave("jlweave.jnw", informat="noweb", doctype="texminted"), the generated outputt however escapes all the LaTeX code, while successfully executing noweb code chunks. The tex document I am getting is:



       {   pdfauthor = {  },
           pdftitle={  },


{\textbackslash}documentclass[a4paper]\{article\} {\textbackslash}usepackage\{minted\} {\textbackslash}usepackage\{lipsum\}

{\textbackslash}title\{Julia Weave\} {\textbackslash}author\{Me\}



\begin{minted}[texcomments = true, mathescape, fontsize=\small, xleftmargin=0.5em]{julia}
\begin{minted}[texcomments = true, mathescape, fontsize=\small, xleftmargin=0.5em, frame = leftline]{text}

{\textbackslash}begin\{aligned\}     {\textbackslash}sin(x)\&=x-\{{\textbackslash}frac\{x\^{}\{3\}\}\{3!\}\}+\{{\textbackslash}frac \{x\^{}\{5\}\}\{5!\}\}-\{{\textbackslash}frac \{x\^{}\{7\}\}\{7!\}\}+{\textbackslash}cdots {\textbackslash}[8pt]     \&={\textbackslash}sum \_\{n=0\}\^{}\{{\textbackslash}infty \}\{{\textbackslash}frac \{(-1)\^{}\{n\}\}\{(2n+1)!\}\}x\^{}\{2n+1\} {\textbackslash}end\{aligned\}


The desired output would include the minted code block, executed by Julia, with LaTeX code unchanged.

Edit: I am using Julia v1.8.3 and Weave v0.10.9 on arm64 Mac.

Looking at the code of Weave the noweb option seems to be broken and deserted…
It just parses the document as markdown assuming different “noweb stule” delimiter for the julia code blocks.

This is an open bug: [BUG] texw example broken · Issue #412 · JunoLab/Weave.jl · GitHub

Seems that pinning Weave at 0.10.2 may be the solution until it is fixed.

1 Like

Thank you for the response!