I apologize if this has been answered, but I can't find a simple way to do 
this. I'd like to be able to write LaTex code in the .jl file without 
escaping stuff AND be able to interpolate variables (Julia Version 0.4.0). 
It would look something like this:

a = 2
txt = """\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
   \draw (0,0) -- (2,0) node[anchor=west] {this line is 2 cm long.};
\end{tikzpicture}
\end{document}"""

Obviously, I get a lot of "ERROR: syntax: invalid escape sequence". If I 
try what Stefan Karpinski did here 
<https://groups.google.com/d/msg/julia-users/956hxyU03hc/qWuy9q-wStoJ>:

macro L_str(s)
   s
end
a = 2
txt = L"""\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
   \draw (0,0) -- ($a,0) node {this line is $a cm long.};
\end{tikzpicture}
\end{document}"""

The $a gets escaped as well, and I loose the interpolation. I realize that 
this is probably tricky, but it would be mighty sweet to have everything in 
just one file. 

Thanks in advance!


Reply via email to