1

Using the mdframed package (with [frame-method=tikz]) I can create a new environment that resets every chapter with

\newmdtheoremenv[<options>]{myenv}[<numberedlike>]{Sample}[chapter]

The MWE below shows this in use where the output "Samples" are labelled 2.1, 2.2, etc. How do I change the numbering format to be 2-1, 2-2, etc.?

\documentclass{book}

\usepackage{ntheorem}
\usepackage[framemethod=tikz]{mdframed}

\newmdtheoremenv{myenv}{Sample}[chapter]
% or \theoremenv{myenv}{Sample}[chapter]

\begin{document}
\chapter{First chapter}
Chapter content
\chapter{Second chapter}
Chapter content with samples
\begin{myenv}
My first sample
\end{myenv}
\begin{myenv}
My second sample
\end{myenv}
\end{document}

1 Answer 1

1

Somewhere in the preamble add the lines

\makeatletter
\renewcommand\@thmcountersep{-}
\makeatother

enter image description here

\documentclass{book}
\makeatletter
\renewcommand\@thmcountersep{-}
\makeatother
\usepackage{ntheorem}
\usepackage[framemethod=tikz]{mdframed}
\newmdtheoremenv{myenv}{Sample}[chapter]
\begin{document}
\chapter{First chapter}
Chapter content
\chapter{Second chapter}
Chapter content with samples
\begin{myenv}
My first sample
\end{myenv}
\begin{myenv}
My second sample
\end{myenv}
\end{document}

You must log in to answer this question.

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