5

I wana ask a question. How to make a template latex like this?

enter image description here

5
  • 3
    Welcome to TeX.SX! On this site, a question should typically revolve around an abstract issue (e.g. "How do I get a double horizontal line in a table?") rather than a concrete application (e.g. "How do I make this table?"). Questions that look like "Please do this complicated thing for me" tend to get closed because they are either "off topic", "too broad", or "unclear". Please try to make your question clear and simple by giving a minimal working example (MWE): you'll stand a greater chance of getting help.
    – user31729
    Mar 10, 2015 at 10:17
  • Something like this: tex.stackexchange.com/questions/198255/bclogo-page-breaks
    – user31729
    Mar 10, 2015 at 10:19
  • @SoundsOfSilence well spotted that the bclogo package was used for creating the exercises in the picture! :)
    – cgnieder
    Mar 10, 2015 at 10:29
  • @clemens: Yes, I remembered the logos and that I tried to answer a 'similar' question once (but failed, due to lack of knowledge regarding tikz stuff)
    – user31729
    Mar 10, 2015 at 10:31
  • Alternatively, one could place a minipage inside a tikz node. Mar 10, 2015 at 14:24

1 Answer 1

17

The two boxes can be designed with a number of packages: bclogo, mdframed, tcolorbox; the one having the crayon decoration on the left corresponds to a predefined style from the bclogo package so I defined a new environment for this box using this package; for the other one, I decided to use tcolorbox:

\documentclass[dvipsnames]{article}
\usepackage[tikz]{bclogo}
\usepackage[many]{tcolorbox}
\usepackage{lipsum}

\newtcolorbox{framedex}{
    boxrule=0.8pt,
    enhanced,
    colframe=Maroon,
    colback=white,
    arc=2pt,
    top=10pt,
    attach boxed title to top center={yshift=-2ex},
    boxed title style={
      colback=Maroon,
      arc=2pt,
    },
    title={The title},
}
\newenvironment{framedcrayon}[2][]
  {\begin{bclogo}[
    logo=\bccrayon,
    couleur=yellow!15,
    arrondi=0.1,
    couleurBord=Maroon,#1]{#2}
  }
  {\end{bclogo}}

\begin{document}

\begin{framedex}
\lipsum[4]
\end{framedex}

\begin{framedcrayon}{Title}
\lipsum[4]
\end{framedcrayon}

\end{document}

enter image description here

Just as an example, here's the code required to produce both framed boxes just using bclogo:

\documentclass[dvipsnames]{article}
\usepackage[tikz]{bclogo}
\usepackage{lipsum}

\newenvironment{framedcrayon}[2][]
  {\begin{bclogo}[
    logo=\bccrayon,
    couleur=yellow!15,
    arrondi=0.1,
    couleurBord=Maroon,#1]{#2}
  }
  {\end{bclogo}}

\newenvironment{framedanswer}[2][]
  {\renewcommand\bcStyleTitre[1]{
    \hfill\tikz[overlay]\node[fill=Maroon,align=center,text=white,rounded corners=2pt,yshift=15pt] {\strut##1};\hfill}
    \renewcommand\logowidth{0pt}
   \begin{bclogo}[
    logo=\bccrayon,
    arrondi=0.1,
    epBarre=0,
    couleurBord=Maroon,#1]{#2}
  }
  {\end{bclogo}}

\begin{document}

\begin{framedanswer}{The title}
\lipsum[4]
\end{framedanswer}

\begin{framedcrayon}{Title}
\lipsum[4]
\end{framedcrayon}

\end{document}

enter image description here

2
  • Is there any way to make a list of this boxes. Like to add for the questions / answers boxes a list of boxes at the end of the document? Oct 26, 2015 at 20:57
  • @PeterEbelsberger Yes, Please feel free to open a new question about this. Oct 26, 2015 at 22:27

You must log in to answer this question.

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