module Mimikkyu

using Printf, LaTeXStrings

import PyPlot as plt

export @L_str, init_rc!,
       save_pdf, save_png,
       xticks!, yticks!, zticks!

function init_rc!()
    rcParams = plt.PyDict(plt.matplotlib."rcParams")
    pgfpreamble = string("\\usepackage{siunitx}",
                         "\\usepackage{mhchem}",
                         "\\usepackage{unicode-math}",
                         "\\setmainfont{XITS}",
                         "\\setmathfont{XITS Math}")
    # Latex
    rcParams["pgf.rcfonts"] = false
    rcParams["pgf.preamble"] = pgfpreamble
    rcParams["text.usetex"] = true
    rcParams["text.latex.preamble"] = "\\usepackage{siunitx}\\usepackage{mhchem}"
    # Font
    rcParams["font.size"] = 14
    rcParams["font.family"] = "serif"
    # Axes
    rcParams["axes.linewidth"] = 1.5
    rcParams["xtick.major.width"] = 1.5
    rcParams["ytick.major.width"] = 1.5
    # Grid
    rcParams["grid.alpha"] = 0.5
    rcParams["grid.linewidth"] = 1.5
    # Lines
    rcParams["lines.linewidth"] = 2.0
    # Legend
    rcParams["legend.framealpha"] = 0.0
    return nothing
end

include("./ticks.jl")

save_pdf(f::String, fig) = fig.savefig(f, format="pdf", dpi=600, backend="pgf")
save_png(f::String, fig) = fig.savefig(f, format="png", dpi=600, backend="pgf")

end # module
