定义框的颜色

定义框的颜色

前言

\RequirePackage{fancybox,xcolor,tcolorbox,enumitem,amsmath,amssymb,amsfonts,mathtools,mathrsfs,graphicx,tikz,pgfplots,multicol,tabularx,longtable,array,multirow,hhline,colortbl,booktabs,caption,subcaption,wrapfig,float,framed,mdframed,environ,etoolbox,ifthen,calc,marvosym,pifont,wasysym,fontawesome,hyperref}

定义框的颜色

\definecolor{deepgreen}{RGB}{0,100,0}
\definecolor{deeporange}{RGB}{255,140,0}

定义框的通用选项

\tcbset{
  boxstyle/.style={
    enhanced,
    colback=white,
    colbacktitle=#1,
    coltitle=white,
    fonttitle=\bfseries,
    attach boxed title to top left={xshift=5mm,yshift*=-\tcboxedtitleheight/2},
    boxed title style={
      boxrule=0pt,
      frame hidden,
      size=small,
      rounded corners
    },
    boxrule=1pt,
    arc=5mm,
    breakable,
    pad at break*=2mm
  }
}

# Define the environments for the boxes
\newtcbenvironment{intro}{title}{%
  boxstyle=deepgreen,
  colframe=deepgreen,
  title=#1
}{}

\newtcbenvironment{test}{title}{%
  boxstyle=deeporange,
  colframe=deeporange,
  title=#1
}{}

# Define the commands for the questions and tests
\newcommand{\fillin}[2]{%
  \ifthenelse{\equal{#2}{}}{%
    \underline{\hspace{#1}}%
  }{%
    \underline{\makebox[#1][c]{#2}}%
  }%
}

\newcommand{\mcq}[5]{%
  \begin{enumerate}[label=\Alph*.]
    \item #1
    \item #2
    \item #3
    \item #4
  \end{enumerate}
  \ifthenelse{\equal{#5}{}}{}{%
    \textbf{Answer:} #5
  }%
}

\newcommand{\msq}[5]{%
  \begin{enumerate}[label=\arabic*.]
    \item #1
    \item #2
    \item #3
    \item #4
  \end{enumerate}
  \ifthenelse{\equal{#5}{}}{}{%
    \textbf{Answer:} #5
  }%
}

\newcommand{\match}[3]{%
  \begin{tabularx}{\linewidth}{@{}XX@{}}
    \begin{enumerate}[label=\arabic*.]
      #1
    \end{enumerate} &
    \begin{enumerate}[label=\alph*.]
      #2
    \end{enumerate} \\
  \end{tabularx}
  \ifthenelse{\equal{#3}{}}{}{%
    \textbf{Answer:} #3
  }%
}

\newcommand{\wordcloud}[2]{%
  \begin{tikzpicture}
    \node[inner sep=0pt] at (0,0) {\includegraphics[width=\linewidth]{#1}};
  \end{tikzpicture}
  \ifthenelse{\equal{#2}{}}{}{%
    \textbf{Answer:} #2
  }%
}

\newcommand{\puzzle}[2]{%
  \begin{tikzpicture}
    \node[inner sep=0pt] at (0,0) {\includegraphics[width=\linewidth]{#1}};
  \end{tikzpicture}
  \ifthenelse{\equal{#2}{}}{}{%
    \textbf{Answer:} #2
  }%
}

\newcommand{\shortanswer}[2]{%
  \textbf{Question:} #1

  \textbf{Answer:} #2
}

\newcommand{\longanswer}[2]{%
  \textbf{Question:} #1

  \textbf{Answer:}

  \begin{tcolorbox}[breakable,colback=deeporange!10,colframe=deeporange]
    #2
  \end{tcolorbox}
}

\newcommand{\wordproblem}[2]{%
  \textbf{Problem:} #1

  \textbf{Solution:}

  \begin{tcolorbox}[enhanced,colback=deepgreen!10,colframe=deepgreen,sharp corners]
    #2
  \end{tcolorbox}
}

结束序言

相关内容