1

How can I style exercises like the one in this book but the exercises numbers should not follow the theorems numbers.

enter image description here

This page is from Lee's introduction to topological manifolds.

3
  • 1
    Looks pretty !!
    – Tarass
    Commented Aug 8, 2015 at 18:00
  • @Tarass Yes. I usually use\newtheorem{exercise}{Exercice}[chapter] and I get something like this. The exercises have exactly the same style as the theorems which isn't pretty.
    – user5402
    Commented Aug 8, 2015 at 18:12
  • There is sevrel ways. do you plan to use amsthm or ntheorem package?
    – touhami
    Commented Aug 8, 2015 at 18:39

1 Answer 1

4

Here is a solution with the ntheorem package:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{fourier}
\usepackage{heuristica}

\usepackage{amsmath}
\usepackage[thmmarks, amsmath, thref]{ntheorem}
\usepackage{cleveref}

\theoremstyle{plain}
\theoremheaderfont{\upshape\bfseries}
\theoremseparator{.}
\theorembodyfont{\itshape}
\newtheorem{prop}{Proposition}[section]
{
\theoremprework{\vskip\dimexpr\topsep+\partopsep\relax\par\ensuremath{\blacktriangleright}\small\vspace*{\dimexpr-\topsep-\baselineskip}\leavevmode}
\theoremindent 2.5em
\theorembodyfont{\upshape}
\newtheorem{exercise}[prop]{Exercise}
}

\theoremstyle{nonumberplain}
\theoremheaderfont{\scshape}
\theorembodyfont{\upshape}
\theoremsymbol{\ensuremath{\square}}
\newtheorem{proof}{Proof}

\begin{document}
\setcounter{section}{3}
\begin{prop}\label{myprop}
  Blah blah blah.
\end{prop}

\begin{proof} [of \cref{myprop}]Since something is true, we have
  \[ A = B. \]
\end{proof}

Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text.
\begin{exercise}
  Prove the preceding proposition. Prove the preceding proposition. Prove the preceding proposition. Prove the preceding proposition.
\end{exercise}

Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text.
\begin{proof}[of some theorem]
  This is a very important proof. Isn't it?
  \begin{align*}
    a & = b \\ c & = d.
  \end{align*}
\end{proof}

\end{document} 

enter image description here

**Added:$$ Here is a corrected code. The problem came froma conflict with hyperef. I reorganised the order of the theorems.

\documentclass[a4paper, francais, 12pt]{book}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{fourier}
\usepackage{amssymb}
\usepackage{bbding} % for checkmarks and XSolidBrush in itemize http://ftp.cc.uoc.gr/mirrors/CTAN/info/symbols/comprehensive/symbols-a4.pdf
\usepackage{babel}
\usepackage{mathtools}
\DeclareMathOperator{\arccot}{arccot} 
\usepackage{xcolor}
\usepackage{graphicx}
\usepackage[thmmarks, amsmath, thref, hyperref]{ntheorem}
 \usepackage[pdftex,pdfauthor={Elie Nasrallah}, pdftitle={Mathematiques Elementaires}, pdfpagemode={UseOutlines}, bookmarks, bookmarksopen, bookmarksnumbered, pdfstartview={FitH}, colorlinks, linkcolor={blue}, citecolor={blue}, urlcolor={red}]{hyperref}
\usepackage{cleveref}

\theoremstyle{plain}
\theoremheaderfont{\upshape\bfseries}
\theoremseparator{.}
\theorembodyfont{\itshape}
\newtheorem{theorem}{Theorem}[chapter]
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{corollary}[theorem]{Corollaire}
\newtheorem{lemma}[theorem]{Lemme}
\theorembodyfont{\upshape}
\newtheorem{definition}{Définition}[chapter]
\newtheorem{exercise}{Exercice}[chapter]
\newtheorem{example}{Exemple}[chapter]
\newtheorem{remark}{Remarque}[chapter]
\theoremprework{\vskip\dimexpr\topsep+\partopsep \relax\par\ensuremath{\blacktriangleright}\small\vspace*{\dimexpr-\topsep-\baselineskip}\leavevmode}
\theoremindent 2.5em
\theoremstyle{nonumberplain}
\theoremheaderfont{\scshape}
\theorembodyfont{\upshape}
\theoremsymbol{\ensuremath{\square}}

\newtheorem{proof}{Démonstration}
\newtheorem{solution}{S}

\begin{document}

\chapter{Fonction réelle d'une variable réelle}

\section{Limites et asymptotes}

\begin{proposition}
Si $f(x)<g(x)$ sur un voisinage de $x_0$ alors $\lim\limits_{x\to x_0}f(x)\leq \lim\limits_{x\to x_0}g(x)$.
 \end{proposition}


\begin{exercise}
wfsafasfaf
\end{exercise}

 \end{document} 
4
  • I says file heuristica.sty not found.
    – user5402
    Commented Aug 8, 2015 at 19:04
  • That is not essential: it is a font package for text, which is an extension of Adobe Utopia (on which fourier is based). It adds true small caps, superior and inferior numbers. It's in the preamble just because I built my code starting from an old file of mine. You can remove it, or install it. If you want to install, note it's still better to install erewhon instead, from the same author.
    – Bernard
    Commented Aug 8, 2015 at 19:22
  • 1
    It's a problem with hyperref, it was necessary to add the option hyperref to ntheorem, and load hyperref *before* the first theorem declaration. Furthermore, your theorem declarations were placed in such a way that they all would be displayed in upshape font and all would have an end-of-proof symbol. I suppose this is not what you want. See (and understand) the corrected code. Another comment: times` is obsolete. If you want to use this font, load mathptmx, or better newtxtext and newtxmath. In the meantime, I let fourier, which you'll have to remove if you want to use times.
    – Bernard
    Commented Aug 8, 2015 at 20:14
  • You're welcome. For theorems layout, you should take a look at the documentation of ntheorem. Also, at the cleveref documentation, it can help saving some typing for cross-references.
    – Bernard
    Commented Aug 8, 2015 at 20:20

You must log in to answer this question.

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