0

I would like to create the following style to write mathematics:

designpage

In fact the above I created myself but some numbers and spacing I had to set manually (and I would like this to be automatic of course).

So the following are important to me:

  • I want the page to consists of 'notes' that are numbered like 1.1, 1.2 etc., where the first number refers to the section/paragraph (so in my example there are four notes in section 1). With every note I want to have the possibility to add a title that appears boldface (for example note 1.1).
  • Within a note I want to have the possibility to add a theorem-like environment (in my example you can find 'remark', 'lemma' etc.). Preferably I would like to have one single command for this, and then the possibility to name it the way I want (so lemma or proposition or maybe something else). Also I want them to be numbered within the note they occur (see example), unless I choose them to be non-numbered (so in my example the 'remark' is not numbered).
  • Between these theorem-like environments I want to include some small space (I chose \medskip in the example). But I don't want this space to get doubled whenever I have two of these environments one after the other.
  • Last but not least: I want the title of a section, the first word of a note, and the heading of the theorem-like environments to be aligned (say one paragraph indent).

Any help or advice is appreciated. Of course, partial solutions are also welcome and I can provide details in case something is not clear.

Thanks a lot in advance! AYK

  • 1
    You're requesting a lot of things, but provide nothing ;-) The amsthm package shows how to make theorems, as well as ntheorem – user31729 Jun 21 '15 at 16:59
  • Because I don't know how to fix the numbering within the notes. This is my main problem so you can forget about the rest if I asked too much. – AYK Jun 21 '15 at 17:04
  • Is there any reason why ‘Proposition’ and ‘Remark’ use an em-dash as a separator with the following text, while ‘ Definition’ and ‘Lemma’ don't? – Bernard Jun 21 '15 at 17:07
  • All of them (should) use em-dash, I don't see a difference between the ones you mention. – AYK Jun 21 '15 at 17:10
2

This might be an approximation to your wish; however, I find the numbering scheme too fussy: I see no reason for statements to be numbered under notes.

If \newnote is immediately followed by \begin, a theorem-like statement is assumed.

\documentclass{article}

\usepackage{amsthm}
\usepackage{thmtools}
\usepackage{chngcntr}

\usepackage{lipsum}

\makeatletter
\newif\ifnotebegin
\newcounter{note}[section]
\renewcommand{\thenote}{\thesection.\arabic{note}}
\newcommand{\newnote}{\@ifnextchar\begin\xnew@note\new@note}
\newcommand{\new@note}[1][]{%
  \par\addvspace{\topsep}%
  \refstepcounter{note}%
  \global\notebeginfalse
  \noindent\formatnote{#1}%
}
\newcommand{\formatnote}[1]{%
  \makebox[\parindent][l]{\normalfont\bfseries\thenote}%
  \if\relax\detokenize{#1}\relax\else\textbf{#1}\ \fi
}
\newcommand{\xnew@note}{%
  \refstepcounter{note}%
  \global\notebegintrue
}
\newcommand\notenumberorindent{%
  \ifnotebegin
    \formatnote{}%
  \else
    \hspace*{\parindent}%
  \fi
  \global\notebeginfalse
}
\makeatother

\declaretheoremstyle[
  headfont=\normalfont\itshape,
  notefont=\normalfont\itshape,
  bodyfont=\normalfont\itshape,
  notebraces={\textnormal{(}}{\textnormal{)}},
  headformat=\notenumberorindent\NAME\ \textup{({\bfseries\NUMBER})}\NOTE,
  headpunct=\ ---,
]{ayk}

\declaretheorem[
  style=ayk,
  within=note,
  name=Lemma,
]{lemma}
\declaretheorem[
  style=ayk,
  sibling=lemma,
  name=Proposition,
]{proposition}

\counterwithin{equation}{lemma}
\AtBeginDocument{\setlength{\parindent}{2em}}

\begin{document}

\section{First notes}

\newnote[Hello]
\lipsum[2]

\begin{lemma}[Some Lemma]
A lemma about something
A lemma about something
A lemma about something
A lemma about something
\end{lemma}

\begin{lemma}
Some other lemma Bla bla
\end{lemma}

\begin{proposition}
Some Proposition
\begin{equation}
  E = mc^2 
\end{equation}
\end{proposition}

\newnote
This note has no title. \lipsum[2]

\begin{lemma}[Some Lemma]
A lemma about something
A lemma about something
A lemma about something
A lemma about something
\end{lemma}

\begin{lemma}
Some other lemma Bla bla
\end{lemma}

\begin{proposition}
Some Proposition
\begin{equation}
  E = mc^2 
\end{equation}
\end{proposition}

\newnote\begin{lemma}[Some Lemma]
A lemma about something
A lemma about something
A lemma about something
A lemma about something
\end{lemma}

\begin{lemma}
Some other lemma Bla bla
\end{lemma}

\begin{proposition}
Some Proposition
\begin{equation}
  E = mc^2 
\end{equation}
\end{proposition}

\end{document}

enter image description here

  • This is an offense to my eyes ;-) – user31729 Jun 21 '15 at 20:37
  • This has been amazingly useful, wow! I would like to ask you the following: - Is it possible to make also 'unnumbered versions' of the theorem-like environments? For example, is it possible that I have a the usual commands and a 'starred version' to get the same environment without numbering (since I would like to chose which environments get numbered). - How to make the section heading also start exactly after 1 paragraph indent? - How can I change the spacing between the notes to my own taste? Again, thanks a lot! I am learning new stuff by examing your code. – AYK Jun 21 '15 at 20:48
  • @AYK With thmtools it's quite easy; add the option numbered=no to \declaretheorem. For the spacing, change \topsep to \baselineskip. Sorry, but I won't change my answer for aspects that are completely out of the question, like section titles. – egreg Jun 21 '15 at 20:51
  • Ok I will create unnumbered declaretheorems. And what about the spacing between the 'notes'? Since I am a tex-noob I am not able to find the exact parameters in your code. – AYK Jun 21 '15 at 20:55
  • @AYK Change \addvspace{\topsep} to \addvspace{\baselineskip} – egreg Jun 21 '15 at 20:59
2

Only preliminary solution... indentation not done yet.

\newtheorem{foo}{Foo}[section] will define an environment named foo, titled Foo and a counter named (you guess it -- foo ;-)), which is reset each time the section counter is stepped.

