# What would it take to create juliatex?

In analogy to pythontex, what would it take to create juliatex?

• pythontex exists. What I'm asking is what would have to be done to create a LaTeX extension that would have the same functionality as pythontex but uses julia instead of python. – JPi Jun 23 '17 at 0:43
• According to the pythontex documentation, it has already been done, so the answer to the question is "it takes nothing". – alephzero Jun 23 '17 at 0:46
• I've removed it..... – JPi Jun 23 '17 at 1:05
• @alephzero It seems like that should be turned into an answer. – Alan Munn Jun 23 '17 at 1:13
• @alephzero I'd accept your comment as an answer, though I'd appreciate a short example. – JPi Jun 23 '17 at 1:19

(If alephzero posts an answer, I'll accept his/hers)

But here goes:

\documentclass{article}

\usepackage{fontspec}
\usepackage[usefamily=julia]{pythontex}

\begin{document}

\begin{juliacode}
using LaTeXStrings
println(L"y=x'\beta+u")
\end{juliacode}

\end{document}


Compile using lualatex, then pythontex, then lualatex. Ha!

EDIT

A second, somewhat more sophisticated example:

\documentclass{article}

\usepackage{fontspec}
\usepackage[usefamily=julia]{pythontex}

\begin{document}

\begin{juliacode}
srand(1)
n=100
X=[ones(n) randn(n)]
y=X* [1.0;2.0] +randn(n)*3.0
b=X\y
println("OLS regression coefficients=",round(b,2))
\end{juliacode}

\end{document}


• Can you please show us something concise, but more useful, julia could do for us? – marsupilam Jun 23 '17 at 12:12
• Will try to put something in later. – JPi Jun 23 '17 at 15:04
• @marsupilam done – JPi Jun 23 '17 at 15:39