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.

Home Page:https://github.com/fmarotta/kaobook

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

marginfigure and margintable do not compile

esarradj opened this issue · comments

Description

If a marginfigure or margintable environment is present, LaTeX stops with an error.

Minimal Working Example

\documentclass{kaobook}
\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage{kaobiblio}
\usepackage{kaotheorems}
\usepackage{kaorefs}

\begin{document}

\title{Bug Report}
\author{Author}
\date{\today}

\frontmatter
\maketitle
\mainmatter
\setchapterstyle{kao}

\chapter{First Chapter}
\blindtext
\begin{marginfigure}
	\blindtext
\end{marginfigure}

\end{document}

Expected behavior:

Should compile without error.

Actual behavior:

Compilation stops with (see below)

...
(Font)              scaled to size 7.76001pt on input line 22.
! Missing number, treated as zero.
<to be read again> 
                   \vskip 
l.22 	\blindtext
                
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)

! Illegal unit of measure (pt inserted).
<to be read again> 
                   \vskip 
l.22 	\blindtext
                
Dimensions can be in units of em, ex, in, pt, pc,
cm, mm, dd, cc, nd, nc, bp, or sp; but yours is a new one!
I'll assume that you meant to say pt, for printer's points.
To recover gracefully from this error, it's best to
delete the erroneous units; e.g., type `2' to delete
two letters. (See Chapter 27 of The TeXbook.)

LaTeX Font Info:    Font shape `OT1/zpltlf/m/n' will be
(Font)              scaled to size 9.70001pt on input line 23.
LaTeX Font Info:    Font shape `OT1/zpltlf/m/n' will be
(Font)              scaled to size 7.08101pt on input line 23.
LaTeX Font Info:    Font shape `OT1/zpltlf/m/n' will be
(Font)              scaled to size 5.335pt on input line 23.

LaTeX Warning: Marginpar on page 1 moved.

! Missing number, treated as zero.
<to be read again> 
                   \vskip 
l.23 \end{marginfigure}
                       
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)

! Illegal unit of measure (pt inserted).
<to be read again> 
                   \vskip 
l.23 \end{marginfigure}
                       
Dimensions can be in units of em, ex, in, pt, pc,
cm, mm, dd, cc, nd, nc, bp, or sp; but yours is a new one!
I'll assume that you meant to say pt, for printer's points.
To recover gracefully from this error, it's best to
delete the erroneous units; e.g., type `2' to delete
two letters. (See Chapter 27 of The TeXbook.)


LaTeX Warning: Marginpar on page 1 moved.

LaTeX Font Info:    Font shape `T1/zpllf/m/sl' will be
(Font)              scaled to size 9.70001pt on input line 25.
\openout4 = `minimal.mw'.

[1



] (./minimal.mw)
\openout4 = `minimal.mw'.

Package atveryend Info: Empty hook `BeforeClearDocument' on input line 25.
Package atveryend Info: Empty hook `AfterLastShipout' on input line 25.
 (./minimal.aux)
Package atveryend Info: Executing hook `AtVeryEndDocument' on input line 25.
Package atveryend Info: Empty hook `AtEndAfterFileList' on input line 25.
\openout4 = `minimal.mw'.

\openout4 = `minimal.mw'.

\openout4 = `minimal.bcf'.
...

Additional Information

The error goes away, if b9300e5 is reverted. Tested on standard Ubuntu 20.04 TeXLive.

I cannot reproduce it, the example compiles fine for me. Which kaobook version are you using?

By the way, the marginfigure environment is not intended for text, but for figures; I don't know if this could be the cause of the problem. If you use \marginnote instead, it might just work (unless you have a particular use-case for putting text in a marginfigure).

I cloned the repo and was using the latest version of kaobook and have tried many earlier versions to detect what the problem was. This way I found also the commit I have reverted to make it work.

I want to use marginfigure for figures indeed. I used text only for the purpose of the MWE.

If it works for and for me not I suspect that it may have something to do with the versions of some packages that may be different. I am using vanilla Ubuntu 20.04 LTS which is updated daily and the present texlive version is 2019.20200218-1

Same error here, and @esarradj's hack works too. The error seems to come from the redefinition of the \marginskip command:

  • If I comment its body (and make it an “empty” command) everything compiles fine with marginfigures.
  • If I put some \marginskip{0pt} in my document, it raises a similar error.

I'm not a LaTeX specialist enough to find out what the problem is...


EDIT: the error comes from the \vspace{#1 - \baselineskip}, if I write \vspace{1cm - \baselineskip} somewhere else it raises the same error. So I temporarily replaced this part with \vspace{#1}\vspace{-\baselineskip}}.