7

I want to change the border color of the mdframe box. By default it take black.

\documentclass{article}
\usepackage{xcolor}
\usepackage{mdframed}
\newtheorem{mdtheorem}{Theorem}
 \newenvironment{theorem}%
 {\begin{mdframed}[backgroundcolor=lightgray]\begin{mdtheorem}}%
 {\end{mdtheorem}\end{mdframed}}
 \begin{document}
 \begin{theorem}
Sample
\end{theorem}
 \end{document} 
  1. My Default output is, enter image description here

  2. My Expected output is, enter image description here

Any one suggest me the correct. I am new to LaTeX.

13

The correct way to define a new theorem environment with mdframed is through the \newmdtheoremenv command.

The option to change the color of the frame border is linecolor. If you also want to change the width of the border, use the option linewidth.

If you then want to show only the bottom of the border, set to false the options topline, rightline, and leftline.

Here is a MWE:

\documentclass{article}
\usepackage{xcolor}
\usepackage{mdframed}

\newmdtheoremenv[%
  backgroundcolor=lightgray,
  linecolor=red!60!black,
  linewidth=2pt,
  topline=false,
  rightline=false,
  leftline=false]{theorem}{Theorem}

\begin{document}
\begin{theorem}
Sample
\end{theorem}
\end{document} 

Output:

enter image description here

  • I want to set the bottom line in that environment...@karlkoeller. – PSK Mar 6 '14 at 13:40
  • @PSK Oh, I see. Answer edited. – karlkoeller Mar 6 '14 at 13:44

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.