4

In the code below, how can I apply a \baselineskip=.8cm to the theorem environment? I want to do this somehow in the \mdfdefinestyle or \mdtheorem commands, not in the body every times by hand. Also I don't want to use commands like \linespread or \baselinestretch.

\documentclass{book}
\usepackage{lipsum}
\usepackage[framemethod=TikZ]{mdframed}
\mdfdefinestyle{mystyle}{%
frametitlerulewidth=0pt,
frametitlerule=true,
frametitlefont=\color{black},
frametitlebackgroundcolor=yellow,
}
\mdtheorem[style=mystyle]{theorem}[chapter]{Theorem}

\begin{document}
\lipsum[1]
\begin{theorem}[Pythagorean theorem]
\lipsum[2]
\end{theorem}
\end{document}

2 Answers 2

6

You can do it with startinnercode:

\documentclass{book}
\usepackage{lipsum}
\usepackage[framemethod=TikZ]{mdframed}
\mdfdefinestyle{mystyle}{
  frametitlerulewidth=0pt,
  frametitlerule=true,
  frametitlefont=\color{black},
  frametitlebackgroundcolor=yellow,
  startinnercode={\baselineskip=0.8cm},
}
\mdtheorem[style=mystyle]{theorem}[chapter]{Theorem}

\begin{document}
\lipsum[1]
\begin{theorem}[Pythagorean theorem]
\lipsum[2]
\end{theorem}
\end{document}

However, using \linespread{<factor>}\selectfont is surely better and I can't see why you don't want to use it.

enter image description here

3

I don't know why you don't want these commands. At any chance, I propose to use the set space package, combined with the \AtbeginEnvironment command from etoolbox. I measured the interlinespacing was truly 8mm:

\documentclass{book}

\usepackage{lipsum}
\usepackage[framemethod=TikZ]{mdframed}
\mdfdefinestyle{mystyle}{%
frametitlerulewidth=0pt,
frametitlerule=true,
frametitlefont=\color{black},
frametitlebackgroundcolor=yellow,
}
\mdtheorem[style=mystyle]{theorem}[chapter]{Theorem}
\usepackage{setspace}
\usepackage{etoolbox}
\AtBeginEnvironment{theorem}{\setstretch{1.9}}
\begin{document}

\lipsum[1]
\begin{theorem}[Pythagorean theorem]
\lipsum[2]
\end{theorem}

\end{document} 

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .