I use Lyx as my text editing tool, but found that all Greek letters disappeared after I inserted a block of Julia code in my lyx file.
I want to ask if anyone knows how to insert Julia code without losing Greek letters.
I use Lyx as my text editing tool, but found that all Greek letters disappeared after I inserted a block of Julia code in my lyx file.
I want to ask if anyone knows how to insert Julia code without losing Greek letters.
The best way I’ve found is to include the source file with Minted, with XeTeX as the processor. This lets you keep all the nice UTF8 goodness and gives you properly-highlighted output.
LaTeX (XeTeX) -> PDF (XeTeX)
and change the converter to xelatex -shell-escape $$i
, with the extra flag latex=xelatex
\usepackage[cache=false]{minted}
\inputminted[fontsize=\footnotesize,breaklines,linenos]{julia}{/full/path/to/file.jl}
View PDF (XeTeX)
Thanks for your reply. I would like to know if it is possible to do it like this in Lyx:
Insert - Box - Programming Listing - Julia
I could not find Julia in the options, so I have to use Matlab since they have similar syntax. Is there any way I could download the Julia Programming Listing Package for Lyx?
If you want to use the Listings package, you’ll need to include the following in your document preamble:
\usepackage{listings}
\usepackage[usenames,dvipsnames]{xcolor}
%%
%% Julia definition (c) 2014 Jubobs
%%
\lstdefinelanguage{Julia}%
{morekeywords={abstract,break,case,catch,const,continue,do,else,elseif,%
end,export,false,for,function,immutable,import,importall,if,in,%
macro,module,otherwise,quote,return,switch,true,try,type,typealias,%
using,while},%
sensitive=true,%
alsoother={$},%
morecomment=[l]\#,%
morecomment=[n]{\#=}{=\#},%
morestring=[s]{"}{"},%
morestring=[m]{'}{'},%
}[keywords,comments,strings]%
\lstset{%
language = Julia,
basicstyle = \ttfamily\footnotesize,
keywordstyle = \bfseries\color{blue},
stringstyle = \color{magenta},
commentstyle = \color{ForestGreen},
showstringspaces = false,
}