Skip to content

Instantly share code, notes, and snippets.

@uni9k
Last active November 5, 2020 06:27
Show Gist options
  • Select an option

  • Save uni9k/38c173ba002f7ddfb74c8ad48b5b1159 to your computer and use it in GitHub Desktop.

Select an option

Save uni9k/38c173ba002f7ddfb74c8ad48b5b1159 to your computer and use it in GitHub Desktop.
Julia-lang style definition for LaTeX Listings.
%% Julia definition (c) 2020 Daichi Furukawa
%%
\lstdefinelanguage{Julia}{%
morekeywords={abstract, ans, baremodule, begin, break, const, continue, do,%
elseif, else, end, export, finally, for, function, global, if, import,%
let, local, macro, module, mutable, primitive, quote, return, struct, try,%
type, using, var, where, while},%
% Types
morekeywords=[2]{Any, Array, Bool, BigInt, BigFloat, Char, DataType, Enum,%
Expr, Float16, Float32, Float64, Function, Inf, Inf16, Inf32, Int8, Int16,%
Int32, Int64, Int128, Matrix, Missing, Module, Nan, NaN16, NaN32, Nothing,%
Some, Symbol, Tuple, Type, UInt8, UInt16, UInt32, UInt64, UInt128, Union,%
UnionAll, Val, Vararg, Vector, VecOrMat, im},%
% Constants
morekeywords=[3]{ARGS, C_NULL, DEPOT_PATH, ENDIAN_BOM, ENV, LOAD_PATH,%
PROGRAM_FILE, Sys.ARCH, Sys.BINDIR, Sys.CPU_THREADS, Sys.KERNEL,%
Sys.MACHINE, Sys.WORD_SIZE, false, stderr, stdin, stdout, true, missing, nothing},%
% Macros
morekeywords=[4]{@NamedTuple, @allocated, @assert, @boundscheck, @deprecate,%
@elapsed, @enum, @eval, @generated, @gensym, @goto, @isdefined, @inbouds,%
@inline, @label, @noinline, @nospecialize, @polly, @propagate_inbounds,%
@pure, @specialize, @simd, @time, @timed, @timev, @static, @v_str, @view,%
@views},%
sensitive=true,%
morecomment=[l]\#,%
morestring=[b]',%
morestring=[b]",%
morecomment=[s]{"""}{"""},% used for documentation text
% (mulitiline strings)
morestring=[s]{r"}{"},% regular expression literal
morestring=[s]{r"""}{"""},%
morestring=[s]{raw"}{"},% raw string literals
morestring=[s]{raw"""}{"""},%
morestring=[s]{L"}{"},% LaTeX strings
morestring=[s]{L"""}{"""}%
}%
@uni9k
Copy link
Author

uni9k commented Nov 2, 2020

Please add this definition to your own style file or preamble.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment