我想要一个像这样的锻炼环境。
以下代码-Latex 产生
\documentclass[a4paper,12pt,pdftext]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[french]{babel}
\usepackage[margin=0.5in]{geometry}
\usepackage{amsthm,amsmath}
\usepackage{tikz,lipsum,lmodern}
\usepackage{xcolor}
\usepackage{multicol}
\usepackage{enumitem}
\usepackage[most]{tcolorbox}
\tcbuselibrary{theorems, breakable, skins}
%%%%%%%%%%%%%%---exercices style------%%%%%%%%%%%%%%%%%%%%%%
\newtheorem{Exercice}{Exercice}%[section]
\newtheoremstyle{defn-break}%
{\topsep}{\topsep} {\normalfont\itshape}{0pt} {\bfseries}{} {\newline}{} % Switch to the newly-defined theorem style \theoremstyle{defn-break}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\begin{Exercice}
let $n$ be an integer, we pose
\[A=n^{2}+3n+4\]
\begin{enumerate}[label=\textbf{\fbox{\arabic*}}]
\item Show $A$ is an odd.
\item Deduce that $A$ is not prime.
\end{enumerate}
\end{Exercice}
\end{document}
答案1
我必须承认我发现这种风格非常令人不快,但您可以使用 thmtools 来实现以下方法:
\documentclass[a4paper,12pt]{article}
\usepackage[T1]{fontenc}
\usepackage[french]{babel}
\usepackage[margin=0.5in]{geometry}
\usepackage{amsthm,amsmath}
\usepackage{enumitem}
\usepackage{thmtools}
%%%%%%%%%%%%%%---exercices style------%%%%%%%%%%%%%%%%%%%%%%
\declaretheoremstyle[
break,
headstyle=\fbox{\NAME\,\fbox{\NUMBER}\NOTE}\vspace{2ex},
headpunct={},
spaceabove=3ex,
]{mybreak}
\declaretheorem[style=mybreak]{Exercice}
\begin{document}
\begin{Exercice}
Let $n$ be an integer, we pose
\[A=n^{2}+3n+4\]
\begin{enumerate}[label=\textbf{\fbox{\arabic*}}]
\item Show $A$ is an odd.
\item Deduce that $A$ is not prime.
\end{enumerate}
\end{Exercice}
\begin{Exercice}
Let $n$ be an integer, we pose
\[A=n^{2}+3n+4\]
\begin{enumerate}[label=\textbf{\fbox{\arabic*}}]
\item Show $A$ is an odd.
\item Deduce that $A$ is not prime.
\end{enumerate}
\end{Exercice}
\end{document}