fmarotta / kaobook

A LaTeX class for books, reports or theses based on https://github.com/kenohori/thesis and https://github.com/Tufte-LaTeX/tufte-latex.
https://github.com/fmarotta/kaobook
LaTeX Project Public License v1.3c
842 stars 181 forks source link

Number in enumerate in the definition environment overlap #191

Open michelucci opened 2 years ago

michelucci commented 2 years ago

Prerequisites

Description

I wanted to submit a bug related to the fact that if I use the enumerate environment inside a definition environment, the first number (the 1.) overlap with the second (the 2.). I wanted to create a minimal example but I get a strange error with the code below. I downloaded the last GitHub version and made sure that the main.tex in the right root folder is. I have a working installation of this style on overleaf that works beautifully (expect for the problem with enumerate).

Minimal Working Example

\documentclass{kaobook} \begin{document} \chapter{First Chapter} \end{document}

Additional Information

This minimal example does not compile and I get the following error (I am compiling on my machine (a Mac) with TexShop.

/usr/local/texlive/2018/texmf-dist/tex/latex/chngcntr/chngcntr.sty:51: LaTeX Er ror: Command \counterwithin already defined. Or name \end... illegal, see p.192 of the manual.

See the LaTeX manual or LaTeX Companion for explanation. Type H for immediate help. ...

l.51 ...rwithin}{\@ifstar{\c@t@sinstar}{\c@t@sin}}

?

Here is an image of what I mean.

Screenshot 2021-12-09 at 08 16 30
michelucci commented 2 years ago

Ok apparently I found the reason of the problem. This is the code I am using

To start let´s define some concepts that are useful later on.
\begin{definition}[Probability Space]
%\margin{Probability Space}
A \textbf{probability space} (PS) is a mathematical construct that describes formally a random process or experiment. A PS has 3 elements:
\begin{enumerate}
    \item A sample space $S$: the set of all possible outcomes.
    \item An event space $\mathcal{F}$: the set of events of the experiment, an event being a subset of outcomes of $S$.
    \item A probability function $P$ which assign to each event in $\mathcal{F}$ a probability $P$ such that $0\leq P \leq 1$.
\end{enumerate}
\end{definition}

If I uncomment the %\margin{Probability Space} then the problem appears, otherwise is fine and the numbers do not overlap.

I hope this helps in fixing this bug.

By the way thanks a lot for the style. It is wonderful!

Best, Umberto

AlexanderZeilmann commented 2 years ago

The first problem (the one with Command \counterwithin already defined.) can probably be fixed by updating the LaTeX installation or at least the package chngcntr. The package contained a bug that should be fixed now. Maybe updating LaTeX also fixes the overlapping.

Regarding the overlapping: The following code compiles without problems and the numbers do not overlap. Note the use of \marginnote instead of \margin. kaobook does not define \margin.

% !TEX program = xelatex

\documentclass{kaobook}
\usepackage{kaotheorems}
\begin{document}
\chapter{First Chapter}

To start let´s define some concepts that are useful later on.
\begin{definition}[Probability Space]
\marginnote{Probability Space}
A \textbf{probability space} (PS) is a mathematical construct that describes formally a random process or experiment. A PS has 3 elements:
\begin{enumerate}
    \item A sample space $S$: the set of all possible outcomes.
    \item An event space $\mathcal{F}$: the set of events of the experiment, an event being a subset of outcomes of $S$.
    \item A probability function $P$ which assign to each event in $\mathcal{F}$ a probability $P$ such that $0\leq P \leq 1$.
\end{enumerate}
\end{definition}
\end{document}

If you are using pdflatex to compile the document, try xelatex or lualatex as they usually generate fewer problems.