Weave.jl icon indicating copy to clipboard operation
Weave.jl copied to clipboard

LaTeX (text mode) commands

Open EvoArt opened this issue 3 years ago • 2 comments

Hi there Is it possible to iput text in a .jmd and have it included verbatim in a generated .tex file? e.g. I use a custom template with tufte.sty and it would be great to be able to type \sidenote{some cool fact} and have the side note appear in my pdf.

EvoArt avatar Jun 06 '22 23:06 EvoArt

I would love to see 'Tufte style' listed in list_out_formats, but I imagine that Julia Mardown needs to support it first (?)

Maybe someone knows how to create Tufte with Weaver.jl could post a minimal working example here.

NoelAraujo avatar Jul 06 '22 01:07 NoelAraujo

I have a custom template like this

\documentclass{tufte-handout}

\usepackage{geometry}
\usepackage{lmodern}
\usepackage{sourcecodepro}
\usepackage{amssymb,amsmath}
\usepackage{bm}
\usepackage{graphicx}
\usepackage{microtype}
\usepackage{hyperref}
\usepackage{listings}
\usepackage{color}
\definecolor{lbcolor}{rgb}{1,1,0.95} 
\lstset{frameround=fttt,
	frame=trBL,
    basicstyle=\sourcecodepro\footnotesize,
    upquote=true,
    breaklines=true,
    breakindent=0pt,
    keepspaces=true,
    showspaces=false,
    columns=fullflexible,
    showtabs=false,
    showstringspaces=false,
    escapeinside={(*@}{@*)},
    extendedchars=true,
    backgroundcolor=\color{lbcolor}
}
{{#:tex_deps}}
{{{ :tex_deps }}}
{{/:tex_deps}}
\setlength{\parindent}{0pt}
\setlength{\parskip}{1.2ex}

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

{{#:title}}
\title{ {{{ :title }}} }
{{/:title}}

{{#:author}}
\author{ {{{ :author }}} }
{{/:author}}

{{#:date}}
\date{ {{{ :date }}} }
{{/:date}}

{{ :highlight }}

\begin{document}

{{#:title}}\maketitle{{/:title}}

{{{ :body }}}

\end{document}

and call weave like so

weave("my_doc.jmd", template = "custom.tpl", doctype = "md2pdf")

margin figures can be included:

```julia, fig_env = "marginfigure", fig_pos = "-1cm",fig_cap = "Plot of x and y."
plot(x,y)

Only works if you include fig_pos

Obviously, you need to install tufte.sty for this to work.

Not sure how to do sidenotes, but Julia Markdown would not need to support it. Just needs some way to tell Weave to pass on the raw LaTeX command to pdflatex, I think.

EvoArt avatar Jul 06 '22 11:07 EvoArt