5

I created a new envrionment and it looks good, but I want to distinguish between normalfont and cursive font, so here is my code:

\newshadetheorem{beispiele}{Beispiel}
\newenvironment{beispiel}[1][]{%
  \definecolor{shadethmcolor}{rgb}{.9,.9,.95}%
  \definecolor{shaderulecolor}{rgb}{0.0,0.0,0.4}%
  \setlength{\shadeboxrule}{1.5pt}%
  \begin{beispiele}[#1]\hspace*{1mm}%
}{\end{beispiele}}

and the output is with the font cursive, but I want to have it with normalfont, so not cursive, could you help me?

Thanks a lot!

Here we go:

\documentclass{book}
\usepackage{geometry}

\geometry{left=4cm,right=3cm, top=2cm, bottom=2cm} 

\usepackage{titlesec}
\titlespacing*{\chapter}{0pt}{-30pt}{20pt}
\titleformat{\chapter}[display]{\normalfont\huge\bfseries}{\chaptertitlename\ \thechapter}{20pt}{\Huge}


\usepackage[ngerman]{babel}
\usepackage{mathptmx}
\usepackage{helvet}
\usepackage{wallpaper}
\usepackage{color}
\usepackage[final]{pdfpages} 
%,bookmarksopenlevel={1}
%\usepackage[bookmarks=true,bookmarksopen=true,bookmarksnumbered=true,colorlinks=true,linkcolor=black,]{hyperref}
\usepackage[colorlinks,linkcolor=black,bookmarksopen=false,
hypertexnames=TRUE,pdfpagelabels=true]{hyperref}
\hypersetup{ 
  pdftitle={},
  pdfauthor={\textcopyright },
  pdfsubject={}, 
  pdfkeywords={}, 
  }

\usepackage{xcolor,bookmark}
\usepackage{scrextend}
\usepackage{titlepic}
\usepackage{shorttoc}
\usepackage{courier}
%
\usepackage{type1cm}         



\usepackage{makeidx}         % allows index generation

\usepackage{graphicx}        % standard LaTeX graphics tool
                             % when including figure files
\usepackage{multicol}        % used for the two-column index
\usepackage[bottom]{footmisc}% places footnotes at page bottom
\usepackage{tocstyle}
\usetocstyle{allwithdot} 
%\usepackage{thmbox}
\usepackage{shadethm}
\usepackage{amsthm} 
%\usetocstyle{KOMAlike}


\makeindex             % used for the subject index
                       % please use the style svind.ist with
                       % your makeindex program


\setcounter{tocdepth}{4}
\setcounter{secnumdepth}{4}


%\theoremstyle{plain}
%\theoremstyle{remark}
%\newtheorem{beispiel}{Beispiel}[chapter]
\newshadetheorem{beispiele}{Beispiel}
\newenvironment{beispiel}[1][]{%
  \definecolor{shadethmcolor}{rgb}{.9,.9,.95}%
  \definecolor{shaderulecolor}{rgb}{1,1,1}%
  \setlength{\shadeboxrule}{1.5pt}%
  \begin{beispiele}[#1]\hspace*{1mm}%
}{\end{beispiele}}

\begin{document}
\begin{beispiel}
Test
\end{beispiel}
\end{document}
Thorsten
  • 12,872

1 Answers1

5

The shadedthm package cooperates with amsthm, so you can use the later to define a theorem style incorporating the necessary style modifications; a little example (for the example I removed the packages that were not relevant):

\documentclass{book}
\usepackage{xcolor,bookmark}
\usepackage{shadethm}
\usepackage{amsthm}
\usepackage{lipsum}% just to generate text for the example

\newtheoremstyle{mystyle}
  {\topsep}{\topsep}{}{}%
  {\bfseries}{:}{.5em}{}%

\theoremstyle{mystyle}
\newshadetheorem{beispiele}{Beispiel}

\newenvironment{beispiel}[1][]
  {\definecolor{shadethmcolor}{rgb}{.9,.9,.95}%
    \definecolor{shaderulecolor}{rgb}{1,1,1}%
    \setlength{\shadeboxrule}{1.5pt}%
    \begin{beispiele}[#1]\hspace*{1mm}}
  {\end{beispiele}}

\begin{document}

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

\end{document}

enter image description here

Using the shadethm package you will have some limitations since pagebreaks cannot occur inside an environment created with newshadedtheorem; to get rid of this limitation I would suggest you to use the mdframed package instead (it is highly customizable, handles page breaks, the documentation comes with numerous examples), Here's your environment using mdframed:

\documentclass{book}
\usepackage{xcolor,bookmark}
\usepackage{amsthm}
\usepackage{mdframed}
\usepackage{lipsum}% just to generate text for the example

\definecolor{shadethmcolor}{rgb}{.9,.9,.95}%

\newtheoremstyle{mystyle}
  {\topsep}{\topsep}{}{}%
  {\bfseries}{:}{.5em}{}%

\theoremstyle{mystyle}
\newmdtheoremenv[hidealllines=true,
backgroundcolor=shadethmcolor,skipabove=\topsep,
skipbelow=\topsep]{beispiel}{Beispiel}

\begin{document}

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

\end{document}

enter image description here

Gonzalo Medina
  • 505,128