# Weave.jl with texminted escapes LaTeX code

**URL:** <https://discourse.julialang.org/t/weave-jl-with-texminted-escapes-latex-code/91772>\
**Category:** New to Julia\
**Tags:** question, latex, weave\
**Created:** [December 17, 2022, 11:25am UTC](https://discourse.julialang.org/t/weave-jl-with-texminted-escapes-latex-code/91772 "2022-12-17T11:25:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![B1ochem1st](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/b1ochem1st/32/49542_2.png) [@B1ochem1st](https://discourse.julialang.org/u/B1ochem1st)\
**Post date:** [December 17, 2022, 11:25am UTC](https://discourse.julialang.org/t/weave-jl-with-texminted-escapes-latex-code/91772/1 "2022-12-17T11:25:00Z")

</div>

Hello,

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:

```julia
\documentclass[a4paper]{article}
\usepackage{minted}
\usepackage{lipsum}

\title{Julia Weave}
\author{Me}

\begin{document}

Test

<<>>=
sin(2+2)
@

\begin{aligned}
    \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}
\end{aligned}

\end{document}

```

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:

```julia
\documentclass[12pt,a4paper]{article}

\usepackage[a4paper,text={16.5cm,25.2cm},centering]{geometry}
\usepackage{lmodern}
\usepackage{amssymb,amsmath}
\usepackage{bm}
\usepackage{graphicx}
\usepackage{microtype}
\usepackage{hyperref}
\usepackage{minted}
\setlength{\parindent}{0pt}
\setlength{\parskip}{1.2ex}

\hypersetup
       { pdfauthor = { },
           pdftitle={ },
           colorlinks=TRUE,
           linkcolor=black,
           citecolor=blue,
           urlcolor=blue
       }

\begin{document}

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

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

{\textbackslash}begin\{document\}

Test

\begin{minted}[texcomments = true, mathescape, fontsize=\small, xleftmargin=0.5em]{julia}
sin(2+2)
\end{minted}
\begin{minted}[texcomments = true, mathescape, fontsize=\small, xleftmargin=0.5em, frame = leftline]{text}
-0.7568024953079282
\end{minted}

{\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\}

{\textbackslash}end\{document\}
\end{document}

```

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.

---

<div class="post-metadata">

**Author:** ![fedxa](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fedxa/32/488_2.png) [@fedxa](https://discourse.julialang.org/u/fedxa)\
**Post date:** [February 9, 2023, 11:34am UTC](https://discourse.julialang.org/t/weave-jl-with-texminted-escapes-latex-code/91772/2 "2023-02-09T11:34:01Z")

</div>

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](https://github.com/JunoLab/Weave.jl/issues/412)

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

---

<div class="post-metadata">

**Author:** ![B1ochem1st](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/b1ochem1st/32/49542_2.png) [@B1ochem1st](https://discourse.julialang.org/u/B1ochem1st)\
**Post date:** [February 9, 2023, 2:14pm UTC](https://discourse.julialang.org/t/weave-jl-with-texminted-escapes-latex-code/91772/3 "2023-02-09T14:14:00Z")

</div>

Thank you for the response!
