Skip to content

Marginnote does not work with kaobox #307

@mithunsridharan

Description

@mithunsridharan

Description

When using marginnote with kaobox, Latex throws errors.

Minimal Working Example

\documentclass[12pt]{kaobook}

\begin{document}    
    \begin{kaobox}[title=Some title]
        \blindtext[1]
        \marginnote{This is a note in the margin related to the content inside the case environment.}
        \newline
        \blindtext[1]
    \end{kaobox}    
\end{document}

Expected behavior:
The above Latex code compiles without error and the margin notes are rendered when using kaobox

Actual behavior:
When compiling the code above, I receive the following error:

Example2.tex: error: 10: Float(s) lost. \end{document}

Additional Information

Upon looking into the kao.sty, the issue seems to appear from these lines of code:

% Redefine the command to print marginnotes:
% (a) the optional offset argument goes at the first position
% (b) the offset can also be a multiple of baselineskip, like for snotez's \sidenote
% Usage: \marginnote[<offset>]{Text of the note.}
\let\oldmarginnote\marginnote%
\RenewDocumentCommand\marginnote{ o m }{%
	\IfNoValueOrEmptyTF{#1}{%
		\IfInFloatingEnvir{%
			\oldmarginnote{#2}%
		}{%
			\marginpar{\@margin@par#2}%
		}%
	}{%
		\oldmarginnote{#2}[\kao@if@nblskip{#1}{\@cdr#1\@nil\baselineskip}{#1}]%
	}%
}

Marginpar seems to be the prime suspect here.

@fmarotta: Any workarounds to circumvent this issue?

Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions