%%
%% This is file `minimalist/minimalist.sty',
%% generated with the docstrip utility.
%%
%% Copyright (C) 2021-2023 by Jinwen XU
%% 
%% This is part of the minimalist class series.
%% 
%% This work may be distributed and/or modified under the conditions of the
%% LaTeX Project Public License, either version 1.3c of this license or (at
%% your option) any later version. The latest version of this license is in
%% 
%%     http://www.latex-project.org/lppl.txt
%% 
%% and version 1.3c or later is part of all distributions of LaTeX version
%% 2005/12/01 or later.
%% 
\NeedsTeXFormat{LaTeX2e}[2022-06-01]
\ProvidesExplPackage
  {minimalist}
  {2023/07/14} {}
  {A simple and clear style for articles and books}

\keys_define:nn { minimalist }
  {
    , draft             .bool_set:N         = \l__minimalist_fast_bool
    , draft             .initial:n          = { false }
    , fast              .bool_set:N         = \l__minimalist_fast_bool

    , style             .str_set:N          = \l__minimalist_style_str
    , style             .initial:n          = { plain }
    , use-style         .str_set:N          = \l__minimalist_style_str
    , use~style         .str_set:N          = \l__minimalist_style_str
    , use style         .str_set:N          = \l__minimalist_style_str
    , classical         .meta:n             = { style = classical }
    , flow              .meta:n             = { style = flow      }
    , stream            .meta:n             = { style = stream    }

    , use-boldface      .bool_set:N         = \l__minimalist_use_boldface_bool
    , use-boldface      .initial:n          = { false }
    , use~boldface      .bool_set:N         = \l__minimalist_use_boldface_bool
    , use boldface      .bool_set:N         = \l__minimalist_use_boldface_bool
    , title-in-boldface .bool_set:N         = \l__minimalist_use_boldface_bool
    , title~in~boldface .bool_set:N         = \l__minimalist_use_boldface_bool
    , title in boldface .bool_set:N         = \l__minimalist_use_boldface_bool
    , title-in-bold     .bool_set:N         = \l__minimalist_use_boldface_bool
    , title~in~bold     .bool_set:N         = \l__minimalist_use_boldface_bool
    , title in bold     .bool_set:N         = \l__minimalist_use_boldface_bool

    , use-sffamily       .bool_set:N        = \l__minimalist_use_sffamily_bool
    , use-sffamily       .initial:n         = { false }
    , use~sffamily       .bool_set:N        = \l__minimalist_use_sffamily_bool
    , use sffamily       .bool_set:N        = \l__minimalist_use_sffamily_bool
    , title-in-sffamily  .bool_set:N        = \l__minimalist_use_sffamily_bool
    , title~in~sffamily  .bool_set:N        = \l__minimalist_use_sffamily_bool
    , title in sffamily  .bool_set:N        = \l__minimalist_use_sffamily_bool

    , use-scshape       .bool_set:N         = \l__minimalist_use_scshape_bool
    , use-scshape       .initial:n          = { false }
    , use~scshape       .bool_set:N         = \l__minimalist_use_scshape_bool
    , use scshape       .bool_set:N         = \l__minimalist_use_scshape_bool
    , title-in-scshape  .bool_set:N         = \l__minimalist_use_scshape_bool
    , title~in~scshape  .bool_set:N         = \l__minimalist_use_scshape_bool
    , title in scshape  .bool_set:N         = \l__minimalist_use_scshape_bool

    , runin             .bool_set:N         = \l__minimalist_runin_bool
    , runin             .initial:n          = { false }

    , theorem-in-new-line .bool_set:N       = \l__minimalist_theorem_in_new_line_bool
    , theorem-in-new-line .initial:n        = { false }
    , theorem~in~new~line .bool_set:N       = \l__minimalist_theorem_in_new_line_bool
    , theorem in new line .bool_set:N       = \l__minimalist_theorem_in_new_line_bool

    , colored-proof     .tl_set:N           = \l__minimalist_colored_proof_tl
    , colored-proof     .initial:n          = { * }
    , colored-proof     .default:n          = { blue!50!cyan!55!main-text }
    , colored~proof     .tl_set:N           = \l__minimalist_colored_proof_tl
    , colored~proof     .initial:n          = { * }
    , colored~proof     .default:n          = { blue!50!cyan!55!main-text }
    , colored proof     .tl_set:N           = \l__minimalist_colored_proof_tl
    , colored proof     .initial:n          = { * }
    , colored proof     .default:n          = { blue!50!cyan!55!main-text }

    , unknown           .code:n             = {
                                                \PassOptionsToPackage { \CurrentOption } { projlib-language }
                                                \PassOptionsToPackage { \CurrentOption } { projlib-author }
                                                \PassOptionsToPackage { \CurrentOption } { projlib-datetime }
                                                \PassOptionsToPackage { \CurrentOption } { projlib-draft }
                                                \PassOptionsToPackage { \CurrentOption } { projlib-font }
                                                \PassOptionsToPackage { \CurrentOption } { projlib-logo }
                                                \PassOptionsToPackage { \CurrentOption } { projlib-math }
                                                \PassOptionsToPackage { \CurrentOption } { projlib-paper }
                                                \PassOptionsToPackage { \CurrentOption } { projlib-theorem }
                                              }
  }
\ProcessKeyOptions [ minimalist ]

\bool_new:N \l__minimalist_is_book_bool
\cs_if_exist:cTF { c@chapter }
  {
    \bool_set_true:N \l__minimalist_is_book_bool
  }
  {
    \bool_set_false:N \l__minimalist_is_book_bool
  }

%%================================
%%  Line numbers
%%================================
\PassOptionsToPackage { pagewise,mathlines } { lineno }
\RequirePackage { amsmath }
\RequirePackage { lineno }
\renewcommand{\linenumberfont}{\ttfamily\color{main-text!7!paper}\footnotesize}
\setlength{\linenumbersep}{1em}

\newif\ifLNturnsON
\def\LocallyStopLineNumbers{\LNturnsONfalse
    \ifLineNumbers\LNturnsONtrue\fi\nolinenumbers}
\def\ResumeLineNumbers{\ifLNturnsON\linenumbers\fi}

\hook_gput_code:nnn { cmd/tableofcontents/before } { minimalist } { \LocallyStopLineNumbers }
\hook_gput_code:nnn { cmd/tableofcontents/after } { minimalist } { \ResumeLineNumbers }
\hook_gput_code:nnn { env/bibliography/before } { minimalist } { \LocallyStopLineNumbers }
\hook_gput_code:nnn { env/bibliography/after } { minimalist } { \ResumeLineNumbers }

%%================================
%%  Paper configuration
%%================================
\RequirePackage { projlib-paper }

%%================================
%%  Multi-language support
%%================================
\RequirePackage { projlib-language }

%%================================
%%  Loading the style
%%================================
\exp_args:No \RequirePackage { minimalist- \l__minimalist_style_str }

\endinput
%%
%% End of file `minimalist/minimalist.sty'.
