mirror of
https://github.com/ElegantLaTeX/ElegantBook.git
synced 2026-01-26 04:14:35 +08:00
elegantbook 3.07
This commit is contained in:
149
elegantbook.cls
149
elegantbook.cls
@@ -23,6 +23,7 @@
|
||||
\DeclareStringOption[fancy]{mode}
|
||||
\DeclareStringOption[show]{base}
|
||||
|
||||
|
||||
% ----- backward compatibility
|
||||
\DeclareVoidOption{green}{\ekv{color = green}}
|
||||
\DeclareVoidOption{cyan}{\ekv{color = cyan}}
|
||||
@@ -113,27 +114,31 @@
|
||||
|
||||
\RequirePackage{xcolor}
|
||||
\ifdefstring{\ELEGANT@color}{green}{
|
||||
\definecolor{structurecolor}{RGB}{0,120,2}%
|
||||
\definecolor{main}{RGB}{0,120,2}%
|
||||
\definecolor{second}{RGB}{230,90,7}%
|
||||
\definecolor{third}{RGB}{0,160,152}%
|
||||
}{\relax}
|
||||
|
||||
\ifdefstring{\ELEGANT@color}{cyan}{
|
||||
\definecolor{main}{RGB}{0,175,152}%
|
||||
\definecolor{second}{RGB}{239,126,30}%
|
||||
\definecolor{third}{RGB}{120,8,13}%
|
||||
\definecolor{structurecolor}{RGB}{31,186,190}%
|
||||
\definecolor{main}{RGB}{59,180,5}%
|
||||
\definecolor{second}{RGB}{175,153,8}%
|
||||
\definecolor{third}{RGB}{244,105,102}%
|
||||
}{\relax}
|
||||
\ifdefstring{\ELEGANT@color}{blue}{
|
||||
\definecolor{main}{RGB}{20,50,104}%
|
||||
\definecolor{second}{RGB}{180,50,131}%
|
||||
\definecolor{third}{RGB}{7,127,128}%
|
||||
\definecolor{structurecolor}{RGB}{60,113,183}
|
||||
\definecolor{main}{RGB}{0,166,82}%
|
||||
\definecolor{second}{RGB}{255,134,24}%
|
||||
\definecolor{third}{RGB}{0,174,247}%
|
||||
}{\relax}
|
||||
\ifdefstring{\ELEGANT@color}{gray}{
|
||||
\definecolor{main}{RGB}{50,50,50}%
|
||||
\definecolor{second}{RGB}{50,50,50}%
|
||||
\definecolor{third}{RGB}{50,50,50}%
|
||||
\definecolor{structurecolor}{RGB}{0,0,0}
|
||||
\definecolor{main}{RGB}{150,150,150}%
|
||||
\definecolor{second}{RGB}{150,150,150}%
|
||||
\definecolor{third}{RGB}{150,150,150}%
|
||||
}{\relax}
|
||||
\ifdefstring{\ELEGANT@color}{black}{
|
||||
\definecolor{structurecolor}{RGB}{0,0,0}
|
||||
\definecolor{main}{RGB}{0,0,0}%
|
||||
\definecolor{second}{RGB}{0,0,0}%
|
||||
\definecolor{third}{RGB}{0,0,0}%
|
||||
@@ -191,7 +196,7 @@
|
||||
% caption settings
|
||||
\RequirePackage{caption}
|
||||
\captionsetup{labelfont = bf}
|
||||
\RequirePackage[font=small,labelfont={bf,color=main}]{caption}
|
||||
\RequirePackage[font=small,labelfont={bf,color=structurecolor}]{caption}
|
||||
\captionsetup[table]{skip=3pt}
|
||||
\captionsetup[figure]{skip=3pt}
|
||||
|
||||
@@ -214,7 +219,7 @@
|
||||
\renewcommand{\chaptername}{Chapter \thechapter}
|
||||
}{\relax}
|
||||
\ifdefstring{\ELEGANT@lang}{cn}{
|
||||
\renewcommand{\contentsname}{目录}
|
||||
\renewcommand{\contentsname}{目\hspace{2em}录}
|
||||
\renewcommand{\figurename}{图}
|
||||
\renewcommand{\tablename}{表}
|
||||
\renewcommand{\partname}{第 \thepart\; 部分}
|
||||
@@ -222,7 +227,7 @@
|
||||
\renewcommand{\listtablename}{表格目录}
|
||||
\renewcommand{\bibname}{参考文献}
|
||||
\renewcommand{\appendixname}{附录}
|
||||
\renewcommand{\indexname}{索引}
|
||||
\renewcommand{\indexname}{索\hspace{2em}引}
|
||||
\newcommand\figref[1]{\textbf{图}~\ref{#1}}
|
||||
\newcommand\tabref[1]{\textbf{表}~\ref{#1}}
|
||||
\renewcommand{\chaptername}{第 \thechapter\;章}
|
||||
@@ -236,13 +241,13 @@
|
||||
\usetikzlibrary{backgrounds,calc,shadows}
|
||||
\usepackage[object=vectorian]{pgfornament} %%
|
||||
|
||||
\newcommand*{\eitemi}{\tikz \draw [baseline, ball color=main, draw=none] circle (2pt);}
|
||||
\newcommand*{\eitemii}{\tikz \draw [baseline, fill=main,draw=none,circular drop shadow] circle (2pt);}
|
||||
\newcommand*{\eitemiii}{\tikz \draw [baseline, fill=main,draw=none] circle (2pt);}
|
||||
\setlist[enumerate,1]{label=\color{main}\arabic*.}
|
||||
\setlist[enumerate,2]{label=\color{main}(\alph*).}
|
||||
\setlist[enumerate,3]{label=\color{main}\Roman*.}
|
||||
\setlist[enumerate,4]{label=\color{main}\Alph*.}
|
||||
\newcommand*{\eitemi}{\tikz \draw [baseline, ball color=structurecolor, draw=none] circle (2pt);}
|
||||
\newcommand*{\eitemii}{\tikz \draw [baseline, fill=structurecolor,draw=none,circular drop shadow] circle (2pt);}
|
||||
\newcommand*{\eitemiii}{\tikz \draw [baseline, fill=structurecolor,draw=none] circle (2pt);}
|
||||
\setlist[enumerate,1]{label=\color{structurecolor}\arabic*.}
|
||||
\setlist[enumerate,2]{label=\color{structurecolor}(\alph*).}
|
||||
\setlist[enumerate,3]{label=\color{structurecolor}\Roman*.}
|
||||
\setlist[enumerate,4]{label=\color{structurecolor}\Alph*.}
|
||||
\setlist[itemize,1]{label={\eitemi}}
|
||||
\setlist[itemize,2]{label={\eitemii}}
|
||||
\setlist[itemize,3]{label={\eitemiii}}
|
||||
@@ -252,7 +257,8 @@
|
||||
\def\bibfont{\footnotesize}
|
||||
|
||||
|
||||
%% 页面设置
|
||||
%% device settings
|
||||
|
||||
\RequirePackage{geometry}
|
||||
\geometry{
|
||||
a4paper,
|
||||
@@ -264,6 +270,7 @@
|
||||
footskip=12mm
|
||||
}
|
||||
|
||||
|
||||
\RequirePackage{hyperref}
|
||||
\hypersetup{
|
||||
breaklinks,
|
||||
@@ -288,21 +295,22 @@
|
||||
\RequirePackage{apptools}
|
||||
\RequirePackage[toc,page]{appendix}
|
||||
|
||||
\setcounter{secnumdepth}{5}
|
||||
|
||||
\titleformat{\chapter}[\style]{\bfseries}
|
||||
{\filcenter\LARGE\enspace\bfseries{\color{main}\IfAppendix{\appendixname}{\chaptername}\enspace}}{1pt}{\bfseries\color{main}\LARGE\filcenter}[\ifdefstring{\ELEGANT@base}{hide}{}{\filcenter\base{main}{88}}]
|
||||
{\filcenter\LARGE\enspace\bfseries{\color{structurecolor}\IfAppendix{\appendixname}{\chaptername}\enspace}}{1pt}{\bfseries\color{structurecolor}\LARGE\filcenter}[\ifdefstring{\ELEGANT@base}{hide}{}{\filcenter\base{structurecolor}{88}}]
|
||||
|
||||
\titleformat{\section}[hang]{\bfseries}
|
||||
{\hspace{-2.45em}\Large\bfseries{\color{main}\thesection}\enspace}{1pt}{\color{main}\Large\bfseries\filright}
|
||||
{\hspace{-2.45em}\Large\bfseries{\color{structurecolor}\thesection}\enspace}{1pt}{\color{structurecolor}\Large\bfseries\filright}
|
||||
|
||||
\titleformat{\subsection}[hang]{\bfseries}
|
||||
{\hspace{-2.45em}\large\bfseries\color{main}\thesubsection\enspace}{1pt}{\color{main}\large\bfseries\filright}
|
||||
{\hspace{-2.45em}\large\bfseries\color{structurecolor}\thesubsection\enspace}{1pt}{\color{structurecolor}\large\bfseries\filright}
|
||||
|
||||
\titleformat{\subsubsection}[hang]{\bfseries}
|
||||
{\hspace{-2.45em}\large\bfseries\color{main}\thesubsection\enspace}{1pt}{\color{main}\large\bfseries\filright}
|
||||
{\hspace{-2.45em}\large\bfseries\color{structurecolor}\thesubsubsection\enspace}{1pt}{\color{structurecolor}\large\bfseries\filright}
|
||||
|
||||
|
||||
\titlespacing{\chapter}{0pt}{0pt}{1.5\baselineskip}
|
||||
\titlespacing{\chapter}{0pt}{-20pt}{1.3\baselineskip}
|
||||
%\titlespacing{\subsection}{0pt}{0.5\baselineskip}{-\baselineskip}
|
||||
|
||||
|
||||
@@ -321,7 +329,8 @@
|
||||
fontupper=\ifdefstring{\ELEGANT@lang}{en}{\itshape}{\upshape\kaishu},
|
||||
lower separated=false,
|
||||
coltitle=white,
|
||||
colback=gray!10,
|
||||
colback=gray!5,
|
||||
boxrule=0.5pt,
|
||||
fonttitle=\bfseries,
|
||||
enhanced,
|
||||
breakable,
|
||||
@@ -329,26 +338,26 @@
|
||||
before skip=8pt,
|
||||
attach boxed title to top left={yshift=-0.11in,xshift=0.15in},
|
||||
boxed title style={boxrule=0pt,colframe=white,arc=0pt,outer arc=0pt},
|
||||
% separator sign={:},
|
||||
separator sign={.},
|
||||
},
|
||||
defstyle/.style={
|
||||
common,
|
||||
colframe=main,
|
||||
colback=main!10,
|
||||
colback=main!5,
|
||||
colbacktitle=main,
|
||||
overlay unbroken and last={\node[anchor=south east, outer sep=6pt] at (\textwidth-width,0) {\textcolor{main}{$\clubsuit$}}; }
|
||||
},
|
||||
thmstyle/.style={
|
||||
common,
|
||||
colframe=second,
|
||||
colback=second!10,
|
||||
colback=second!5,
|
||||
colbacktitle=second,
|
||||
overlay unbroken and last={\node[anchor=south east, outer sep=6pt] at (\textwidth-width,0) {\textcolor{second}{$\heartsuit$}}; }
|
||||
},
|
||||
propstyle/.style={
|
||||
common,
|
||||
colframe=third,
|
||||
colback=third!10,
|
||||
colback=third!5,
|
||||
colbacktitle=third,
|
||||
overlay unbroken and last={\node[anchor=south east, outer sep=6pt] at (\textwidth-width,0) {\textcolor{third}{$\spadesuit$}}; }
|
||||
},
|
||||
@@ -420,12 +429,16 @@
|
||||
{\endeproposition}
|
||||
}{\relax}
|
||||
|
||||
% main(green-def): example exercise problem solution
|
||||
% second(orange-thm): proof note remark
|
||||
% third(blue-prop): assumptions property conclusion custom
|
||||
|
||||
%% Example with counter
|
||||
\newcounter{exam}[chapter]
|
||||
\setcounter{exam}{0}
|
||||
\renewcommand{\theexam}{\thechapter.\arabic{exam}}
|
||||
\newenvironment{example}[1][]{
|
||||
\refstepcounter{exam}\par\noindent \textbf{\color{main}{
|
||||
\refstepcounter{exam}\par\noindent\textbf{\color{main}{
|
||||
\ifdefstring{\ELEGANT@lang}{en}{Example}{例}
|
||||
}~\theexam #1: }\rmfamily %
|
||||
}{
|
||||
@@ -449,7 +462,7 @@
|
||||
\setcounter{prob}{0}
|
||||
\renewcommand{\theprob}{\thechapter.\arabic{prob}}
|
||||
\newenvironment{problem}[1][]{
|
||||
\refstepcounter{prob}\par\noindent \textbf{\color{main}{
|
||||
\refstepcounter{prob}\par\noindent\textbf{\color{main}{%
|
||||
\ifdefstring{\ELEGANT@lang}{en}{Problem}{例题}
|
||||
}~\theprob #1: }\rmfamily %
|
||||
}{
|
||||
@@ -458,31 +471,31 @@
|
||||
|
||||
|
||||
|
||||
\newenvironment{note}{\par\noindent{\makebox[0pt][r]{\scriptsize\color{red!90}\textdbend\quad}\textbf{\color{main}
|
||||
\newenvironment{note}{\par\noindent{\makebox[0pt][r]{\scriptsize\color{red!90}\textdbend\quad}\textbf{\color{second}
|
||||
\ifdefstring{\ELEGANT@lang}{en}{Note:}{注意:}
|
||||
}}\itshape}{\par}
|
||||
}}\ifdefstring{\ELEGANT@lang}{en}{\itshape}{\kaishu}}{\par}
|
||||
|
||||
\newenvironment{proof}{\par\noindent\textbf{\color{main}
|
||||
\newenvironment{proof}{\par\noindent\textbf{\color{second}
|
||||
\ifdefstring{\ELEGANT@lang}{en}{Proof:}{证明:}
|
||||
}\color{black!90}\small}{
|
||||
%\hfill$\Box$\quad
|
||||
\par}
|
||||
\newenvironment{remark}{\noindent\textbf{\color{main}
|
||||
\newenvironment{remark}{\noindent\textbf{\color{second}
|
||||
\ifdefstring{\ELEGANT@lang}{en}{Remark:}{注:}
|
||||
}}{\par}
|
||||
\newenvironment{assumption}{\par\noindent\textbf{\color{main}
|
||||
\newenvironment{assumption}{\par\noindent\textbf{\color{third}
|
||||
\ifdefstring{\ELEGANT@lang}{en}{Assumption:}{假设:}
|
||||
}}{\par}
|
||||
\newenvironment{conclusion}{\par\noindent\textbf{\color{main}
|
||||
\newenvironment{conclusion}{\par\noindent\textbf{\color{third}
|
||||
\ifdefstring{\ELEGANT@lang}{en}{Conclusion:}{结论:}
|
||||
}}{\par}
|
||||
\newenvironment{solution}{\par\noindent\textbf{\color{main}
|
||||
\ifdefstring{\ELEGANT@lang}{en}{Solution:}{解:}
|
||||
}}{\par}
|
||||
\newenvironment{property}{\par\noindent\textbf{\color{main}
|
||||
\newenvironment{property}{\par\noindent\textbf{\color{third}
|
||||
\ifdefstring{\ELEGANT@lang}{en}{Property:}{性质:}
|
||||
}}{\par}
|
||||
\newenvironment{custom}[1]{\par\noindent\textbf{\color{main}
|
||||
\newenvironment{custom}[1]{\par\noindent\textbf{\color{third}
|
||||
\ifdefstring{\ELEGANT@lang}{en}{#1:}{#1:}
|
||||
}}{\par}
|
||||
|
||||
@@ -499,19 +512,21 @@
|
||||
\RequirePackage{fancyhdr}
|
||||
\RequirePackage{lastpage}
|
||||
\fancyhf{}
|
||||
|
||||
\if@twoside
|
||||
\fancyhead[EL,OR]{\color{main}--\thepage/\pageref*{LastPage}--}
|
||||
\fancyhead[ER]{\color{main}\itshape\leftmark{}}
|
||||
\fancyhead[OL]{\color{main}\itshape\rightmark}
|
||||
\fancyhead[EL,OR]{\color{structurecolor}\ifdefstring{\ELEGANT@lang}{en}{\itshape}{\kaishu}--\thepage/\pageref*{LastPage}--}
|
||||
\fancyhead[ER]{\color{structurecolor}\ifdefstring{\ELEGANT@lang}{en}{\itshape}{\kaishu}\leftmark{}}
|
||||
\fancyhead[OL]{\color{structurecolor}\ifdefstring{\ELEGANT@lang}{en}{\itshape}{\kaishu}\rightmark}
|
||||
\else
|
||||
\fancyhead[R]{\color{main}--\itshape\thepage/\pageref*{LastPage}--}
|
||||
\fancyhead[L]{\color{main}\itshape\rightmark}
|
||||
\fancyhead[R]{\color{structurecolor}\ifdefstring{\ELEGANT@lang}{en}{\itshape}{\kaishu}--\thepage/\pageref*{LastPage}--}
|
||||
\fancyhead[L]{\color{structurecolor}\ifdefstring{\ELEGANT@lang}{en}{\itshape}{\kaishu}\rightmark}
|
||||
\fi
|
||||
|
||||
\fancyfoot[c]{\base{main}{88}}
|
||||
\renewcommand{\headrule}{\color{main}\hrule width\textwidth}
|
||||
\fancyfoot[c]{\base{structurecolor}{88}}
|
||||
\renewcommand{\headrule}{\color{structurecolor}\hrule width\textwidth}
|
||||
\pagestyle{fancy}
|
||||
|
||||
\renewcommand{\headrulewidth}{1pt}
|
||||
% \renewcommand{\headrule}{}
|
||||
\fancypagestyle{plain}{\renewcommand{\headrulewidth}{0pt}\fancyhf{}\renewcommand{\headrule}{}}
|
||||
\renewcommand{\sectionmark}[1]{\markright{\thesection\; #1}{} }
|
||||
\renewcommand{\chaptermark}[1]{\markboth{\chaptername \; #1\;}{}}
|
||||
@@ -519,8 +534,14 @@
|
||||
%%封面
|
||||
\newcommand*{\equote}[1]{\def\@equote{#1}}
|
||||
|
||||
\def\IfEmpty#1{%
|
||||
\edef\1{\the#1}
|
||||
\ifx\1\empty
|
||||
}
|
||||
\def \ifempty#1{\def\temp{#1} \ifx\temp\empty }
|
||||
|
||||
\newcommand*{\logo}[1]{
|
||||
\def\@logo{\includegraphics[width=4.5cm]{#1}
|
||||
\def\@logo{\includegraphics[width=4.2cm]{#1}
|
||||
}
|
||||
}
|
||||
\newcommand*{\cover}[1]{
|
||||
@@ -528,29 +549,36 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
\renewcommand{\baselinestretch}{1.35}
|
||||
|
||||
\renewcommand*{\maketitle}{%
|
||||
\hypersetup{pageanchor=false}
|
||||
\begin{titlepage}
|
||||
\newgeometry{margin = 0in}
|
||||
\parindent=0pt
|
||||
\setstretch{2.5}
|
||||
\@cover
|
||||
% \includegraphics[width=\linewidth]{cover.jpg}
|
||||
\setlength{\fboxsep}{0pt}
|
||||
\colorbox{second}{\makebox[\linewidth][c]{\shortstack[c]{\vspace{0.5in}}}}
|
||||
\vfill
|
||||
\hfill
|
||||
\vskip-2ex
|
||||
\hspace{2em}
|
||||
\parbox{0.8\textwidth}{
|
||||
\bfseries\Huge \@title\par
|
||||
}
|
||||
\vfill
|
||||
\vspace{-1.0cm}
|
||||
\setstretch{2.5}
|
||||
\hspace{2.5em}
|
||||
\begin{minipage}[c]{0.68\linewidth}
|
||||
{\bfseries\Huge \@title\\}
|
||||
{\color{darkgray}\bfseries\Large \the\subtitle\\[2ex]}
|
||||
\color{gray}\kaishu\normalsize
|
||||
{\renewcommand{\arraystretch}{0.618}
|
||||
\begin{tabular}{l}
|
||||
\ifdefstring{\ELEGANT@lang}{en}{\textbf{Author: }}{\textbf{作者:}}\@author \\
|
||||
\ifdefstring{\ELEGANT@lang}{en}{\textbf{Institute: }}{\textbf{组织:}}\the\institute\\
|
||||
\ifdefstring{\ELEGANT@lang}{en}{\textbf{Update: }}{\textbf{更新:}}\@date\\
|
||||
\ifdefstring{\ELEGANT@lang}{en}{\textbf{Version: }}{\textbf{版本:}}\the\version \\
|
||||
\ifdefstring{\ELEGANT@lang}{en}{\textbf{Author: }}{\textbf{作者:}} \@author \\
|
||||
\ifdefstring{\ELEGANT@lang}{en}{\textbf{Institute: }}{\textbf{组织:}} \the\institute\\
|
||||
\ifdefstring{\ELEGANT@lang}{en}{\textbf{Date: }}{\textbf{时间:}} \@date\\
|
||||
\ifdefstring{\ELEGANT@lang}{en}{\textbf{Version: }}{\textbf{版本:}} \the\version\\
|
||||
\end{tabular}}
|
||||
\end{minipage}
|
||||
\begin{minipage}[c]{0.27\linewidth}
|
||||
@@ -592,8 +620,11 @@
|
||||
emph={elegantpaper,fontenc,fontspec,xeCJK,FiraMono,xunicode,newtxmath,figure,fig,image,img,table,itemize,enumerate,newtxtext,newtxtt,ctex,microtype,description,times,newtx,booktabs,tabular,PDFLaTeX,XeLaTeX,type1cm,BibTeX,device,color,mode,lang,amsthm,tcolorbox,titlestyle},
|
||||
emphstyle={\color{frenchplum}},
|
||||
morekeywords={DeclareSymbolFont,SetSymbolFont,toprule,midrule,bottomrule,institute,version,includegraphics,setmainfont,setsansfont,setmonofont ,setCJKmainfont,setCJKsansfont,setCJKmonofont,RequirePackage,figref,tabref,email,maketitle,keywords,definecolor,equote,logo,cover,subtitle,appendix,chapter,hypersetup,mainmatter,tableofcontents},
|
||||
frame=none,
|
||||
frame=single,
|
||||
tabsize=2,
|
||||
rulecolor=\color{structurecolor},
|
||||
framerule=0.2pt,
|
||||
columns=flexible,
|
||||
% backgroundcolor=\color{lightgrey}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user