Coder Social home page Coder Social logo

fmarotta / kaobook Goto Github PK

View Code? Open in Web Editor NEW
781.0 23.0 166.0 23.72 MB

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

License: LaTeX Project Public License v1.3c

TeX 100.00%
kaobook latex latex-template latex-class book thesis

kaobook's Introduction

kaobook

Acknowledgements

This class is based on the work of Ken Arroyo Ohori for his doctoral thesis. The main ideas behind the layout can be found in this blog post. The Tufte-LaTeX class has also been a source of ideas about the layout.

My gratitude goes also to Vel, for his patience and his invaluable suggestions about the design, and to all the people who have contributed either on GitHub or by sending e-mails.

Description

The salient features of the class are as follows.

  • Wide margin to house captions, small figures or tables, and textual notes.

  • Mini table of contents in the margin at the start of each chapter.

  • Easily-customisable chapter headings.

  • Flexible citations with references both in the margin and in the bibliography at the end.

  • Powered by KOMA-Script.

  • Many commands have been redefined to ease the life of the user.

A better description can be found at LaTeX Templates. If you think that a PDF is worth a thousand words, have a look at this.

Showcase

In the examples directory you can find some sample documents, but here are some more books or reports created with the kaobook class. If you want to add a link to your work, please send me an email or open a pull request!

Getting Started

If you are not familiar with LaTeX, I recommend starting with this tutorial, which will give you a basic understanding of the language. As you will read in the tutorial, all LaTeX documents, including books, start by defining the so-called class of the document, for example 'article', or 'book'. Thus, the first line of a LaTeX document will be something like

\documentclass{book}

Each class provides a unique style and set of commands that can be used throughout the document. kaobook is just another class. The following paragraphs will outline how to use it.

On Overleaf

Browse to the latextemplates.com page for kaobook and start editing the main.tex file to fill it with your own contents.

On your computer

Download the latest release from GitHub. At the root of the repository, create a new .tex file and make sure that the first line reads \documentclass{kaobook} (for books) or \documentclass{kaohandt} (for reports). Then, fill the file with your LaTeX contents.

Important: when we say \documentclass{kaobook}, LaTeX needs to know where the kaobook file is. This means that the .tex file should be in the same folder as the kaobook.cls file, i.e. at the root of the repository. (There are exceptions to this rule. For instance, the kaobook files can be placed in a folder that is automatically searched by LaTeX. This, way, the .tex file with your contents can be placed anywhere; check out the instructions directory for hints.)

If you don't want to start from scratch, go to the examples directory, and find a template that you like; then, copy the corresponding main.tex at the root of the repository, and start editing it, filling it with your contents.

Other

Check out the instructions directory for additional guidance. There, you can read about setting up your own sharelatex server or integrating kaobook with your local LaTeX installation.


The class is documented and exemplified in the example_and_documentation.pdf file. The easiest way to start using the class is to open one of the examples and start editing them.

Compiling the examples

In the examples directory of this repository you can find several documents exemplifying the kaobook class. For the sake of simplicity I shall list the commands to compile only the documentation, but the compilation of the other examples would proceed in the same way. Also, you can replace pdflatex with your favorite engine, like e.g. xelatex.

From the command line (Unix-like operating systems)

cd into the root of the repository, and run

pdflatex -output-directory examples/documentation main.tex
biber -output-directory examples/documentation main
pdflatex -output-directory examples/documentation main.tex
pdflatex -output-directory examples/documentation main.tex
pdflatex -output-directory examples/documentation main.tex

To compile the glossary and nomenclature as well, cd into the examples/documentation directory and run

makeindex main.nlo -s nomencl.ist -o main.nls
makeglossaries main

Then, cd back into the root of the repository and re-run pdflatex.

NOTE: sometimes LaTeX needs more than one run to get the correct position of each element; this is true in particular for the positioning of floating elements like figures, tables, and margin notes. Occasionally, LaTeX can need up to four re-runs, so If the alignment of margin elements looks odd, or if they bleed into ther main text, try running pdflatex one more time.

Updating kaobook

