mirror of
https://github.com/ElegantLaTeX/ElegantBook.git
synced 2026-01-26 04:14:35 +08:00
update 3.11
This commit is contained in:
102
elegantbook.cls
102
elegantbook.cls
@@ -8,7 +8,7 @@
|
||||
%%%%%%%%%%%%%%%%%%%%%
|
||||
% % !Mode:: "TeX:UTF-8"
|
||||
\NeedsTeXFormat{LaTeX2e}
|
||||
\ProvidesClass{elegantbook}[2020/04/11 v4.0.0 ElegantBook document class]
|
||||
\ProvidesClass{elegantbook}[2020/04/12 v3.11 ElegantBook document class]
|
||||
|
||||
\RequirePackage{kvoptions}
|
||||
\RequirePackage{etoolbox}
|
||||
@@ -20,7 +20,6 @@
|
||||
\DeclareStringOption[en]{lang}
|
||||
\DeclareStringOption[answer]{result}
|
||||
\DeclareStringOption[fancy]{mode}
|
||||
\DeclareStringOption[show]{base}
|
||||
\DeclareStringOption[normal]{device}
|
||||
\DeclareStringOption[cm]{math}
|
||||
\DeclareStringOption[marginfalse]{marginpar}
|
||||
@@ -43,6 +42,7 @@
|
||||
|
||||
\DeclareVoidOption{en}{\ekv{lang=en}}
|
||||
\DeclareVoidOption{cn}{\ekv{lang=cn}}
|
||||
\DeclareVoidOption{it}{\ekv{lang=it}}
|
||||
|
||||
\DeclareVoidOption{fancy}{\ekv{mode=fancy}}
|
||||
\DeclareVoidOption{simple}{\ekv{mode=simple}}
|
||||
@@ -50,9 +50,6 @@
|
||||
\DeclareVoidOption{answer}{\ekv{result=answer}}
|
||||
\DeclareVoidOption{noanswer}{\ekv{result=noanswer}}
|
||||
|
||||
\DeclareVoidOption{hide}{\ekv{base=hide}}
|
||||
\DeclareVoidOption{show}{\ekv{base=show}}
|
||||
|
||||
\DeclareVoidOption{normal}{\ekv{device=normal}}
|
||||
\DeclareVoidOption{pad}{\ekv{device=pad}}
|
||||
|
||||
@@ -158,6 +155,11 @@
|
||||
\else
|
||||
\newcommand{\citshape}{\itshape}
|
||||
\fi
|
||||
\ifcsname kaishu\endcsname
|
||||
\newcommand{\cnormal}{\kaishu}
|
||||
\else
|
||||
\newcommand{\cnormal}{\normalfont}
|
||||
\fi
|
||||
|
||||
\ifcsname fangsong\endcsname
|
||||
\newcommand{\cfs}{\fangsong}
|
||||
@@ -251,21 +253,6 @@
|
||||
\definecolor{winered}{rgb}{0.5,0,0}
|
||||
\definecolor{bule}{RGB}{18,29,57}
|
||||
|
||||
|
||||
\newcommand{\base}[2]{%
|
||||
\nointerlineskip \vspace{0.1\baselineskip}\hspace{\fill}
|
||||
{\color{#1}
|
||||
\resizebox{0.3\linewidth}{1.5ex}
|
||||
{{%
|
||||
{\begin{tikzpicture}
|
||||
\node (C) at (0,0) {};
|
||||
\node (D) at (4,0) {};
|
||||
\path (C) to [ornament=#2] (D);
|
||||
\end{tikzpicture}}}}}%
|
||||
\hspace{\fill}
|
||||
\par\nointerlineskip \vspace{0.1\baselineskip}
|
||||
}
|
||||
|
||||
% ----- Title Style -----
|
||||
\ifdefstring{\ELEGANT@titlestyle}{hang}{\def\style{hang}}{\relax}
|
||||
\ifdefstring{\ELEGANT@titlestyle}{display}{\def\style{display}}{\relax}
|
||||
@@ -289,9 +276,8 @@
|
||||
|
||||
\newcommand{\question}[1]{{\par\citshape #1}\\[0.2ex]}
|
||||
|
||||
\RequirePackage[\ELEGANT@cite,sort&compress]{natbib}
|
||||
\setlength{\bibsep}{0.0pt}
|
||||
\def\bibfont{\footnotesize}
|
||||
\ifdefstring{\ELEGANT@lang}{cn}{\relax}{
|
||||
\RequirePackage[\ELEGANT@cite,sort&compress]{natbib}}
|
||||
|
||||
\RequirePackage{enumerate}
|
||||
% list/itemize/enumerate setting
|
||||
@@ -332,7 +318,6 @@
|
||||
\RequirePackage{xcolor}
|
||||
\RequirePackage{fancyvrb}
|
||||
\RequirePackage{makecell,lipsum,hologo,setspace}
|
||||
|
||||
%%中文结构名字
|
||||
\ifdefstring{\ELEGANT@lang}{cn}{
|
||||
\renewcommand{\contentsname}{目录}
|
||||
@@ -350,11 +335,16 @@
|
||||
\ifdefstring{\ELEGANT@scheme}{chinese}{
|
||||
\renewcommand{\chaptername}{第~\zhnumber{\arabic{chapter}}~章}}{
|
||||
\renewcommand{\chaptername}{第~\thechapter{}~章}}
|
||||
\newcommand{\authorname}{\textit{作者:}}
|
||||
\newcommand{\institutename}{\textit{组织:}}
|
||||
\newcommand{\datename}{\textit{时间:}}
|
||||
\newcommand{\versionname}{\textit{版本:}}
|
||||
\RequirePackage[\ELEGANT@cite]{gbt7714}
|
||||
\newcommand{\authorname}{\citshape 作者:}
|
||||
\newcommand{\institutename}{\citshape 组织:}
|
||||
\newcommand{\datename}{\citshape 时间:}
|
||||
\newcommand{\versionname}{\citshape 版本:}
|
||||
\RequirePackage{gbt7714}
|
||||
\ifdefstring{\ELEGANT@cite}{authoryear}{
|
||||
\bibliographystyle{gbt7714-author-year}}{
|
||||
\bibliographystyle{gbt7714-numerical}}
|
||||
\ifdefstring{\ELEGANT@cite}{numbers}{
|
||||
\citestyle{numbers}}{\relax}
|
||||
\newcommand{\notename}{笔记}
|
||||
\renewcommand*{\proofname}{证明}
|
||||
\newcommand{\problemname}{例题}
|
||||
@@ -374,10 +364,9 @@
|
||||
\newcommand{\propertyname}{性质}
|
||||
\newcommand{\introductionname}{内容提要}
|
||||
\newcommand{\problemsetname}{习题}
|
||||
\newcommand\bioinfo[2]{\gdef\@bioinfo{\textit{#1}:#2}}
|
||||
\newcommand\bioinfo[2]{\gdef\@bioinfo{{\citshape #1}:#2}}
|
||||
\newcommand{\updatename}{更新:}
|
||||
\newcommand{\historyname}{版本更新历史}
|
||||
}{\relax}
|
||||
\newcommand{\historyname}{版本更新历史}}{\relax}
|
||||
\ifdefstring{\ELEGANT@lang}{en}{
|
||||
\setlength\parindent{2em}
|
||||
\newcommand\figref[1]{\textbf{Figure}~\ref{#1}}
|
||||
@@ -447,6 +436,8 @@
|
||||
\newcommand{\historyname}{Cronologia delle versioni}
|
||||
}{\relax}
|
||||
|
||||
\setlength{\bibsep}{0.0pt}
|
||||
\def\bibfont{\footnotesize}
|
||||
|
||||
\RequirePackage{xpatch}
|
||||
\xpatchcmd{\part}{
|
||||
@@ -458,7 +449,7 @@
|
||||
|
||||
\graphicspath{{./figure/}{./figures/}{./image/}{./images/}{./graphics/}{./graphic/}{./pictures/}{./picture/}}
|
||||
|
||||
\usepackage{pgfornament} %% load tikz without tikz
|
||||
\usepackage{tikz} %% load tikz without tikz
|
||||
\usetikzlibrary{backgrounds,calc,shadows}
|
||||
\newcommand*\circled[1]{\tikz[baseline=(char.base)]{
|
||||
\node[shape=circle,draw,inner sep=1pt] (char) {#1};}}
|
||||
@@ -502,7 +493,7 @@
|
||||
\setcounter{secnumdepth}{5}
|
||||
|
||||
\titleformat{\chapter}[\style]{\bfseries}
|
||||
{\filcenter\LARGE\enspace\bfseries{\color{structurecolor}\IfAppendix{\appendixname}{\chaptername}\enspace}}{1pt}{\bfseries\color{structurecolor}\LARGE\filcenter}[\ifdefstring{\ELEGANT@base}{hide}{}{\filcenter\base{structurecolor}{88}}]
|
||||
{\filcenter\LARGE\enspace\bfseries{\color{structurecolor}\IfAppendix{\appendixname}{\chaptername}\enspace}}{1pt}{\bfseries\color{structurecolor}\LARGE\filcenter}[]
|
||||
|
||||
\titleformat{\section}[hang]{\bfseries}{
|
||||
\Large\bfseries{\color{structurecolor}\thesection}\enspace}{1pt}{%
|
||||
@@ -744,29 +735,14 @@
|
||||
\RequirePackage{fancyhdr}
|
||||
\fancyhf{}
|
||||
|
||||
\ifdefstring{\ELEGANT@base}{hide}{
|
||||
\fancyfoot[c]{\color{structurecolor}\scriptsize\thepage}
|
||||
\if@twoside
|
||||
\fancyhead[ER]{\color{structurecolor}\citshape\leftmark}
|
||||
\fancyhead[OL]{\color{structurecolor}\citshape\rightmark}
|
||||
\else
|
||||
\fancyhead[R]{\color{structurecolor}\citshape\rightmark}
|
||||
\fi
|
||||
}{\relax}
|
||||
|
||||
|
||||
\ifdefstring{\ELEGANT@base}{show}{
|
||||
\fancyfoot[c]{\catcode`\$=3\relax\base{structurecolor}{88}}
|
||||
\if@twoside
|
||||
\fancyhead[EL,OR]{\color{structurecolor}--\;\thepage\;--}
|
||||
\fancyhead[ER]{\color{structurecolor}\citshape\leftmark}
|
||||
\fancyhead[OL]{\color{structurecolor}\citshape\rightmark}
|
||||
\else
|
||||
\fancyhead[R]{\color{structurecolor}--\;\thepage\;--}
|
||||
\fancyhead[L]{\color{structurecolor}\citshape\rightmark}
|
||||
\fi
|
||||
}{\relax}
|
||||
|
||||
\fancyfoot[c]{\color{structurecolor}\scriptsize\thepage}
|
||||
\if@twoside
|
||||
\fancyhead[ER]{\color{structurecolor}\cnormal\leftmark}
|
||||
\fancyhead[OL]{\color{structurecolor}\cnormal\rightmark}
|
||||
\else
|
||||
\fancyhead[R]{\color{structurecolor}\cnormal\rightmark}
|
||||
\fi
|
||||
|
||||
\renewcommand{\headrule}{\color{structurecolor}\hrule width\textwidth}
|
||||
\pagestyle{fancy}
|
||||
@@ -818,12 +794,12 @@
|
||||
{\renewcommand{\arraystretch}{0.618}
|
||||
\begin{tabular}{l}
|
||||
% \ifcsname @author\endcsname \authorname \@author\\\fi
|
||||
\ifx\@author\empty\else\authorname\@author\\ \fi
|
||||
\ifcsname @institute\endcsname \institutename \@institute\\ \fi
|
||||
\ifx\@author\empty\else\authorname\cnormal\@author\\ \fi
|
||||
\ifcsname @institute\endcsname \institutename \cnormal\@institute\\ \fi
|
||||
% \ifcsname @date\endcsname \@date\\\fi
|
||||
\ifx\@date\empty\else\datename\@date \\ \fi
|
||||
\ifcsname @version\endcsname \versionname \@version\\ \fi
|
||||
\ifcsname @bioinfo\endcsname \@bioinfo\\ \fi
|
||||
\ifx\@date\empty\else\datename\cnormal\@date \\ \fi
|
||||
\ifcsname @version\endcsname \cnormal\versionname\@version\\ \fi
|
||||
\ifcsname @bioinfo\endcsname \cnormal\@bioinfo\\ \fi
|
||||
\end{tabular}}
|
||||
\end{minipage}
|
||||
\begin{minipage}[c]{0.27\linewidth}
|
||||
@@ -840,7 +816,7 @@
|
||||
\vfill
|
||||
\begin{center}
|
||||
\setstretch{1.3}
|
||||
\parbox[t]{0.7\textwidth}{\centering \itshape
|
||||
\parbox[t]{0.7\textwidth}{\centering \citshape
|
||||
\ifcsname @extrainfo\endcsname\@extrainfo\fi}
|
||||
\end{center}
|
||||
\vfill
|
||||
@@ -869,7 +845,7 @@
|
||||
breaklines=true,
|
||||
keywordstyle=\color{winered},
|
||||
commentstyle=\color{gray},
|
||||
emph={elegantpaper,fontenc,fontspec,xeCJK,FiraMono,xunicode,newtxmath,figure,fig,image,img,table,itemize,enumerate,newtxtext,newtxtt,ctex,microtype,description,times,booktabs,tabular,PDFLaTeX,XeLaTeX,type1cm,BibTeX,device,color,mode,lang,amsthm,tcolorbox,titlestyle,cite,ctex,listings,base,math,scheme,toc,esint,chinesefont,amsmath,bibstyle,gbt7714,natbib},
|
||||
emph={elegantpaper,fontenc,fontspec,xeCJK,FiraMono,xunicode,newtxmath,figure,fig,image,img,table,itemize,enumerate,newtxtext,newtxtt,ctex,microtype,description,times,booktabs,tabular,PDFLaTeX,XeLaTeX,type1cm,BibTeX,device,color,mode,lang,amsthm,tcolorbox,titlestyle,cite,ctex,listings,base,math,scheme,toc,esint,chinesefont,amsmath,bibstyle,natbib},
|
||||
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,extrainfo,logo,cover,subtitle,appendix,chapter,hypersetup,mainmatter,frontmatter,tableofcontents,elegantpar,heiti,kaishu,lstset,pagecolor,zhnumber,marginpar,part,equote,marginnote,bioinfo,datechange,listofchange,lvert,lastpage,songti,heiti,fangsong,setCJKfamilyfont,textbf},
|
||||
frame=single,
|
||||
|
||||
Reference in New Issue
Block a user