1

I would like to create a LaTeX document with math problems and their solutions, where the statement of each problem goes inside a box like this one: This is the image of the box I want

How can I produce this result (or a similar one) in LaTeX?

3
  • 7
    Take a look at the tcolorbox package.
    – erik
    Feb 17, 2017 at 18:07
  • 2
    With the knowledge that tcolorbox can produce this type of output, can you put some effort into trying to reproduce it? If you're still stuck after that, post the code that you've tried and the experts here will take that as foundation.
    – Werner
    Feb 17, 2017 at 18:16
  • Of course, I wasn't trying for someone else to do all the work, I just needed a hint, I'm going to try now and see if I can figure it out. I had no idea that the tcolorbox package existed, thank you very much! Feb 17, 2017 at 18:18

1 Answer 1

4

Just in case it helps someone else, this was my solution using the tcolorbox package:

\documentclass[a4paper,12pt]{article}
\usepackage[dvipsnames]{xcolor}
\usepackage{tikz,lipsum,lmodern}
\usepackage[most]{tcolorbox}
\begin{document} 
\begin{tcolorbox}[
  colback=Magenta!5!white,
  colframe=Magenta!75!black,
  title={\centering Homework}]
The math problem should be here...
\end{tcolorbox}
\end{document}

The output is a colored box very similar to the one I posted in my question.

2
  • 2
    tcolorbox is a tikz based package, no need to load tikz beforehand, as well as title={Homework},halign title=center is a little bit cleaner than title={\centering Homework}
    – user31729
    Feb 17, 2017 at 18:54
  • 1
    Thank you very much! :) Mar 8, 2022 at 17:40

You must log in to answer this question.

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