尝试为被隔离的孩子们准备家庭学校阅读材料,我很想使用如下环境:
我改编了以下代码在此处输入链接描述 感谢@SebGlav 并做了如下修改。
\documentclass[12pt,openany,twoside,fleqn]{book}
\usepackage{amsmath}
\usepackage{tikz,lipsum}
\usetikzlibrary{shapes.symbols,positioning}
\usepackage{mathspec}
\setmainfont{ITC Berkeley Oldstyle Std}
\setmathsfont(Digits,Greek,Latin){ITC Berkeley Oldstyle Std}
\usepackage{chemfig}
\setlength{\parindent}{0pt}
\definecolor{pina}{HTML}{7B68EE}
\usepackage{enumitem}
%Codes adapted from tex.stackexchange.com/questions/617495/how-to-produce-
fancy-box-in-tcolorbox
%Respect and credit to @SebGlav
\newcounter{examp}
\setcounter{examp}{0}
\newcommand{\mytitlex}[2]%
{%
\stepcounter{examp}
\begin{tikzpicture}[font=\fontspec{Chevin}]
\def\cola{pina}
\node[fill=\cola,anchor=west,minimum height=17mm,minimum width=3.8cm]
at (-1,0) {};
\node[fill=white,line width=2pt,circle,draw=\cola,minimum size=1cm]
at (2.25,-.95) {\thechapter.\theexamp};
\node[text=white,anchor=west,align=center] at (-1,0) {\large\bfseries
CHECK YOUR\\ UNDERSTANDING};
\draw[line width=3pt,\cola](2,.777)--(15,.777);
\end{tikzpicture}
}
\begin{document}
\setcounter{chapter}{1}
\chapter{Alkenes}
\mytitlex{}{}
\begin{enumerate}
\item
\begin{enumerate}[label=\textbf{\alph*}]
\item Explain the
\item Give two
\end{enumerate}
\item Explain the difference
\end{enumerate}
\end{document}
这给了我
我们非常欢迎任何有助于实现理想环境的帮助。
答案1
这个tcolorbox
软件包非常灵活,您几乎可以用它做任何事情。
此解决方案自动对框进行编号,并在每个部分标题处重置编号。没有底部规则(如您的问题中所示),如果不清楚框何时完成,这可能会造成混淆,但可以很容易地添加一个。我选择在中手动绘制顶部规则frame code
,因为绘制规则的方式tcolorbox
在屏幕上查看时往往会留下伪影。
\documentclass{article}
\usepackage{lipsum}
\usepackage{microtype}
\usepackage{roboto}
\usepackage{tcolorbox}
\tcbuselibrary{skins}
\newtcolorbox[auto counter, number within=section]{checkyourunderstanding}{%
enhanced,
before skip=\bigskipamount, after skip=\bigskipamount,
size=minimal, left=2.8cm, top=3mm, toprule=3pt,
colframe=cyan, colbacktitle=cyan, colback=white,
fontupper=\sffamily\small,
title=CHECK YOUR UNDERSTANDING,
attach boxed title to top left={yshift=-\tcboxedtitleheight},
center title, minipage boxed title=2.5cm,
fonttitle=\sffamily\robotocondensed\bfseries\small,
boxed title style={
size=minimal, boxsep=4pt, bottom=5mm,
frame code={
\path[fill=tcbcolback]
(frame.north west) -- ([yshift=2mm]frame.south west) --
([xshift=2mm]frame.south west) -- (frame.south east) --
(frame.north east) -- cycle;
\path[fill=white, draw=tcbcolback, line width=1pt]
([xshift=-5mm-0.5pt]frame.south east) circle [radius=5mm]
node [font=\sffamily\large] {\thetcbcounter};
},
interior engine=empty
},
frame code={
\path[fill=tcbcolframe]
(frame.north west) rectangle ([yshift=-3pt]frame.north east);
}
}
\usepackage{enumitem}
\newcommand*{\listnum}{\sffamily\robotoblack\color{cyan}}
\newcommand*{\textlistnum}[1]{%
\begingroup\listnum #1\endgroup
}
\setlist[enumerate,1]{label=\listnum\arabic*}
\setlist[enumerate,2]{label=\listnum\alph*, leftmargin=1.5em}
\begin{document}
\section{Lorem Ipsum}
\lipsum[1]
\begin{checkyourunderstanding}
\begin{enumerate}
\item
\begin{enumerate}
\item Explain the difference between a physical property and a
chemical property.
\item Give two examples of each type of property.
\end{enumerate}
\item Explain the difference between:
\begin{enumerate}
\item melting and freezing.
\item boiling and evaporating.
\item boiling point and normal boiling point.
\item gas and vapour.
\end{enumerate}
\item Define density. What are the common units for it.
\item Explain how you would decide whether \textlistnum{a} a solid,
\textlistnum{b} a liquid was a pure substance.
\end{enumerate}
\end{checkyourunderstanding}
\lipsum[2]
\end{document}