Tell me more ×
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.

I wish to customise my theorem style to something like the one shown, but I couldn,t figure a universal definition of parameters. Some suggestions?

enter image description here

The code:

\documentclass{article}
\usepackage{tikz}

\newcommand\Loadedframemethod{TikZ}
\usepackage[framemethod=\Loadedframemethod]{mdframed}
\tikzstyle{titregris} =
     [draw=gray, thick, fill=white, shading = exersicetitle, %
      text=black, rectangle, rounded corners, right,minimum height=.7cm]
\pgfdeclarehorizontalshading{exersicebackground}{100bp}
          {color(0bp)=(white); color(100bp)=(white!5)}
\pgfdeclarehorizontalshading{exersicetitle}{100bp}
          {color(0bp)=(white);color(100bp)=(black!5)}
\newcounter{exercise}
\renewcommand*\theexercise{Example:~\arabic{exercise}}
\makeatletter
\def\mdf@@exercisepoints{}%new mdframed key:
\define@key{mdf}{exercisepoints}{%
    \def\mdf@@exercisepoints{#1}
}
\mdfdefinestyle{exercisestyle}{%
  outerlinewidth=1em,outerlinecolor=white,%
  leftmargin=-1em,rightmargin=-1em,%
  middlelinewidth=1.2pt,roundcorner=5pt,linecolor=gray,
  apptotikzsetting={\tikzset{mdfbackground/.append style ={%
                       shading = exersicebackground}}},
  innertopmargin=1.2\baselineskip,
  skipabove={\dimexpr0.5\baselineskip+\topskip\relax},
  skipbelow={-1em},
  needspace=3\baselineskip,
  frametitlefont=\sffamily\bfseries,
  settings={\global\stepcounter{exercise}},
  singleextra={%
      \node[titregris,xshift=1cm] at (P-|O) %
         {~\mdf@frametitlefont{\theexercise}~};
      \ifdefempty{\mdf@@exercisepoints}%
      {}%
      {\node[titregris,left,xshift=-1cm] at (P)%
        {~\mdf@frametitlefont{\mdf@@exercisepoints points}~};}%
   },
  firstextra={%
      \node[titregris,xshift=1cm] at (P-|O) %
         {~\mdf@frametitlefont{\theexercise}~};
      \ifdefempty{\mdf@@exercisepoints}%
      {}%
      {\node[titregris,left,xshift=-1cm] at (P)%
        {~\mdf@frametitlefont{\mdf@@exercisepoints points}~};}%
   },
}
\makeatother


\begin{document}

\begin{mdframed}[style=exercisestyle]
Near what I want
\end{mdframed}

\end{document}
share|improve this question
6  
Hi. See e.g.: mdframed. The package provides a lot of examples. You can also use the search function of tex.sx to find more examples. BTW: Your name irritates me. The typesetting system is written LaTeX. – Marco Daniel Feb 8 at 21:20
2  
Maybe another interesting package would be the thmbox-package. It doesn't exactly the style you showed as an example but something similar. – Stephan Lukasczyk Feb 9 at 9:29
@user21778 A small number of account names are 'not a great plan', and as Marco says 'LaTeX' is one of them. I've reset your account name to the default: feel free to edit it, but do bear in mind that there are a few names that don't really work! – Joseph Wright Feb 12 at 14:17
@MarcoDaniel, I have included my attempt in my question,I cant figure out how to do the line breaking on the sides. – user21778 Feb 12 at 14:18

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.