\newtheorem{otherfoo}[foo]{Otherfoo} will define an environment named otherfoo, titled Otherfoo and no counter -- it will use the counter foo instead, i.e. foo and otherfoo share the counters.

Since the counter formats should be changed, this has to be done manually, counterwithin from chngcntr is no help, here, in my point of view.

\documentclass{article}

%\usepackage{chngcntr}
\usepackage{amsthm}

%\usepackage{xpatch}

\newtheorem{notes}{Note}[section]
\newtheorem{lemma}{\normalfont\textit{Lemma}}[notes]
\newtheorem{proposition}[lemma]{\normalfont\textit{Proposition}}

\renewcommand{\thelemma}{(\thenotes.\arabic{lemma})}
\renewcommand{\theequation}{\thenotes.\arabic{lemma}.\arabic{equation}}


\usepackage{blindtext}
\begin{document}

\section{First notes}

\begin{notes}{Hello}
\blindtext
\begin{lemma}{Some Lemma}
\blindtext
\end{lemma}

\begin{lemma}{Some other lemma}
Bla bla
\end{lemma}

\begin{proposition}{Some Proposition}
\begin{equation}
  E = mc^2 
\end{equation}
\end{proposition}

\begin{proposition}{Some Proposition}
\begin{equation}
  E^2 = (mc^2)^2 +\left(pc\right)^2
\end{equation}

\end{proposition}

\end{notes}


\end{document}

enter image description here

  • I'll update later on – user31729 Jun 21 '15 at 17:45
2

A solution based on ntheorem, mathtools and etoolbox:

\documentclass[twoside,a4paper,11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{amsfonts}
\usepackage[hmargin=3cm]{geometry}
\setlength\parindent{1.1cm}
\usepackage{microtype}
\usepackage{mathtools, amssymb}
\newtagform{bold}{\bfseries(}{)}
\usetagform{bold}
\usepackage{etoolbox}
\usepackage{titlesec}
\titleformat{\section}{\Large\bfseries}{\rlap{§\thesection.}}{1.1cm}{\lsstyle\MakeUppercase}
\titleformat{\subsection}[runin]{\normalsize\bfseries}{\rlap{\thesubsection.}}{1.1cm}{\mbox{}}
\usepackage[thref, amsmath, thmmarks]{ntheorem}%
\makeatletter
\newtheoremstyle{myplain}%
{\item[\hskip\labelsep \theorem@headerfont ##1\ \textup{\bfseries(##2)}\ \theorem@separator]}%
{\item[\hskip\labelsep \theorem@headerfont ##1\ \textup{\bfseries(##2)}\ (##3)\theorem@separator]}
\makeatother
\theoremstyle{myplain}
\theoremheaderfont{\itshape}
\theorembodyfont{\itshape}
\theoremseparator{\textemdash}
\newtheorem{lemma}{\hspace*{1.1cm}Lemma}[subsection]%
\newtheorem{prop}[lemma]{Proposition}
\newtheorem{defn}[lemma]{Definition}

\theoremstyle{nonumberplain}
\theorembodyfont{\upshape}
\theoremseparator{ \textemdash}
\newtheorem{remark}{\hspace*{1.1cm}Remark}
\theoremsymbol{\ensuremath{\diamondsuit}}
\newtheorem{proof}{\hspace*{1.1cm}Proof}

\usepackage{lipsum}
\usepackage{cleveref}

\newcommand\note[1][]{\subsection{#1}\ifblank{#1}{\hskip-\labelsep}{\relax}}% 

\usepackage{chngcntr}
\counterwithin{equation}{lemma}

\begin{document}

\section{Some section}
\note[Some optional title]
\lipsum[1]

\note[]
\lipsum[3]

\begin{remark}
\lipsum[5]
\end{remark}

\note
\lipsum[4]
\begin{lemma}\label{lemma1}\lipsum[3]
\end{lemma}

\begin{proof}
A brilliant proof. Blah blah blah. A brilliant proof. Blah blah blah. A brilliant proof. Blah blah blah. A brilliant proof with an unlikely final formula
 \[n! \sim_\infty \sqrt{2\pi n}\Bigl(\frac{n}{\mathrm e}\Bigr)^n.\] %
\end{proof}
\lipsum[5]
\begin{prop}A very interesting proposition, with an amazing formula:
\begin{equation}\label{quadratic}
  x_0 ,x_1 =\frac{-b\pm\sqrt{b^2-4ac}}{2a}
\end{equation}
\end{prop}

\end{document} 

enter image description here enter image description here

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.