diff options
Diffstat (limited to 'macros/latex/contrib/litesolution/tex')
-rw-r--r-- | macros/latex/contrib/litesolution/tex/litesolution.cls | 86 | ||||
-rw-r--r-- | macros/latex/contrib/litesolution/tex/titleimage.sty | 20 |
2 files changed, 73 insertions, 33 deletions
diff --git a/macros/latex/contrib/litesolution/tex/litesolution.cls b/macros/latex/contrib/litesolution/tex/litesolution.cls index 232fc496a8..66a333f04e 100644 --- a/macros/latex/contrib/litesolution/tex/litesolution.cls +++ b/macros/latex/contrib/litesolution/tex/litesolution.cls @@ -7,7 +7,7 @@ %% * version. * * * ** * * * * * %% ****************************************************** ***** ** * * *** * * * %% start of file `litesolution.cls'. * -%% Copyright 2023 LiteLaTeX (xiamyphys@gmail.com) * +%% Copyright 2024 LiteLaTeX (xiamyphys@gmail.com) * %% available at https://github.com/xiamyphys/LiteSolution * %% Thanks https://github.com/ElegantLaTeX/ElegantBook, https://github.com/Azure1210/VividBooK * %% !Mode:: "TeX:UTF-8" * @@ -18,7 +18,7 @@ \PassOptionsToPackage{quiet}{fontspec} \PassOptionsToPackage{no-math}{fontspec} -\ProvidesClass{litesolution}[2023/12/13 v1.2a LiteSolution document class] +\ProvidesClass{litesolution}[2024/03/08 v1.3a LiteSolution document class] \RequirePackage{kvoptions} \RequirePackage{etoolbox} \SetupKeyvalOptions{family=LITE, prefix=LITE@, setkeys=\kvsetkeys} @@ -28,7 +28,10 @@ \DeclareStringOption[ans]{answer} \DeclareVoidOption{ans}{\ekv{answer=ans}} \DeclareVoidOption{noans}{\ekv{answer=noans}} -\DeclareVoidOption{preprint}{\ekv{answer=preprint}} + +\DeclareStringOption[breakable]{tcolorbox} +\DeclareVoidOption{breakable}{\ekv{tcolorbox=breakable}} +\DeclareVoidOption{nobreak}{\ekv{tcolorbox=nobreak}} \DeclareStringOption[separate]{counter} \DeclareVoidOption{separate}{\ekv{counter=separate}} @@ -40,7 +43,7 @@ % ----- Default Options ----- \DeclareDefaultOption{\PassOptionsToClass{\CurrentOption}{book}} \ProcessKeyvalOptions*\relax -\LoadClass[a4paper,oneside]{book} +\LoadClass[letterpaper,oneside]{book} \RequirePackage[letterpaper,margin=0.75in,headheight=0.25in,headsep=0.2in,footskip=0.2in]{geometry} \usepackage[level]{datetime} @@ -49,6 +52,8 @@ \usephysicsmodule{ab,ab.legacy,braket,nabla.legacy} \RequirePackage{amsmath,amssymb} \usepackage{nicematrix} +\usepackage{diagbox} +\usepackage{nicefrac} \RequirePackage{bm} \RequirePackage{esint} \RequirePackage[e]{esvect}% 矢量箭头 @@ -59,7 +64,7 @@ \RequirePackage{tasks}% 选择题 \settasks{label=\Alph*.} \RequirePackage{setspace} -\setstretch{1.5} +\setstretch{1.25} \AtBeginDocument{ \everymath{\displaystyle} \setlength{\abovedisplayskip}{3pt} @@ -99,8 +104,7 @@ } \gdef\@chapterfont{#2} } -\setmainfont{Libertinus Serif} -\setsansfont{Libertinus Sans} +\usepackage[libertine,mono=false]{newtx} \setcounter{tocdepth}{1} \AfterEndPreamble{ @@ -116,9 +120,9 @@ \definecolor{headrulecolor}{HTML}{640125} \definecolor{1号色}{HTML}{4D5AAF} % \definecolor{2号色}{HTML}{006E54} % +\definecolor{solutioncolor}{HTML}{0F2350} % \ifdefstring{\LITE@answer}{ans}{ - \definecolor{solutioncolor}{HTML}{0F2350} % \def\solutionname{\faIcon{check-square} 分析与解} \def\ans#1{\underline{\color{solutioncolor}\ #1\ }} \def\choiceans#1{{\color{solutioncolor}\ #1\ }} @@ -128,7 +132,6 @@ }{\relax} \ifdefstring{\LITE@answer}{noans}{ - \definecolor{solutioncolor}{HTML}{FEFEFB} % \def\solutionname{\faIcon{pen-square} 答题区域} \def\ans#1{\underline{\phantom{\color{solutioncolor}#1}}} \def\choiceans#1{\phantom{\color{solutioncolor}}} @@ -146,6 +149,7 @@ \def\problemname{\faIcon{pen-square} 题目} % 题目=习题 \RequirePackage[most]{tcolorbox} +\ifdefstring{\LITE@tcolorbox}{breakable}{ \tcbuselibrary{breakable} \tcbset{ common/.style={ @@ -157,6 +161,22 @@ fonttitle=\bfseries } } +} +{\relax} +\ifdefstring{\LITE@tcolorbox}{nobreak}{ +\tcbset{ + common/.style={ + blanker, + left=3mm, + toprule=.3em, + bottomrule=.3em, + bottomtitle=.75\baselineskip, + fonttitle=\bfseries + } +} +} +{\relax} + \newcounter{prob}[chapter] \setcounter{prob}{1} \renewcommand{\theprob}{\arabic{prob}} @@ -181,42 +201,44 @@ } \rmfamily}{\end{tcolorbox}} -\NewDocumentEnvironment{problem}{s o o}{ - \refstepcounter{prob} - \IfBooleanTF{#1}{ - \def\tagname{\relax} - }{ - \def\tagname{\hfill\faIcon{tag}} - } +\NewDocumentEnvironment{problem}{s !o o}{ +\refstepcounter{prob} +\IfBooleanTF{#1}{ +\tcbset{ + wrapfig/.style={sidebyside,righthand width=\dimeval{2\textwidth/7}}} +}{ +\tcbset{ + wrapfig/.style={}} +} \IfNoValueTF{#3}{ \IfNoValueTF{#2}{ \begin{tcolorbox}[ - common, + common,wrapfig, borderline west={1.5pt}{0mm}{2号色}, title=\color{2号色}{\problemname} \theprob, coltitle=2号色, ] }{ \begin{tcolorbox}[ - common, + common,wrapfig, borderline west={1.5pt}{0mm}{2号色}, - title=\color{2号色}{\problemname} \theprob\tagname~#2, + title=\color{2号色}{\problemname} \theprob\hfill\faIcon{tag}~#2, coltitle=2号色, ] } }{ \IfNoValueTF{#2}{ \begin{tcolorbox}[ - common, + common,wrapfig, borderline west={1.5pt}{0mm}{2号色}, title=\color{2号色}{\problemname} \theprob(本题#3分), coltitle=2号色, ] }{ \begin{tcolorbox}[ - common, + common,wrapfig, borderline west={1.5pt}{0mm}{2号色}, - title=\color{2号色}{\problemname} \theprob(本题#3分)\tagname~#2, + title=\color{2号色}{\problemname} \theprob(本题#3分)\hfill\faIcon{tag}~#2, coltitle=2号色, ] } @@ -268,7 +290,6 @@ {\end{tcolorbox}} \RequirePackage{enumerate} -% list/itemize/enumerate setting \RequirePackage[shortlabels,inline]{enumitem} \setlist{nolistsep,leftmargin=1.5em} @@ -279,12 +300,13 @@ \RequirePackage{booktabs} \RequirePackage{paracol} \columnratio{0.67} +% sidebyside,righthand width=\dimeval{\linewidth/4} \RequirePackage{multicol,multirow} \RequirePackage{fancyvrb} %绘图 \RequirePackage{tikz} %% load tikz without tikz -\usetikzlibrary{intersections,decorations.markings,spy,arrows,shapes,fadings,mindmap,shapes.arrows,shapes.symbols,tikzmark,shapes.geometric,graphs,decorations.pathmorphing,through,arrows.meta,shapes.misc,decorations.shapes,angles,backgrounds,calc,math,decorations,decorations.pathreplacing,fit,quotes,shadows,positioning,patterns,shadings} +\usetikzlibrary{intersections,decorations.markings,spy,arrows,shapes,fadings,mindmap,shapes.arrows,shapes.symbols,tikzmark,shapes.geometric,graphs,decorations.pathmorphing,through,arrows.meta,shapes.misc,decorations.shapes,angles,backgrounds,calc,math,decorations,decorations.pathreplacing,fit,quotes,shadows,positioning,patterns} \tikzset{>=stealth,line cap=round,line join=round} \RequirePackage{pgfplots} \pgfplotsset{compat=1.9} @@ -318,15 +340,13 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%chapter图片定制开始%%%%%%%%%%%%%%% +\RequirePackage{titleimage} +\makeatletter \def\chapterimage{\gdef\@chapterimage} \def\@makechapterhead#1{% - \begin{tikzpicture}[remember picture,overlay] - \node[scope fading=south,anchor=north,inner sep=0pt,outer sep=0pt] at (current page.north) {\includegraphics[width=\paperwidth]{\@chapterimage}}; % 图片 - \draw [line width=2pt,2号色!40] ($(current page.north west)-(0,3.5/13*\paperwidth)$) -- ($(current page.north east)-(0,3.5/13*\paperwidth)$); % 上线 - \draw [line width=2pt,2号色!40] ($(current page.north west)-(0,4.5/13*\paperwidth)$) -- ($(current page.north east)-(0,4.5/13*\paperwidth)$); % 下线 - \fill [backgroundcolor!40,opacity=0.5] ($(current page.north west)-(0,3.5/13*\paperwidth)$) rectangle +(\paperwidth,-\paperwidth/13); % 中间 - \node at ($(current page.north west)-(-0.5*\paperwidth,4/13*\paperwidth)$) {\ifcsname @chapterfont\endcsname\CJKfamily{chapterfont}\fi\huge\bfseries#1~\color{2号色}\faIcon{feather-alt}}; % 标题 - \end{tikzpicture}\par + \titleimage[ + \ifcsname @chapterfont\endcsname\CJKfamily{chapterfont}\fi\huge\bfseries#1~\color{2号色}\faIcon{feather-alt}] + {\@chapterimage} \vspace{3.5\paperwidth/13} \thispagestyle{plain} \fancypagestyle{plain}{ @@ -344,6 +364,7 @@ \centering \ifcsname @chapterfont\endcsname\CJKfamily{chapterfont}\fi \huge \bfseries \color{1号色!80!2号色!80!black} #1\par\nobreak \vspace*{1em} } + \makeatother \thispagestyle{plain} \fancypagestyle{plain}{ \fancyhead{} % 页眉清空 @@ -389,11 +410,10 @@ } % document setup +\RequirePackage{siunitx} \def\e{\mathrm{e}} \def\i{\mathrm{i}} -\def\ee#1{\times 10^{#1}} \def\T{\mathsf{T}} -\def\unit#1{\,\mathrm{#1}} \def\mat#1{\mathbf{#1}} \def\rank#1{\text{R}({#1})} \def\QED{\hfill\sffamily Q.E.D. } diff --git a/macros/latex/contrib/litesolution/tex/titleimage.sty b/macros/latex/contrib/litesolution/tex/titleimage.sty new file mode 100644 index 0000000000..0a4972aae1 --- /dev/null +++ b/macros/latex/contrib/litesolution/tex/titleimage.sty @@ -0,0 +1,20 @@ +\NeedsTeXFormat{LaTeX2e}[2020/10/01] +\ProvidesPackage{titleimage}[2024/03/08/ v0.1 Package for adding south-shading full width picture on the top of page.] + +\RequirePackage{tikz,xcolor} +\usetikzlibrary{shadings} +\definecolor{titleline}{HTML}{006E54} % + +\newsavebox\imagebox % goes into the preamble +\NewDocumentCommand{\titleimage}{ o m }{ + \tikz[remember picture,overlay] + { + \node[scope fading=south,anchor=north,inner sep=0pt,outer sep=auto] at (current page.north) {\includegraphics[width=\paperwidth]{#2}}; + \IfNoValueF{#1}{ + \fill [backgroundcolor!40,opacity=0.5] ($(current page.north west)-(0,3.5/13*\paperwidth)$) rectangle +(\paperwidth,-\paperwidth/13); % 中间 + \draw [line width=2pt,titleline!40] ($(current page.north west)-(0,3.5/13*\paperwidth)$) -- ($(current page.north east)-(0,3.5/13*\paperwidth)$); % 上线 + \draw [line width=2pt,titleline!40] ($(current page.north west)-(0,4.5/13*\paperwidth)$) -- ($(current page.north east)-(0,4.5/13*\paperwidth)$); % 下线 + \node at ($(current page.north west)-(-0.5*\paperwidth,4/13*\paperwidth)$) {#1}; + } + } +}
\ No newline at end of file |