%! TEX program = xelatex
\PassOptionsToPackage{dvipsnames}{xcolor}
\documentclass{minimart}

\linenumbers % Enable line numbers

%%================================
%% TeX logo and URL
%%================================
\usepackage{hologo}
\usepackage{url}

%%================================
%% For typestting code
%%================================
\usepackage{listings}
\definecolor{lightergray}{gray}{0.99}
\lstset{language=[LaTeX]TeX,
    keywordstyle=\color{RoyalBlue},
    basicstyle=\ttfamily,
    commentstyle=\color{ForestGreen}\ttfamily,
    stringstyle=\rmfamily,
    showstringspaces=false,
    breaklines=true,
    frame=lines,
    backgroundcolor=\color{lightergray},
    flexiblecolumns=true,
    escapeinside={(*}{*)},
    % numbers=left,
    numberstyle=\scriptsize, stepnumber=1, numbersep=5pt,
    firstnumber=last,
} 
\providecommand{\meta}[1]{$\langle${\normalfont\itshape#1}$\rangle$}
\lstset{morekeywords=%
    {CreateTheorem,proofideanameEN,cref,dnf,needgraph,UseLanguage,
    linenumbers,nolinenumbers,subsection,maketitle
    }
}
\lstnewenvironment{code}% 
{\LocallyStopLineNumbers%
\setkeys{lst}{columns=fullflexible,keepspaces=true}%
}
{\ResumeLineNumbers}

\providecommand{\minimalist}{\textsf{minimalist}}
\providecommand{\minimart}{\textsf{minimart}}
\providecommand{\minimbook}{\textsf{minimbook}}
\providecommand{\einfart}{\textsf{einfart}}
\providecommand{\simplivre}{\textsf{simplivre}}

%%================================
%% Main text
%%================================
\begin{document}

\title{\minimalist{}, write your articles or books in a simple and clear way\thanks{Corresponding to: \texttt{\minimalist{} 2021/03/15}}}
\author{Jinwen}
\date{March 2021, Beijing}

\maketitle

\begin{abstract}
    \minimalist{} is series of styles and classes for you to typeset your articles or books in a simple and clear manner. My original intention in designing this series was to write drafts and notes that look simple but not shabby.
    
    The entire collection includes \verb|minimalist.sty|, which is the main style shared by all the following classes; \verb|minimart.cls| for typesetting articles and \verb|minimbook.cls| for typesetting books. They can be used with all LaTeX engines, with native support to English and French typesetting via \lstinline|\UseLanguage|, see the instruction below for detail.

    You can also found \einfart{} and \simplivre{} on CTAN. They are the enhanced version of \minimart{} and \minimbook{} with unicode support. With this, they can access to more beautiful fonts, and also have native support for Chinese typesetting. On the other hand, they need to be compiled with \hologo{XeLaTeX} or \hologo{LuaLaTeX} (not pdf\LaTeX).
    
    This documentation is typeset using \minimart{}. You can think of it as a short introduction and demonstration.
\end{abstract}

\tableofcontents

\section{How to load it}
You can directly use \minimart{} or \minimbook{} as your document class. In this way, you can directly begin writing your document, without having to worry about the configurations.

\begin{code}
  \documentclass{minimart} (*{\normalfont or}*) \documentclass{minimbook}
\end{code}

And of course, you can also use the default classes \textsf{article} or \textsf{book}, and load the \minimalist{} package. This way, only the basic styles are set, and you can thus use your preferred fonts and page layout. All the features mentioned in this article (except for draft marks) are provided.
\begin{code}
  \usepackage{minimalist}
\end{code}

\subsection{A useful switch: the option \textsf{fast} or \textsf{draft}}
You can use the option \verb|fast| or \verb|draft| to typeset in a fast but slightly rough manner. The main differences are:
\begin{itemize}
    \item Do not use hyperref; 
    \item Do not use tikz (and thus tcolorbox);
\end{itemize}

During the writing stage of your document, it is recommended to use the \verb|fast| option to speed up compilation and improve the smoothness of your writing experience. At the end, you can remove the ``fast'' mark to get the final version.

\section{Some instructions}

There is no indentation at the beginning of each paragraph, but there will be a half-line space between each two paragraphs. like this ---

Here is the next paragraph.

\subsection{Theorems and how to reference them}

Environments such as definitions and theorems have been pre-defined and can be used directly, for example:
\begin{code}
  \begin{definition}[Strange things] \label{def: strange} ...
\end{code}
will produce
\begin{definition}[Strange things]\label{def: strange}
    This is the definition of some strange objects.
\end{definition}

There is approximately an one-line space before and after the theorem environment. There will be a symbol to mark the end of the environment.

When referencing, you can directly use clever reference \lstinline|\cref{(label name)}|. For example, \lstinline|\cref{def: strange}| will be displayed as: \cref{def: strange}.

\subsection{Define a new theorem-like environment}

First define the name of this environment in the language used: \lstinline|\(name of environment)(language name)|. Where \lstinline|(language name)| can be \lstinline|EN|, \lstinline|FR|, \lstinline|CN|, etc., and then define this environment in one of the following four ways:
\begin{itemize}
    \item \lstinline|\CreateTheorem*{(name of environment)}|
    \item \lstinline|\CreateTheorem{(name of environment)}[(numbered like)]|
    \item \lstinline|\CreateTheorem{(name of environment)}<(numbered within)>|
    \item \lstinline|\CreateTheorem{(name of environment)}|
\end{itemize}

\def\proofideanameEN{Idea}
\CreateTheorem*{proofidea}

For example,
\begin{code}
  \def\proofideanameEN{Idea}
  \CreateTheorem*{proofidea}
\end{code}
defines an unnumbered environment \lstinline|proofidea|, which supports using in the English context, and the effect is as follows:

\begin{proofidea}
    ...
\end{proofidea}

\subsection{Draft mark}

You can use \lstinline|\dnf| to mark the unfinished part (this is a feature provide by the classes, not the \minimalist{} package). For example:
\begin{itemize}
    \item \lstinline|\dnf|: \quad \dnf
    \item \lstinline|\dnf<Still need ...>|: \quad \dnf<Still need ...>
\end{itemize}

Similarly, there is \lstinline|\needgraph|:
\begin{itemize}
    \item \lstinline|\needgraph|: \needgraph
    \item \lstinline|\needgraph<About ...>|: \needgraph<About ...>
\end{itemize}

\subsection{Language configuration}
You can use \lstinline|\UseLanguage{(name of language))}| at any time to change the language, Language names include Chinese, English, French (the case of the first letter is arbitrary, for example, ``chinese'' is also acceptable). With this, the effects of various commands and environments will also change accordingly.

For example, after using \lstinline|\UseLanguage{French}|, the theorem and the draft mark will be displayed as:

\UseLanguage{French}
\begin{theorem}[Inutile]\label{thm}
    Un théorème en français. \dnf
\end{theorem}

When referenced, the name of the theorem always matches the language of the region in which the theorem is located, for example, the definition of the beginning is still displayed in English in the current French mode: \cref{def: strange} and \cref{thm}. 

\UseLanguage{English}

\subsection{On the line numbers}
Line numbers can be turned on and off at any time. \lstinline|\linenumbers| is used to enable the line numbers, and \lstinline|\nolinenumbers| is used to disable them. For the sake of beauty, the title, table of contents, index and some other elements are not numbered.

\subsection{On the footnotes in the title}
In \lstinline|\section| or \lstinline|\subsection| , if you wish to add footnotes, you can only:
\begin{itemize}
    \item first write \lstinline|\mbox{\protect\footnotemark}|, 
    \item then add \lstinline|\footnotetext{...}| afterwards. 
\end{itemize}
This is a disadvantage brought about by the underline decoration of the title.

\section{Document templates}

\singlespacing

\LocallyStopLineNumbers
\begin{minipage}{0.45\textwidth}
\begin{code}
\documentclass[fast]{minimart}

\linenumbers
\UseLanguage{French}

\begin{document}

\title{Titre}
\author{Nom}
\date{03 / 2021, Lieu}

\maketitle

%% Texte ici

\end{document}
\end{code}
\end{minipage}
\par
\ResumeLineNumbers

\bigskip
(\lstinline|\UseLanguage| can be placed either in the preamble or in the body part, and can be used repeatedly as needed)

\end{document}
