- Fix WrapBoxout.
- Migrate from wrapfig2 to wrapstuff. - Miscellaneous improvements.
This commit is contained in:
@@ -1,22 +1,24 @@
|
||||
\NeedsTeXFormat{LaTeX2e}
|
||||
\ProvidesPackage{PrimeTeX/packages/Caption}[2025-08-20]
|
||||
|
||||
\RequirePackage[
|
||||
hypcap=true,
|
||||
]{caption}
|
||||
\captionsetup{
|
||||
justification = Centering,
|
||||
font = {
|
||||
small,
|
||||
color=caption,
|
||||
},
|
||||
\ProvidesExplPackage{PrimeTeX/packages/Caption}{2025-09-10}{1.0}{
|
||||
Custom Caption commands.
|
||||
}
|
||||
|
||||
% Define a justification style that is ragged on the side toward the outside of
|
||||
% the page. I. e. RaggedRight on
|
||||
% \RequirePackage{changepage}
|
||||
% \RequirePackage[
|
||||
% hypcap=true,
|
||||
% ]{caption}
|
||||
% \captionsetup{
|
||||
% justification = Centering,
|
||||
% font = {
|
||||
% small,
|
||||
% color=caption,
|
||||
% },
|
||||
% }
|
||||
|
||||
\DeclareCaptionJustification{RaggedOutside}{%
|
||||
% Define a justification style that is ragged on the side toward the outside of
|
||||
% the page. I. e. RaggedRight on
|
||||
%\RequirePackage{changepage}
|
||||
|
||||
\NewDocumentCommand{\RaggedOutside}{}{
|
||||
\ifthenelse{\boolean{isElectronic}}{%
|
||||
\RaggedRight%
|
||||
}{%
|
||||
@@ -29,15 +31,24 @@
|
||||
}%
|
||||
}
|
||||
|
||||
\ExplSyntaxOn
|
||||
\cs_new:Nn \__MyCaption_format_default: {\centering\small\color{caption}}
|
||||
|
||||
\keys_define:nn {MyCaption} {
|
||||
before .bool_set:N = \l_MyCaption_before_bool,
|
||||
before .initial:n = {false},
|
||||
|
||||
figure .code:n = {\str_set:Nn \l_MyCaption_type_str {figure}},
|
||||
|
||||
format .tl_set:N = \l_MyCaption_format_tl,
|
||||
format .initial:n = {\Centering\small\color{caption}},
|
||||
format .cs_set_protected:Np = \__MyCaption_format:,
|
||||
format .initial:n = {\__MyCaption_format_default:},
|
||||
|
||||
table .code:n = {\str_set:Nn \l_MyCaption_type_str {table}},
|
||||
skip .tl_set:N = \l_MyCaption_skip_tl,
|
||||
skip .initial:n = {\medskipamount},
|
||||
|
||||
table .code:n = {
|
||||
\str_set:Nn \l_MyCaption_type_str {table}
|
||||
\bool_set:Nn \l_MyCaption_before_bool {true}
|
||||
},
|
||||
|
||||
type .choices:nn = {figure,table}{
|
||||
\str_set:Ne \l_MyCaption_type_str {\l_keys_choice_tl}
|
||||
@@ -45,37 +56,52 @@
|
||||
type .initial:n = {figure},
|
||||
}
|
||||
|
||||
\tl_new:N \l_MyCaption_label_tl
|
||||
\tl_new:N \l_MyCaption_number_tl
|
||||
\str_new:N \l_MyCaption_label_str
|
||||
\str_new:N \l_MyCaption_number_str
|
||||
|
||||
\NewDocumentCommand{\MyCaption}{
|
||||
\NewDocumentEnvironment{MyCaption}{
|
||||
% #1: Key-value options.
|
||||
O{}
|
||||
% #2: Label
|
||||
m
|
||||
% #3: Caption
|
||||
m
|
||||
}{ \group_begin:
|
||||
\keys_set:nn {MyCaption} {#1}
|
||||
\str_case:en {\l_MyCaption_type_str} {
|
||||
{figure} {
|
||||
\addtocounter{figure}{1}
|
||||
\tl_set:Nn \l_MyCaption_label_tl {Figure}
|
||||
\tl_set:Nn \l_MyCaption_number_tl {
|
||||
\arabic{chapter}.\arabic{figure}
|
||||
}{
|
||||
\group_begin:
|
||||
\keys_set:nn {MyCaption} {#1}
|
||||
\str_case:en {\l_MyCaption_type_str} {
|
||||
{figure} {
|
||||
\refstepcounter{figure}
|
||||
\str_set:Nn \l_MyCaption_label_str {Figure}
|
||||
\str_set:Ne \l_MyCaption_number_str {
|
||||
\arabic{chapter}.\arabic{figure}
|
||||
}
|
||||
\addcontentsline{lof}{figure}{\protect\numberline{\l_MyCaption_number_str}\protect\ignorespaces~#3}
|
||||
}
|
||||
\addcontentsline{lof}{figure}{\l_MyCaption_number_tl\numberline#3}
|
||||
}
|
||||
{table} {
|
||||
\addtocounter{table}{1}
|
||||
\tl_set:Nn \l_MyCaption_label_tl {Table}
|
||||
\tl_set:Nn \l_MyCaption_number_tl {
|
||||
\arabic{chapter}.\arabic{table}
|
||||
{table} {
|
||||
\refstepcounter{table}
|
||||
\str_set:Nn \l_MyCaption_label_str {Table}
|
||||
\str_set:Ne \l_MyCaption_number_str {
|
||||
\arabic{chapter}.\arabic{table}
|
||||
}
|
||||
\addcontentsline{lot}{table}{\protect\numberline{\l_MyCaption_number_str}\protect\ignorespaces~#3}
|
||||
}
|
||||
\addcontentsline{lot}{table}{\l_MyCaption_number_tl\numberline#3}
|
||||
}
|
||||
}
|
||||
\l_MyCaption_format_tl
|
||||
\l_MyCaption_label_tl~\l_MyCaption_number_tl :~#3
|
||||
\label{#2}
|
||||
\group_end: }
|
||||
|
||||
\bool_if:NT \l_MyCaption_before_bool {
|
||||
\__MyCaption_insert_caption:nn {#2} {#3}
|
||||
}
|
||||
}{
|
||||
\bool_if:NF \l_MyCaption_before_bool {
|
||||
\__MyCaption_insert_caption:nn {#2} {#3}
|
||||
}
|
||||
\group_end:
|
||||
}
|
||||
|
||||
\cs_new:Nn \__MyCaption_insert_caption:nn {
|
||||
\setlength{\parskip}{\l_MyCaption_skip_tl}\par
|
||||
\__MyCaption_format:
|
||||
\l_MyCaption_label_str{}~\l_MyCaption_number_str :~#2
|
||||
\label{#1}
|
||||
\par
|
||||
}
|
||||
Reference in New Issue
Block a user