4

I get many times things that are somehow related to the main topic and should be separated by blue background, for instance.

I do at the moment only

\documentclass{article}
\newtheorem{theorem}{Theorem}
\newtheorem{question}[theorem]{Question}
\begin{document}
\begin{question}
Lorem ipsum?
\end{question}
\end{document}

I get like this

enter image description here

where the question -environment only adds the question mark to the front. I think there is some problem because the environment should be numbered, first of all.

How can you make distinguish the question environment better?

6

There are many ways, and it all depends on the desired final layout. Below, two options: one using the standard quote environment; the other one using mdframed:

\documentclass{article}
\usepackage[framemethod=tikz]{mdframed}
\usepackage{lipsum}

\newmdenv[linecolor=cyan,backgroundcolor=cyan!20]{question}

\begin{document}

\lipsum[2]
\begin{quote}
\lipsum[2]
\end{quote}
\lipsum[2]
\begin{question}
\lipsum[2]
\end{question}
\lipsum[2]

\end{document}

enter image description here

And with tcolorbox:

\documentclass{article}
\usepackage{tcolorbox}
\tcbuselibrary{most}
\usepackage{lipsum}

\newtcolorbox{question}{breakable,colframe=cyan,colback=cyan!20}

\begin{document}

\lipsum[2]
\begin{question}
\lipsum[2]
\end{question}
\lipsum[2]

\end{document}

enter image description here

Another option using a list through changepage:

\documentclass{article}
\usepackage{changepage}
\usepackage{lipsum}

\newenvironment{question}
  {\par\smallskip\begin{adjustwidth}{1em}{1em}\small\itshape}
  {\end{adjustwidth}\par\smallskip}

\begin{document}

\lipsum[2]
\begin{question}
\lipsum[2]
\end{question}
\lipsum[2]

\end{document}

enter image description here

The options using mdframed and tcolorbox offer you many customization possibilities; please refer to the documentation of the packages.

For example, you can define your structure as a theorem-like block using, for example, amsthm and then surround it with a mdframed:

\documentclass{article}
\usepackage[framemethod=tikz]{mdframed}
\usepackage{amsthm}
\usepackage{lipsum}

\newtheorem{question}{Question}
\mdfdefinestyle{que}{
  linecolor=cyan,
  backgroundcolor=cyan!20,
}
\surroundwithmdframed[style=que]{question}

\begin{document}

\lipsum[2]
\begin{question}
\lipsum[2]
\end{question}
\lipsum[2]

\end{document}

enter image description here

A numbered structure with tcolorbox:

\documentclass{article}
\usepackage{tcolorbox}
\usepackage{lipsum}

\newtcolorbox[auto counter]
  {question}
  {colback=cyan!20,colframe=cyan,fonttitle=\bfseries,
  title=Question~\thetcbcounter}

\begin{document}

\lipsum[2]
\begin{question}
\lipsum[2]
\end{question}
\lipsum[2]

\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.