To update kaobook you should download the whole repository (or one of the releases) again, and replace all of your old files with the newer ones, except for the main.tex and the files that you have created, like the chapters of the book. The crucial files that pertain to kaobook and that you should always update are:

  1. kaobook.cls;
  2. kaohandt.cls;
  3. kao.sty;
  4. kaobiblio.sty (optional);
  5. kaorefs.sty (optional);
  6. kaotheorems.sty (optional);

These files should be in the same folder as your main.tex. Even if a file has not been modified, I would still suggest to replace everything because it is easier.

In practice, I would do as follows. I would have a directory, called for example 'my_book', with all the files necessary for the book: kaobook.cls, kaohand.cls, the *.sty files, and the main.tex. I like to have a separate file for each chapter, so I would also have a directory called chapters, with all the .tex files with the actual chapters. Then, when I want to update kaobook, I would download the GitHub repository (or one of the releases) into a directory called 'kaobook', and finally copy the kaobook.cls, kaohandt.cls, and the whole styles directory from 'kaobook' to 'my_book'. Once the update is completed, the whole 'my_book' directory can be uploaded on Overleaf or on a personal ShareLaTeX server.

Alternatively, advanced users can download the repository in their local texmf tree; see the instructions directory for hints.

Repository Schema

There are two main class files: kaobook.cls, used for books, and kaohandt.cls, used for reports or handouts; both heavily rely on kao.sty, which contains the bulk of the definitions that are common to both classes. In the future there may be another class for theses.

Some examples and templates are listed in the examples directory. The book that documents the class is an example itself, and the pdf has been copied to the root of the repository so that it will be found more easily.

The *.sty files contain additional packages that are used by the class, but in principle they are independent of it (even though in practice it is still not so).

If you want to do something more peculiar, the instructions directory may contain what you need.

Contributing

Do you like the design, but you found a bug? Is there something you would have done differently? Any contribution is welcome! Moreover, even if you'd rather not tamper with the code it is not forbidden to send me the documents you compiled using the kaobook class.

Since the content of this repository is published at LaTeX Templates, if you wish to contribute by changing the code you must follow the style guidelines of the site: extensive commenting and clear separation of the code into nicely formatted blocks.

Supporting

I am always happy to help as much as I can, and I am glad if someone uses the kaobook class for their works, so there is no real need to do anything: the kaobook can be used just like any other LaTeX package (no need to add copyright statements). However, if you want to acknowledge kaobook, adding somewhere a sentence like 'This book was typeset with the kaobook class' would suffice.

Coffee keeps me awake and helps me writing a better LaTeX template. As another way to contribute, you can buy me a coffee through PayPal: https://paypal.me/marofede.

License

This repository contains two independent works. On the one hand, the kaobook class, consisting of kaobook.cls, kaohandt.cls, and kao.def files plus all of the files listed in the styles directory; on the other hand, the templates and the examples in the examples directory.

The first work is licensed under the LaTeX Project Public License, so if you want to modify and/or distribute the *.cls and *.sty files pertaining to this work you have to complain with the terms of the license. However, if you just want to use the class to compile your documents you need not worry about the license.

The second work is released into the public domain with a Creative Commons Zero License.

Read MANIFEST.md for the details.

kaobook's People

Contributors

alexanderzeilmann avatar bcw avatar bradyneal avatar dettorer avatar ericson2314 avatar fmarotta avatar gehring avatar gsilano avatar hugoledoux avatar luisberndt avatar maxdrohde avatar mevenbertrand avatar mskoenz avatar nikgul avatar nikosavola avatar pi8027 avatar smetzler avatar tbm avatar theowinterhalter avatar velnz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kaobook's Issues

Margin Listings Support

Sry for again proposing something ^^

I really like the \margintable and \marginfigure and needed the same for listings, since it would be ideal for shorter example code or small summary listings.

So I modified kao.def and added

% Environment to hold a margin listing (from the sidenotes package)
\newsavebox{\@sidenotes@marginlistingbox}
\newenvironment{marginlisting}[1][0pt]{ % The optional parameter is the vertical offset
    \FloatBarrier % Force LaTeX to place previous floats
    \mparshift{\snotez@if@nblskip{#1}{\@cdr#1\@nil\baselineskip}{#1}} % Move the listing up or down according to the offset argument
    \begin{lrbox}{\@sidenotes@marginlistingbox}
        \begin{minipage}{\marginparwidth}
            %\captionsetup{type=listing,style=marginlisting}
            \captionsetup{type=listing}
            \centering
}{
        \end{minipage}
    \end{lrbox}
    \marginpar{\usebox{\@sidenotes@marginlistingbox}} % Place the listing box in the margin
}

right after the margin table definition. Really the only thing that's different is that it should say Listing X.Y instead of Table X.Y.

This works for "normal" listings:

\begin{marginlisting}
    \caption{Awesome Code}
    \begin{lstlisting}{bash}
        ls -la
    \end{lstlisting}
\end{marginlisting}

and for minted listings:

\begin{marginlisting}
    \caption{Awesome Code}
    \begin{minted}{bash}
        ls -la
    \end{minted}
\end{marginlisting}

Again, I just post it here if somebody else needs it and leave it up to the author if this is an enhancement or would just bloat the template...

Citation in margin

Hello,

Many thanks for your work. I'm using kaobook, and it's more a question than an issue :

I would like to that the citations in the margin appear as Author (Date), with the citation style as numeric (citestyle=numeric-comp, leading to [1], [5-8]). So, I've modified the kaobiblio.sty to

% Command to format the marginnote created for cited items
\NewDocumentCommand{\formatmargincitation}{m}{% The parameter is a single citation key
	\parencite{#1}: \citeauthor*{#1} (\citeyear{#1})\\%, \citetitle{#1}\\
}

which is fine. However, I would like to have the final reference as sorted (sorting=nyt). This leads to (as normal) to citation numbers following the alphabetical order, and thus citation numbers like: [20, 3, 7]

What should I do in order to put a citation number in the text like a footnote number (1, then 2, then 3, etc), keeping the \sidecite behaviour?

ex:

-----text part---------                                     --------- margin -----------
blabalalala 1 blblbalal                                     1: Author1 (Date1)
blabla 2 blablabla                                           2: Author2 (Date2)

while keeping the reference alphabetically sorted ?

index with no working hyperlinks

Hello,

I am trying to generate an index at the end of the document including hyperlinks on the page numbers that take me to the respective page. I indeed get the index with the correct page numbers but no working hyperlinks.

Any help would be appreciated.

Jose Lopez

Margin Caption for Listings

First off, thx for the amazing template!!

I'm currently trying to copy the caption behavior from figures and tables in the margin, to
listings as well, but I'm not versed well enogh in latex yet.

I would ideally like to do the follwing and have the caption in the margin:

\begin{lstlisting}[caption={My Caption}]
... some code...
\end{lstlisting}

I'll post the "workaround" in case I get it working.
Maybe a future enhancement if more people need it?

Cheers
Mario

Renumbering of sidenotes within each chapter

Dear Federico,

I would like to have the sidenotes starting from 1 in each chapter.
I have uncommented the following line from the file "style.sty":

\counterwithin*{sidenote}{chapter} % Uncomment to reset the sidenote counter at each chapter

When I compile (typeset) the files through Texworks (Miktex 2.9), there are
two problems:
First:
The above command does not make the re-numbering within each chapter;

Second:
Sidenotes for chapter 1 are numbered 1 and 2;
Sidenotes for chapter 2 are numbered 5 and 6;
Sidenotes for chapter 3 are has only 9 and 10.

When I compile the files using the commands in the file "compileall.sh":
((Please notice that somehow I cannot execute the file "compileall.sh" on its own. So, I run the commands line by line)):

After running the following command:
pdflatex -interaction=nonstopmode main
I get the following results:

Sidenotes for chapter 1 are numbered 1 and 2, but in the middle of page;
Sidenotes for chapter 2 is shown only for the second sidenote, numbered as 2, but
half of the sidenote is visible in the margin;
Sidenotes for chapter is shown only for the second sidenote, numbered as 2, but
half of the sidenote is visible in the margin;

Then running the following commands:
makeindex main.nlo -s nomencl.ist -o main.nls
makeindex main
biber main
pdflatex main
makeglossaries main
I (obviously) see no change.

Finnaly, after running the final command
pdflatex main
Everything goes back to the wrong re-numbering, i.e.

Sidenotes for chapter 1 are numbered 1 and 2;
Sidenotes for chapter 2 are numbered 5 and 6;
Sidenotes for chapter 3 are has only 9 and 10.

Is this a bug, or do I do something wrong?
Regards,
Hossein Jorjani

minted support possible

Minted is an alternative package for listings, and I would like to have the captions in the margins as well, as for the "normal" listings.

\usepackage[outputdir=build]{minted}

...

\begin{listing} % a command from minted, not to be confused with lstlisting
\begin{minted}{python}
import numpy as np
\end{minted}
\caption{Awesome}
\end{listing}

Support can be achieved by copying the two sections in kao.def

\floatsetup[lstlisting]{
...
}

each right underneath each other and changing lstlisting to listing, ending up with:

\floatsetup[lstlisting]{
...
}
\floatsetup[listing]{
...
}

I'm not sure if this is something the template should handle, since not everyone wants minted imported, and sniffing if it is imported and then adding these lines could result in nasty include dependency errors? Again, my latex-skills are basic, but I assume this kind of plugin issue is the same there.

I will leave it up to the author to close this issue without action, since I dont really see need, just posting it for fellow writer with the same issue/question.

Used version: (10f04de)

Proper way to change fonts

I'm trying to write my thesis using your awesome package (thanks!), but I don't know the proper way to use a custom font.

I've tried using

\usepackage{fontspec}
\setmainfont[Ligatures=TeX]{Fira Sans}

It compiles without even a warning on these lines, but it clearly isn't using the font.

I know fontspec isn't available for pdflatex so I build with xelatex instead (and so far it works pretty well, except it ignores my fonts). However, considering there is issue #23 I assume it might be related to things that aren't supported right now.

Why GPL-licenced?

Hello,

I have a question regarding the license you are using. What is the reason you for choosing the GPL license? From what I have read, it means that I have to publish my book in source form as GPL if using this template, because it is a derived work.

In your example latex file, you are showing a CC0 license ... so I am unsure what your intention of the GPL license is. Could you please explain it to me? I really like your template and would love to use it, but I am not willing to publish the latex-sources of my work under GPL.

kind regards,
Dion

Bibliography

Dear Federico,

I wanted to have the name of the authors and the publication year in the text. I made 3 small changes to the file "kaobook.cls"

\RequirePackage[
... deleted stuff ...
citestyle=numeric-comp, CHANGED TO citestyle=authoryear,
bibstyle=numeric, CHANGED TO bibstyle=authoryear,
sorting=none, CHANGED TO sorting=nyt,
... deleted stuff ...
]{biblatex}

This gave me the desired effect :-)

One questions:
Now, it is only the year that is highlighted in green and clickable.
Is it possible to have an option that makes the author name also highlighted and clickable.

Regards,
Hossein Jorjani

Wrong output of minidocument

I'm trying to use the [minidocument] package in my document to do a sort of "how to read" section.
However it doesn't render as hoped.
Capture d’écran 2020-04-29 à 14 38 58
As you can see the lines and margin are misplaced.

I produce it using this

\begin{minidocument}
  \setchapterstyle{kao}
  \chapter{Dummy chapter}

  \blindtext~\sidecite{something}

  \marginnote[1cm]{\blindtext}
  \marginnote[4cm]{\blindtext}
  \marginnote[10cm]{\blindtext}
  \Blindtext
\end{minidocument}

\begin{figure}[hb]
  \lastminidocument
\end{figure}

I have

\usepackage{minidocument}
\def\minidocumentscale{0.25}
\usepackage{blindtext}

before the \begin{document}.

Citations have space after them

Whenever I use \sidecite before a punctuation mark like a point or a comma, there is a space before it.
space before bracket
This is a minor detail but it's bugging me. I am using the \sidecite command wrong somehow?

File 'kao.def' not found

I'm not able to compile report-template.tex:

$ pdflatex report-template
This is pdfTeX, Version 3.14159265-2.6-1.40.18 (TeX Live 2017) (preloaded format=pdflatex)
 restricted \write18 enabled.
entering extended mode
(./report-template.tex
LaTeX2e <2017-04-15>
Babel <3.10> and hyphenation patterns for 84 language(s) loaded.
(./kaohandt.cls
Document Class: kaohandt 2019/06/05 v1.0 kaohandt class v1.0
(/usr/local/texlive/2017/texmf-dist/tex/latex/koma-script/scrartcl.cls
Document Class: scrartcl 2017/04/13 v3.23 KOMA-Script document class (article)
(/usr/local/texlive/2017/texmf-dist/tex/latex/koma-script/scrkbase.sty
(/usr/local/texlive/2017/texmf-dist/tex/latex/koma-script/scrbase.sty
(/usr/local/texlive/2017/texmf-dist/tex/latex/graphics/keyval.sty)
(/usr/local/texlive/2017/texmf-dist/tex/latex/koma-script/scrlfile.sty
Package scrlfile, 2017/04/13 v3.23 KOMA-Script package (loading files)
                  Copyright (C) Markus Kohm

))) (/usr/local/texlive/2017/texmf-dist/tex/latex/koma-script/tocbasic.sty)
(/usr/local/texlive/2017/texmf-dist/tex/latex/koma-script/scrsize11pt.clo)
(/usr/local/texlive/2017/texmf-dist/tex/latex/koma-script/typearea.sty))

! LaTeX Error: File `kao.def' not found.

Type X to quit or <RETURN> to proceed,
or enter new name. (Default extension: def)

Enter file name:

Am I missing something (besides kao.def)?

Bibliography by chapter?

Hi! Im new using overleaf and Latex, so sorry in advance if my question is silly. I want to use this fantastic template but i need bibliography to be at the end of each chapter.

I finded a way but i get the expiration time error every single time!

Could you help me? Thank you very much!

Figures with tikzscale

I use kaobook to write my thesis. It includes a lot of tikz/pgfplots pictures, for nice schemes and plots. I also use the tikzscale package, to modify the figures dimensions while keeping line widths and font size consistent with the rest of the document.

However, the tikz plots do not take into account the dimensions of the minipage they are in, nor do they take into account the dimensions provided by the user. It leads to this kind of output:

image

Do you have any kind of workaround to make \includegraphics{file.tikz} work in the same way than \includegraphics{image.png} ? Here is a MWE to reproduce the problem:

\documentclass[
	fontsize=10pt, % Base font size
	twoside=false, % Use different layouts for even and odd pages (in particular, if twoside=true, the margin column will be always on the outside)
	numbers=noenddot, % Comment to output dots after chapter numbers; the most common values for this option are: enddot, noenddot and auto (see the KOMAScript documentation for an in-depth explanation)
]{kaobook}

% Choose the language
\usepackage[english]{babel} % Load characters and hyphenation
\usepackage[english=british]{csquotes}	% English quotes

% Load packages for testing
\usepackage{blindtext}

% Load the bibliography package
\usepackage{styles/kaobiblio}
\addbibresource{book-template.bib} % Bibliography file

%----------------------------------------------------------------------------------------
%	tikz options
%----------------------------------------------------------------------------------------
\usepackage{tikzscale} % tikz already loaded
\usepackage{pgfplots}
\pgfplotsset{compat=newest}

% Auto save tikz plots to avoid recompilation each time
\usepgfplotslibrary{external}
% Even if optimize=false, figures are externalized (this option was required to make it work...)
% Something to do with KOMA?
\tikzexternalize[optimize=false,only named=true]

%----------------------------------------------------------------------------------------

\begin{document}

%----------------------------------------------------------------------------------------
%	BOOK INFORMATION
%----------------------------------------------------------------------------------------
\titlehead{Document Template}
\title[Template for the {\normalfont\texttt{kaobook}} Class]{Template for the {\normalfont\texttt{kaobook}} Class}
\author[JBG]{Johnny B. Goode}
\date{\today}
\publishers{An Awesome Publisher}
%----------------------------------------------------------------------------------------
\frontmatter % Denotes the start of the pre-document content, uses roman numerals
% If twoside=false, \uppertitleback and \lowertitleback are not printed
% To overcome this issue, we set twoside=semi just before printing the title pages, and set it back to false just after the title pages
\KOMAoptions{twoside=semi}
\maketitle
\KOMAoptions{twoside=false}

%----------------------------------------------------------------------------------------
%	MAIN BODY
%----------------------------------------------------------------------------------------
\mainmatter % Denotes the start of the main document content, resets page numbering and uses arabic numbers
\setchapterstyle{kao} % Choose the default chapter heading style

\chapter{First Chapter}

\begin{marginfigure}
   \includegraphics[width=0.5cm, height=1cm]{rectangle.tikz} % Dimensions inside [] will be ignored, and the figure won't be distorted nor resized to match the margin width.
   \label{a-label}
   \caption{A rectangle}
\end{marginfigure}

\blindtext

\begin{figure}[h]
   \includegraphics[width=50cm, height=20cm]{plot.tikz} % Dimensions inside [] also ignored; the plots inside an 'axis' environment all have a square aspect
   \label{another-label}
   \caption{A plot}
\end{figure}


\end{document}

The file rectangle.tikz:

\tikzsetnextfilename{rectangle}

\begin{tikzpicture}[]
   \draw[semithick] (-8,0) rectangle +(8,2);
\end{tikzpicture}

The file plot.tikz:

\tikzsetnextfilename{plot}

\begin{tikzpicture}
   \begin{axis}[
      ]
      % density of Normal distribution:
      \addplot [
      red,
      domain=-3e-3:3e-3,
      samples=201,
      ]
      {exp(-x^2 / (2e-3^2)) / (1e-3 * sqrt(2*pi))};
   \end{axis}
\end{tikzpicture}

Thanks a lot, and congratulations for you work on this class!

Getting part name the chapter is in

I try to get a part name a chapter, section, subsection resides in. So far I only managed to find \p@chapter that adds prefix to the counter. That works, but I cannot make it universal. I mean, I see no way to add another function like the ones from references.sty that could show a reference like: "Chapter B (Some title) on page 33 in Appendix". Is there a way to do that (appendix here is obviously a part)?
As a side note - I found that there are no refsubsec and similar functions. I added them on my own as I use subsections quite often, but think they could be generally useful in kaobook as well.

coloring chapters, sections, etc

hello,

is it possible to color referred chapters, sections, etc? for instance, it could be nice if the \refch produces a chapter No in colors

Subsection numbering

Hi @fmarotta! First of all, I would like to say thank you for your work. I'm using your template to write my doctorate thesis. So, my question: how I can number subsections too? I tried to have a look here, in the issues tracker, but I did not find what I was looking for. Also, I tried to manage the job myself, but it was not as easy as I thought.

Using the template I also discovered and fixed some problems with Biber (I use to write the bibliography using BibTeX). As soon as I finish the thesis, I will open a pull request with my changes. Then, you will decide if you want to keep them as a separate branch or merge in somehow in the repo.

In the meantime, thank for your time and help.

Missing link to example PDF?

On the README page, in this sentence "If you think that a PDF is worth a thousand words, have a look at this.", the word "this" is supposed to be hyperlinked to an example PDF, but the link is broken.

Changing Chapter/Section Header Fonts

Hi all!

I was wondering if anyone would be able to give me any pointers on how to change the font of the Chapter or (Sub)Section fonts.

I've been able to change the body text through setmainfont , but can't figure out how to do so for headers. I'd like the headers to use the sans font, and the body to use the serif.

Cheers,
Joseph

Marginfigure not correctly placed in LoF

I have had some problems with the LoF. Marginfigures are vertically shifted (placed inter chapter gap) in the ToF and presented in an incorrect order.
ToF_Problem

By changing the kaobook's definition of marginfigure ...

\newsavebox{\@kao@marginfigurebox}%
\renewenvironment{marginfigure}[1][0pt]{ % The optional parameter is the vertical offset
	%\let\footnotemark\mpfootnotemark
	\FloatBarrier % Force LaTeX to place previous floats
	\mparshift{\snotez@if@nblskip{#1}{\@cdr#1\@nil\baselineskip}{#1}} % Move the figure up or down according to the offset argument
	\begin{lrbox}{\@sidenotes@marginfigurebox}%
		\begin{minipage}{\marginparwidth}%
			\captionsetup{type=figure}%
			% \centering % Better not to center margin figures
}{%
		\end{minipage}%
	\end{lrbox}%
	\marginpar{\usebox{\@sidenotes@marginfigurebox}} % Place the figure box in the margin
}

... back to the one of sidenotes (with minor changes) ...

\RenewDocumentEnvironment{marginfigure} { o } 
{
  \begin{lrbox}{\@sidenotes@marginfigurebox}
    \begin{minipage}{\marginparwidth}
      \captionsetup{type=figure}
}
{
    \end{minipage}%
  \end{lrbox}%
  \@sidenotes@placemarginal{#1}{\usebox{\@sidenotes@marginfigurebox}}
}

... is the issue resolved.

I have attached a zip-file with a MWE, modified kao.sty, the output from the original kao.sty and the output from the modified kao.sty

Edit: Included an incorrect code snippet of the correction

ToF_issue.zip

Make float and offset work across pages

Fairly common event I run into: I position a marginfigure somewhere near the bottom of the page, using just the regular floating or using a negative offset (e.g. *-10). Later, I add more text somewhere earlier in the same chapter, pushing the marginfigure to the next page, even though, the text that I had it next to is still on the prevous page. However, the marginfigure won't stay near that text because floating/offsetting doesn't work across pages. Is there any way to make floating/offsetting work across pages (e.g. so if the offest if sufficiently large or if the page is sufficiently full of marginfigures, it will push the marginfigure to the preceding page)?

Using other languages with varioref

The documentation of varioref states that it can be used together with babel to change the output language but babel has to be loaded first.
Additionally, the language options have to be sent to varioref when loading it.

My current solution is to modify kaorefs with

\usepackage[french,english]{babel} % Load characters and hyphenation
\RequirePackage[french,english]{varioref}

And it seems to work, but it doesn't seem ideal. Maybe the language arguments should be passed on to the class?

Acronyms in F32

In Fedora 32 I cannot see acronyms. I got the list of 'Notation' and the 'Greek letters' but then nothing.

It gets solved by doing a sudo dnf install perl-Env ncurses-compat-libs...

Float(s) lost

Whenever I try to use a sidenote within one of the environments from mdftheorems I get a "Float(s) lost" error. If I try to use a marginnote it works fine. Is there any way to make it work?

References to part use wrong numbering

When parts aren't numbered (which is the default with kaobook), references to parts are partly wrong. It seems they will use the number of the preceding section instead (in my cases it write Part 10.3since the part follows chapter 10 which has 3 sections). The hyperref, name and page are all correct though.
I expect it's just a matter of counter.

Package babel Error: You haven't defined the language italian yet.

From a raw report-template.tex
Don't know if I've missed something in my latex config

! Package babel Error: You haven't defined the language italian yet.

See the babel package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.80 \iflanguage{italian}
                         {
)
! Emergency stop.
<*> kaobiblio.sty

Can't change papersize

Hi, I'm using kaobook to adapt it to a project in which the page size is 21 x 27 cm (plus 1 cm per side to add the crop marks with the crop package that didn't work either, but I think I'll open another issue if I don't solve it).

The weird thing is that even when I declare the page size in the preamble, as I would do with KOMA Script, the resulting pdf size is still A4. I've searched through the class and package files looking for any size restrictions, but I haven't found anything so I'm here to ask.

What I have modified so far is only this:

\documentclass[%
fontsize=10pt,
twoside=true,
paper=22cm:28cm,
pagesize=pdftex,
% open=any,
secnumdepth=1,
chapterprefix=true,
%chapterentreydots=true,
numbers=noenddot,
%draft=true, 
%overfullrule=true, 
]{kaobook}
\usepackage[spanish,mexico]{babel}
%\usepackage[width=22truecm, height=28truecm, cam, cross, frame, axes, info, pdflatex, center]{crop}
\usepackage[spanish=mexican]{csquotes}

Overlapping TODO, sidenote, sidetoc and sidecite

It seems unfortunately that all these features (margin TODOs, sidenotes, side table of contents and side citations) do not always behave together.

In the documentation example, if I change the begging of introduction.tex with

\section{The Main Ideas}

\todo{This is a TODO}

Many modern printed textbooks have adopted a layout with prominent
margins where small\sidenote{A sidenote} figures\sidecite{Visscher2008,James2013}, tables, remarks and just about everything

The result (using one extra pdflatex invocation than the suggested compilation procedure) doesn't seem desirable.
screenshot

As you can see, everything overlaps which is a bit sad. I expect this is going to be a tough one to solve though. But just in case.

DIscussion: release scheme

i would be reality convenient for the end-user to have a release section, where one can download different versions of your class (for some reason, someone maybe interested in an older version)

Another reason is that you can "safely" implement any experimentation you want without (potentially) breaking your current-stable class.

Therefore, I propose a release scheme of the form x.y.z, where x= stable version, y=minor fixes, z= experimental enhancements

Discussion: How are you setting up the mathematical statements?

In my experience, when we set up theorems and other mathematical statements, we can choose the style with some valid option for \theromrestyle.

However, reviewing the mdftheorems.sty file I couldn't find out how you're controlling this, so, if I have (for example) a definition that I want to appear in plain style but then a remark that appears with break style I can't find out how to make such adjustments.

what is kao's idea for achieving this?

Hyphenation is not loaded under XeLaTeX/LuaLaTeX

hello again,

i am facing problem with hyphenation. In particular, polyglossia seems to not load the hyphenation pattern for the greek language. Since i am using MikTex, i tried to rebuild the luatex format, but the problem persists (actually, the problem remains if TexLive is used instead)

i haven't test it for the english language, though.

Edit: i don't know if this issue is related to compatibility issues with the varioref package (especially polyglossia)

Wide equations

Wide figures and wide tables are great. How do we do wide equations? I currently have some equations that overflow into the margin, which gives me an ovefull \hbox warning, but more importantly, I think LaTeX tries to squish the equation because it detects it is out of space, even though it has plenty of space on the page (just not without the margin).

Failed compilation on Mac

While trying to compile on a Mac the following message appears

! LaTeX Error: Command \counterwithout already defined.
               Or name \end... illegal, see p.192 of the manual.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.42 ...thout}{\@ifstar{\c@t@soutstar}{\c@t@sout}}
                                                  
?

The problem doesn't appear on a Linux based Operating System.

Feauture Request: Upload kaobook on CTAN

I am a big fun of kaobook class and I believe that you have done excellent job on its development/maintenance.

By uploading on CTAN kaobook will attract more attention, thus:

(1) you will have more feedback and more help on improving/bug solving,
(2) more consistent use of the class, especially for not so experienced LaTeX users -like me

I do not know the requirements that kaobook must fulfill in order to be accepted on CTAN.
and/or the time and effort you must spend on it. However, I believe that it's a decision that you must consider for the (near) future.

Activating the .sty file

I like this design a lot. I cloned the GIT but, because I rely mostly on TeXLive, it's been a long time since I had to integrate new .sty files. I had forgotten the details: I had to put the clone in a local 'texmf' directory (.../txmf/tex/latex/kaobook/) and then 'kpsewhich kao.sty' to verify LaTeX would find the files. Might possibly mention this the README.

textcite-like functionality with sidecite

Is there a way to get \textcite-like functionality with the \sidecite command? For example, say I want to reference the author's name in the text and have the citation information in the margin. I'm currently using \authorcite{x} \sidecite{x} to get the desired functionality. Is this how textual citations are intended to be done in the kaobook package, or is the plan to add additional \sidecite options or commands to get this functionality in a single command?

How to remove the space after a citation

Dear Federico,
I have been using your fantastic template for the last months to write my thesis, I wanted to thank you very much, I love it !
I managed to modify everything I wanted to change in your template, but there is just one point I could not solve :
there is always a space after the citation, i.e. my output looks like [33] blabla and I would like to have by default [33]blabla. Can you help me ??
Thank you again !

Referencing mutliple sections/figures/equations/etc. at once

Any chance there are plans for either of the following additions:

  1. add functionality to the referencing commands to reference multiple labels at once
  2. make the package compatible with cleveref

For example, when I use cleveref, I'm used to doing something like \cref{sec:1,sec:2} and getting "Sections 1 and 2" as output or doing something like \cref{eq:1,eq:2,eq:3,eq:4} and getting "Equations (1) to (4)" as output.

However, I believe the current solution in kaobook is to do \refeq{1}, \refeq{2}, \refeq{3}, and \refeq{4} to get "Equation 1, Equation 2, Equation 3, and Equation 4" as output or do \refeq{1} to \refeq{4} to get "Equation 1 to Equation 4" as output.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.