2

I am trying to compile exercises into on sheet of paper each, and treat the Exercises as Chapter. enter image description here

And then I will

\begin{enumerate}
\item Hi Mom
\item Hi Dad
\item Hi there
\end{enumerate}

inside the box. My ability is just

\documentclass[10pt,a4paper]{article}

\usepackage{amsmath,mdframed}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx,tikz}
\begin{document}
\begin{mdframed}
\chapter{hmmm}
\begin{enumerate}
\item 
\end{enumerate}
\end{mdframed}
\end{document}
2
  • 1
    And the question is...? I am pretty sure that mdframed provides numbered boxes and there's no need to 'misuse' the \chapter command for this. Apart from the fact, there's no \chapter macro in article ;-)
    – user31729
    Dec 28, 2015 at 8:17
  • ah! Right! Thanks for pointing out \chapter in article!!!!
    – Panha
    Dec 28, 2015 at 9:58

1 Answer 1

1

The question requested mdframed, but I am more familiar with tcolorbox that's why used that package

This does not really use the \chapter command, but the chapter counter (if really needed) and makes an entry to the ToC.

\documentclass[10pt,a4paper]{book}

\usepackage{amsmath,mdframed}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage[most]{tcolorbox}
\usepackage{graphicx,tikz}


\newtcolorbox[use counter=chapter]{exercisebox}[2][]{%
  before={\cleardoublepage\thispagestyle{empty}\addcontentsline{toc}{chapter}{\protect\numberline{\thechapter}#2}},
  enhanced,
  attach boxed title to top center={yshift=-2mm},
  title={\chaptername\ \thetcbcounter~#2},
  breakable,
  sharp corners,
  colback=white,
  colbacktitle={blue!50!white},
  #1,
}

\begin{document}
\tableofcontents
\cleardoublepage
\pagestyle{plain}
\begin{exercisebox}{hmmm}
\begin{enumerate}
\item 
\end{enumerate}
\end{exercisebox}

\begin{exercisebox}{Another question}
\begin{enumerate}
\item 
\end{enumerate}
\end{exercisebox}

\end{document}

enter image description here

1
  • 2
    Dear complainers (and there will be some, I bet): Of course using a separate counter instead of chapter will be much better, but the logical design request is by the O.P. and not my invention
    – user31729
    Dec 28, 2015 at 8:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .