-1

People. Sorry about the English language.

I created an environment with some help here, and now I need help with the counter.

\newcounter{examplecounter}
\newenvironment{exemplo}{\begin{framed}\noindent \refstepcounter{examplecounter} {\textbf{Exemplo \arabic{examplecounter}.}} }{\end{framed}}

I'm using this environment on a large book, so i need to reset the counter by part, by section, or (if possible) even make it just like the part numbering, like example part.chapter.#

How can I do that?

Sebastiano
  • 54,118

1 Answers1

1

I would simply load the ntheorem and framed packages and use this declaration in the preamble:

\theoremheaderfont{\bfseries}
\theorembodyfont{\upshape}
\theoremseparator\newline}
\newframedtheorem{example}{Exemplo}[\part]
Bernard
  • 271,350
  • I got an error with that code...

    /usr/share/texlive/texmf-dist/tex/latex/ntheorem/ntheorem.sty:524: Package nthe orem Error: Theorem style plain already defined.

    See the ntheorem package documentation for explanation. Type H for immediate help. ...

    l.524 ...rfont ##1\ ##2\ (##3)\theorem@separator]}

    – Gustav Beier Oct 25 '16 at 12:04
  • Maybe you're loading amstheorem? – Bernard Oct 25 '16 at 12:05
  • Yeah ;-; now i'm trying again, with "\theoremseparator{\newline}" – Gustav Beier Oct 25 '16 at 12:06
  • ntheorem conflicts with amsthm since they touch upon the same environments. However, ntheorem has a amsthm compatibility mode (and it should be loaded with the amsmath option; thethmmarks option activates the end-of-proof symbol automatic placement). – Bernard Oct 25 '16 at 12:36