自己定義環境の2つのインスタンス間のスペース

自己定義環境の2つのインスタンス間のスペース

私は自分の演習用の環境を作成しました。問題は、異なる演習 (演習 1、演習 2 など) がある場合、演習の間に常に少しのスペースがあることです。背景色があり、これが中断されているため、非常に見苦しく見えます。色が中断されないように中断をなくしたいのですが、どうすればよいですか? 間にスペースを入れないように LaTeX に教えるために環境の定義を変更する方法がわかりません...

これが私のコードです:

\documentclass{book}
\usepackage{geometry}
\geometry{left=4cm,right=3cm, top=2cm, bottom=2cm} 
\usepackage[ngerman]{babel}
\usepackage[final]{pdfpages} 
\usepackage{xcolor,bookmark}         
\usepackage{graphicx}  
\usepackage{multicol} 
\usepackage[bottom]{footmisc}
\usepackage{shadethm}
\usepackage{amsthm}
\usepackage{amsmath}
\usepackage{paralist}
\usepackage{amssymb}
\usepackage[framemethod=tikz]{mdframed}

\definecolor{aufgaben}{rgb}{0.9333,0.93333,0.933333}

\newtheoremstyle{mystyle2}
  {\topsep}{\topsep}{}{}%
  {\bfseries}{}{.5em}{}%

\theoremstyle{mystyle2}

\newmdtheoremenv[hidealllines=true,
backgroundcolor=aufgaben,skipabove=\topsep,
skipbelow=\topsep]{aufgabe}{Aufgabe}


\begin{document}
text\\ a lot of text\\
\begin{aufgabe}
the excercise
\end{aufgabe}
%no space here! please!
\begin{aufgabe}
the next excercise
\end{aufgabe}
text\\
ext\\
ext\\ really a lot of text\\ text\\ text\\
ext\\ text\\ text\\
\end{document}

(LaTeX ではテキストの量に応じて演習問題が設定されることを知っていますが、ページがテキストでいっぱいの場合、テキスト間に少しスペースが残ります。テキスト間にスペースを入れたくありません。)

答え1

バーバラが気づいたように、コードでは を4回使用しています\topsep\newtheoremstyle

\newtheoremstyle{mystyle2}
  {}{}{}{}%
  {\bfseries}{}{.5em}{}%

したがって、不要なスペース(網掛け部分内)は発生しません。さらに、 の他の2つの例では、と を のように等しくする\newmdtheoremenv必要があります。skipaboveskipbelow0pt

\newmdtheoremenv[hidealllines=true,
backgroundcolor=aufgaben,skipabove=0pt,
skipbelow=0pt]{aufgabe}{Aufgabe}

そしてそれは機能します。

ここに画像の説明を入力してください

関連情報