Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the wide algorithm* environment and make its caption style consistent with kaobook #257

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 42 additions & 10 deletions kao.sty
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,9 @@
\RequirePackage{minted} % (must be loaded after floatrow and before scrhack)
\AtBeginDocument{\counterwithin{listing}{chapter}}
\fi
\RequirePackage[linesnumbered, plain, vlined]{algorithm2e} % Algorithms
\DeclareNewFloatType{algorithm}{placement=tbp,name=Algorithm,fileext=loa,within=chapter}

% \RequirePackage{atbegshi}
% \RequirePackage{perpage}
\let\c@abspage\relax
Expand Down Expand Up @@ -782,6 +785,19 @@
facing=yes,%
capposition=above% Put captions above the listings
}%
\floatsetup[algorithm]{% Captions for algorithms
style=kaofloat,%
margins=hangoutside,%
facing=yes,%
capbesideposition={top,outside},% Put captions in the margin
objectset=RaggedRight,%
}%
\floatsetup[widealgorithm]{% Captions for wide algorithms
margins=hangoutside,%
facing=yes,%
capposition=above,% Put captions above the algorithm
objectset=RaggedRight,%
}%
\else%
\floatsetup[figure]{% Captions for figures
style=kaofloat,%
Expand Down Expand Up @@ -826,6 +842,19 @@
facing=no,%
capposition=above% Put captions above the listings
}%
\floatsetup[algorithm]{% Captions for algorithms
style=kaofloat,%
margins=hangright,%
facing=yes,%
capbesideposition={top,right},% Put captions in the margin
objectset=RaggedRight,%
}%
\floatsetup[widealgorithm]{% Captions for wide algorithms
margins=hangright,%
facing=no,%
capposition=above,% Put captions above the algorithm
objectset=RaggedRight,%
}%
\fi%
\captionsetup*[lstlisting]{%
format=llap,%
Expand All @@ -839,32 +868,32 @@
\floatsetup[figure]{ % Captions for figures
capposition=bottom,%
margins=centering,%
floatwidth=\textwidth%
floatwidth=\textwidth,%
}
\floatsetup[widefigure]{ % Captions for wide figures
margins=hangoutside, % Put captions below the figure
facing=yes,%
capposition=bottom%
capposition=bottom,%
}
\floatsetup[table]{ % Captions for tables
capposition=above,%
margins=centering,%
floatwidth=\textwidth%
floatwidth=\textwidth,%
}
\floatsetup[widetable]{ % Captions for wide tables
margins=hangoutside, % Put captions above the table
facing=yes,%
capposition=above%
capposition=above,%
}
\floatsetup[lstlisting]{ % Captions for lstlistings
capposition=above,%
margins=centering,%
floatwidth=\textwidth%
floatwidth=\textwidth,%
}
\floatsetup[listing]{ % Captions for listings (minted package)
capposition=above,%
margins=centering,%
floatwidth=\textwidth%
floatwidth=\textwidth,%
}
\captionsetup*[lstlisting]{% Captions style for lstlistings
%format=margin,%
Expand All @@ -874,7 +903,13 @@
parindent=0pt,%
aboveskip=6pt,%
belowskip=6pt,%
belowskip=-0.1cm%
belowskip=-0.1cm,%
}
\floatsetup[algorithm]{ % Captions for algorithms
capposition=above,%
margins=centering,%
floatwidth=\textwidth,%
objectset=RaggedRight,%
}
}

Expand Down Expand Up @@ -1384,9 +1419,6 @@
%\fvset{fontsize=\normalsize} % Change here the font size of all
%verbatim \preto{\@verbatim}{\topsep=0pt \partopsep=0pt }

% Algorithms
\RequirePackage[linesnumbered, ruled, vlined]{algorithm2e} % Algorithms

% Special gliphs
\RequirePackage{ccicons} % Creative Commons icons

Expand Down
Loading