Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

My current set up for type setting definitions is

\newenvironment{definition}[1][Definition:]{\begin{trivlist}                         
  \item[\hskip \labelsep {\bfseries #1}]}{\end{trivlist}}

which produces

enter image description here

I don't really like this look but I don't want my definitions to look like the my physicals laws which are done in the mdframed package with the option framemethod = tikz

\begin{mdframed}[backgroundcolor = gray!30,
  frametitle = Oberth effect]
  Is where the use of a rocket engine when traveling at high speed generates
  much more useful energy than one at low speed.
\end{mdframed}

and look like

enter image description here

Are there any suggestions on what I can do have the definition environment not be so plain but not mimic the look of the mdframed environment?

\documentclass{article}
\usepackage[framemethod = tikz]{mdframed}
\newenvironment{definition}[1][Definition:]{\begin{trivlist}                         
      \item[\hskip \labelsep {\bfseries #1}]}{\end{trivlist}}
\begin{document}
\begin{definition}
This is a definition.
\end{definition}
\begin{mdframed}[backgroundcolor = gray!30,
  frametitle = Oberth effect]
  Is where the use of a rocket engine when traveling at high speed generates
  much more useful energy than one at low speed.
\end{mdframed}
\end{document}
share|improve this question
2  
Please make your code compilable. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to help you. Help them help you: remove that one hurdle between you and a solution to your problem. –  Jubobs Jul 20 '13 at 23:40
    
At least give us some hints about the desired look :-) I am thinking about at least 20-30 possibilities right now, but I don't want to spend much time providing options that won't be useful. Are we allowed to use tcolorbox, for example? –  Gonzalo Medina Jul 20 '13 at 23:58
    
@GonzaloMedina I am not familiar with tcolorbox. What does that offer? I didn't have anything in particular in mind. I was just going over my document I am still working on and noticed that the definitions don't stand out if you glance over the document. –  dustin Jul 21 '13 at 0:00
    
tcolorbox offers also the possibility to have fancy boxes, in some aspects overlaps the functionality of mdframed, but in some aspects can be more flexible. –  Gonzalo Medina Jul 21 '13 at 0:08
    
@GonzaloMedina Thanks. I just looked over the documentation. –  dustin Jul 21 '13 at 0:12
add comment

1 Answer 1

up vote 31 down vote accepted
+50

Some options of an endless selection (I chose to restrict the color to gray shades so to keep some consistency with the existing environment and to keep the document sober); I used mdframed for some examples and tcolorbox for others; any of the examples could have been produced with either of these two powerful packages.

First, using mdframed:

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

\newtheoremstyle{defi}
  {\topsep}%
  {\topsep}%
  {\normalfont}%
  {}%
  {\bfseries}% 
  {:}%
  {.5em}%
  {\thmname{#1}\thmnote{~(#3)}}%
\theoremstyle{defi}
\newmdtheoremenv{definitioni}{Definition}
\newmdtheoremenv[
hidealllines=true,
leftline=true,
innertopmargin=0pt,
innerbottommargin=0pt,
linewidth=4pt,
linecolor=gray!40,
innerrightmargin=0pt,
]{definitionii}{Definition}
\newmdtheoremenv[
roundcorner=5pt,
innertopmargin=0pt,
innerbottommargin=5pt,
linewidth=4pt,
linecolor=gray!40,
]{definitioniii}{Definition}

\begin{document}

\begin{mdframed}[backgroundcolor = gray!30,
  frametitle = Oberth effect]
  Is where the use of a rocket engine when traveling at high speed generates
  much more useful energy than one at low speed.
\end{mdframed}

\begin{definitionii}
\lipsum[4]
\end{definitionii}
\begin{definitioni}
\lipsum[4]
\end{definitioni}
\begin{definitioniii}
\lipsum[4]
\end{definitioniii}

\end{document}

enter image description here

Another option:

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

\newtheoremstyle{defi}
  {\topsep}%
  {\topsep}%
  {\normalfont}%
  {}%
  {\bfseries}% 
  {:}%
  {.5em}%
  {\thmname{#1}\thmnote{~(#3)}}%
\theoremstyle{defi}
\newmdtheoremenv[
hidealllines=true,
innertopmargin=0pt,
linewidth=4pt,
linecolor=gray!40,
singleextra={
  \draw[line width=3pt,gray!50,line cap=rect] (O|-P) -- +(1cm,0pt);
  \draw[line width=3pt,gray!50,line cap=rect] (O|-P) -- +(0pt,-1cm);
  \draw[line width=3pt,gray!50,line cap=rect] (O-|P) -- +(-1cm,0pt);
  \draw[line width=3pt,gray!50,line cap=rect] (O-|P) -- +(0pt,1cm);
  },
firstextra={
  \draw[line width=3pt,gray!50,line cap=rect] (O|-P) -- +(1cm,0pt);
  \draw[line width=3pt,gray!50,line cap=rect] (O|-P) -- +(0pt,-1cm);
},
secondextra={
  \draw[line width=3pt,gray!50,line cap=rect] (O-|P) -- +(-1cm,0pt);
  \draw[line width=3pt,gray!50,line cap=rect] (O-|P) -- +(0pt,1cm);
}
]{definitioni}{Definition}

\begin{document}

\begin{mdframed}[backgroundcolor = gray!30,
  frametitle = Oberth effect]
  Is where the use of a rocket engine when traveling at high speed generates
  much more useful energy than one at low speed.
\end{mdframed}

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

\end{document}

enter image description here

Another option:

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

\newmdenv[
innertopmargin=0pt,
roundcorner=5pt,
linewidth=1pt,
linecolor=gray!40,
innertopmargin=\baselineskip,
singleextra={
  \node[
    anchor=west,
    xshift=7pt,
    fill=gray!20,
    rounded corners=2pt,
    draw] at (P-|O) {\bfseries Definition:};
},
firstextra={
  \node[
    anchor=west,
    xshift=7pt,
    fill=gray!20,
    rounded corners=2pt,
    draw] at (P-|O) {\bfseries Definition:};
}
]{definition}

\begin{document}

\begin{mdframed}[backgroundcolor = gray!30,
  frametitle = Oberth effect]
  Is where the use of a rocket engine when traveling at high speed generates
  much more useful energy than one at low speed.
\end{mdframed}

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

\end{document}

enter image description here

And now some more options using the tcolorbox package:

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

\newtcolorbox{definitioni}{
  breakable,
  fonttitle=\bfseries,
  title={Definition:}
}
\newtcolorbox{definitionii}{
  skin=enhanced,
  breakable,
  colback=white,
  colframe=gray!30,
  coltitle=black,
  fonttitle=\bfseries,
  leftrule=0.5cm,
  arc=0pt,
  outer arc=0pt,
  title={Definition:}
}
\newtcolorbox{definitioniii}{
  skin=enhanced,
  breakable,
  fonttitle=\bfseries,
  colback=white,
  arc=0pt,
  outer arc=0pt,
  title={Definition:},
  shadow={1mm}{-1mm}{0mm}{fill=gray,opacity=0.5,sharp corners}
}

\begin{document}

\begin{mdframed}[backgroundcolor = gray!30,
  frametitle = Oberth effect]
  Is where the use of a rocket engine when traveling at high speed generates
  much more useful energy than one at low speed.
\end{mdframed}

\begin{definitioni}
\lipsum[4]
\end{definitioni}
\begin{definitionii}
\lipsum[4]
\end{definitionii}
\begin{definitioniii}
\lipsum[4]
\end{definitioniii}

\end{document}

enter image description here

And another one:

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

\newtcolorbox{definition}{
freelance,
breakable,
before=\par\vspace{2\bigskipamount}\noindent,
after=\par\bigskip,
frame code={
  \node[
  anchor=south west,
  inner xsep=8pt,
  xshift=8pt,
  rounded corners=5pt,
  font=\bfseries\color{white},
  fill=gray] at (frame.north west) (tit) {\strut Definition:};
  \draw[
  line width=3pt,
  rounded corners=5pt,gray
  ] (tit.west) -| (frame.south west) -- ([xshift=15pt]frame.south west);
},
interior code={},
top=2pt
}

\begin{document}

\begin{mdframed}[backgroundcolor = gray!30,
  frametitle = Oberth effect]
  Is where the use of a rocket engine when traveling at high speed generates
  much more useful energy than one at low speed.
\end{mdframed}

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

\end{document}

enter image description here

share|improve this answer
1  
@dustin OK. I think I'll add some others more. –  Gonzalo Medina Jul 21 '13 at 0:15
    
@GonzaloMedina I'm not able to reproduce your various styles. Among other things, there is no vertical white space between the examples given. I've copied and pasted your examples and tried compiling both via pdflatex and through latex->dvips->ps2pdf. Any ideas why my results would come out differently? –  A.Ellett Jul 21 '13 at 0:20
    
@A.Ellett perhaps different versions of mdframed? In my system I have mdframed.sty 2013/07/01 1.9b: mdframed. –  Gonzalo Medina Jul 21 '13 at 0:33
    
@dustin I added some more options (the last three ones using tcolorbox). –  Gonzalo Medina Jul 21 '13 at 0:33
2  
That is great. I will award a bounty to you when the post will let me. –  dustin Jul 21 '13 at 0:34
show 6 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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