JunoLab / Weave.jl

Scientific reports/literate programming for Julia
http://weavejl.mpastell.com
MIT License
823 stars 94 forks source link

[BUG] `tex` output format #395

Open awellis opened 3 years ago

awellis commented 3 years ago

Duplicate of #391

description

I few months ago, I was using the following head to produce a plain tex file, i.e. without a preamble (I want to use the tex file in a LaTeX document).

---
weave_options:
    fig_ext: .pdf
    fig_pos: "!h"
    fig_env: "figure"
    doctype: "tex"
    out_path: :pwd
---

and then I used weave like so:

weave("figure-01.jmd", informat = "noweb")

Is it still possible to produce a plain tex file?

versions

using InteractiveUtils; versioninfo():

Julia Version 1.5.1
Commit 697e782ab8 (2020-08-25 20:08 UTC)
Platform Info:
OS: macOS (x86_64-apple-darwin19.5.0)
CPU: Intel(R) Core(TM) i7-8559U CPU @ 2.70GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-9.0.1 (ORCJIT, skylake)
Environment:
JULIA_EDITOR = "/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code"
JULIA_NUM_THREADS = 4

using Pkg; Pkg.status():

Status `~/.julia/environments/v1.5/Project.toml`
[0c46a032] DifferentialEquations v6.15.0
[31c24e10] Distributions v0.23.8
[5fb14364] OhMyREPL v0.5.8
[91a5bcdd] Plots v1.6.4
[612083be] Queryverse v0.6.2
[295af30f] Revise v2.7.5
[f3b207a7] StatsPlots v0.14.13
[fce5fe82] Turing v0.14.2
[112f6efa] VegaLite v2.3.0
[44d3d7a6] Weave v0.10.3
[b77e0a4c] InteractiveUtils

minimum reproducible steps

Create a jmd file containing the following:

---
weave_options:
    fig_ext: .pdf
    fig_pos: "!h"
    fig_env: "figure"
    doctype: "tex"
    out_path: :pwd
---

```julia; echo = false; label = "fig:myfig"; fig_cap = "This is a caption"
using Plots
gr()
plot(sin, -π, π)

and use weave():


```julia
weave("figure-01.jmd", informat = "noweb")

This should produce a .tex. file containing

\begin{figure}[!h]
\center
\includegraphics[width=\linewidth]{figures/julia-test_myfig_1.pdf}
\caption{This is a caption}
\label{fig:myfig}
\end{figure}