效果
测试效果源代码
先额外记一点存文本块的代码,基本可以原样展示命令
\begin{verbatim}
\begin{document}
\end{document}
\end{verbatim}
效果图的代码
\documentclass{article}
\usepackage{tikz}
\usepackage{xcolor}
\usepackage{environ}
\usepackage{amsthm}
\usepackage{amsmath,mathrsfs,amsfonts}
\usepackage{xparse}
\usepackage{tcolorbox}
\tcbuselibrary{skins, breakable, theorems}
\usetikzlibrary{shapes,decorations}
\definecolor{bule}{RGB}{18,29,57}
\definecolor{bablue}{RGB}{248,248,248}
\definecolor{main}{RGB}{127,191,51}
\definecolor{seco}{RGB}{0,145,215}
\definecolor{thid}{RGB}{180,27,131}
\newcommand{\newfancytheoremstyle}[5]{%
\tikzset{#1/.style={draw=#3, fill=#2,very thick,rectangle,
rounded corners, inner sep=10pt, inner ysep=20pt}}
\tikzset{#1title/.style={fill=#3, text=#2}}
\expandafter\def\csname #1headstyle\endcsname{#4}
\expandafter\def\csname #1bodystyle\endcsname{#5}
}
\newfancytheoremstyle{fancythrm}{blue!10}{seco}{\bfseries\sffamily}{\sffamily}
\makeatletter
\DeclareDocumentCommand{\newfancytheorem}{ O{\@empty} m m m O{fancythrm} }{%
% define the counter for the theorem
\ifx#1\@empty
\newcounter{#2}
\else
\newcounter{#2}[#1]
\numberwithin{#2}{#1}
\fi
%% define the "newthem" environment
\NewEnviron{#2}[1][{}]{%
\noindent\centering
\begin{tikzpicture}
\node[#5] (box){
\begin{minipage}{0.93\columnwidth}
\csname #5bodystyle\endcsname \BODY~##1
\end{minipage}};
\node[#5title, right=10pt] at (box.north west){
{\csname #5headstyle\endcsname #3 \stepcounter{#2}\csname the#2\endcsname\; ##1}};
\node[#5title, rounded corners] at (box.east) {#4};
\end{tikzpicture}
}[\par\vspace{.5\baselineskip}]
}
\makeatother
% Define new styles
% \newfancytheoremstyle{<name>}{inner color}{outer color}{head style}{body style}
\newfancytheoremstyle{fancydef}{green!10}{green}{\itshape\sffamily}{\sffamily}
% Define some new environments
% \newfancytheorem[<number within>]{<name>}{<head>}{<symbol>}[<style>]
%\newfancytheorem[chapter]{newthem}{Theorem}{$\clubsuit$}
%\newfancytheorem[section]{newthem}{Theorem}{$\clubsuit$}
\newfancytheorem[section]{newthem}{dingli}{•}
\newfancytheorem[section]{newcor}{Corollary}{$\heartsuit$}
\newfancytheorem{newdef}{Definition}{$\spadesuit$}[fancydef]
%% 我自己尝试搞定理环境
\newtheorem{definition}{\textcolor{blue}{definition}}[section]
\renewcommand{\thedefinition}{\textcolor{red}{\thesection.\arabic{definition}}}
%\renewcommand{\thedefinition}{\textcolor{blue}{\thedefinition.\arabic{definition}}}
\newcommand{\newTheStyle}[1]{
\begin{tcolorbox}[colback=white!5!white,colframe=green!75!white]
\textbf{#1}
\end{tcolorbox}
}
\newenvironment{dingli}[1][\introductionname]{
\begin{tcolorbox}[colback=white!5!white,colframe=green!75!white]
\begin{definition}
\bfseries
%\textbf{#1}
}
{
\end{definition}
\end{tcolorbox}}
\begin{document}
\section{test}
\begin{newthem}
test
\end{newthem}
\begin{newcor}
test
\end{newcor}
\begin{newdef}
test
\end{newdef}
\section{tcolorbox}
\begin{tcolorbox}[colback=white!5!white,colframe=green!75!white]
tcolorbox tcolorbox\\
tcolorbox
\end{tcolorbox}
\begin{tcolorbox}[colback=white!5!white,colframe=red!73!white]
tcolorbox tcolorbox\\
tcolorbox
\end{tcolorbox}
\section{newstyle}
\begin{newTheStyle}
555
\end{newTheStyle}
\begin{dingli}
testettt
\end{dingli}
\end{document}
参考
LaTeX教学2.8 计数器;
tcolorboxのお誘い;
tcolorbox 宏包简明教程
优美的LaTeX书籍模板中的定理样式
网友评论