Lots of stuff.
This commit is contained in:
@@ -24,19 +24,29 @@
|
||||
|
||||
\tl_new:N \l_Boxout_title_tl
|
||||
|
||||
\cs_new:Nn \__Boxout_default_format: {
|
||||
\justifying
|
||||
\setlength{\parindent}{0pt}
|
||||
\setlength{\parskip}{\medskipamount}
|
||||
}
|
||||
|
||||
\keys_define:nn {Boxout} {
|
||||
innerspec .tl_set_e:N= \l_Boxout_innerspec_tl,
|
||||
innerspec .initial:e = {\c_Boxout_innerspec_tl},
|
||||
|
||||
warning .bool_set:N = \l_Boxout_warning_bool,
|
||||
warning .initial:e = {false},
|
||||
danger .code:n = {\int_set:Nn \l_Boxout_severity_int {4}},
|
||||
|
||||
warning .code:n = {\int_set:Nn \l_Boxout_severity_int {3}},
|
||||
|
||||
info .code:n = {\int_set:Nn \l_Boxout_severity_int {2}},
|
||||
|
||||
tip .code:n = {\int_set:Nn \l_Boxout_severity_int {1}},
|
||||
|
||||
severity .int_set:N = {\l_Boxout_severity_int},
|
||||
severity .initial:n = {0},
|
||||
|
||||
format .cs_set:Np = \__Boxout_format:,
|
||||
format .initial:n = {
|
||||
\justifying
|
||||
\setlength{\parindent}{0pt}
|
||||
\setlength{\parskip}{\medskipamount}
|
||||
},
|
||||
format .initial:n = {},
|
||||
}
|
||||
|
||||
\NewDocumentEnvironment{Boxout}{
|
||||
@@ -50,9 +60,23 @@
|
||||
+b
|
||||
}{ \group_begin:
|
||||
\keys_set:nn{Boxout}{#1}
|
||||
\bool_if:nT \l_Boxout_warning_bool {
|
||||
\colorlet{boxoutBGColor}{warningBGColor}
|
||||
\colorlet{boxoutFGColor}{warningFGColor}
|
||||
\int_case:nn \l_Boxout_severity_int {
|
||||
{1} {
|
||||
\colorlet{boxoutBGColor}{tipBGColor}
|
||||
\colorlet{boxoutFGColor}{tipFGColor}
|
||||
}
|
||||
{2} {
|
||||
\colorlet{boxoutBGColor}{infoBGColor}
|
||||
\colorlet{boxoutFGColor}{infoFGColor}
|
||||
}
|
||||
{3} {
|
||||
\colorlet{boxoutBGColor}{warningBGColor}
|
||||
\colorlet{boxoutFGColor}{warningFGColor}
|
||||
}
|
||||
{4} {
|
||||
\colorlet{boxoutBGColor}{dangerBGColor}
|
||||
\colorlet{boxoutFGColor}{dangerFGColor}
|
||||
}
|
||||
}
|
||||
\color{textColor}
|
||||
\label{box:#2}
|
||||
@@ -65,7 +89,7 @@
|
||||
% Yes header
|
||||
\expanded{\noexpand\begin{tblrBoxout}{\l_Boxout_innerspec_tl}}
|
||||
\SetCell{halign=c, font={\sbfamily\bfseries}}{#3}\\
|
||||
\__Boxout_format:\ignorespaces#4\\
|
||||
\__Boxout_default_format:\__Boxout_format:\ignorespaces#4\\
|
||||
\end{tblrBoxout}
|
||||
}
|
||||
\group_end: }{}
|
||||
@@ -88,12 +112,12 @@
|
||||
\begin{BigFloat}[
|
||||
type = generic,
|
||||
overhang = \l_BigFloat_overhang_dim,
|
||||
placement:e = \l_Float_placement_clist,
|
||||
placement:V = \l_Float_placement_clist,
|
||||
offset = \l_BigFloat_offset_fp,
|
||||
]
|
||||
\begin{Boxout}[
|
||||
innerspec:e = \l_Boxout_innerspec_tl,
|
||||
warning:e = \bool_to_str:N \l_Boxout_warning_bool,
|
||||
innerspec:V = \l_Boxout_innerspec_tl,
|
||||
severity:V = \l_Boxout_severity_int,
|
||||
]{#2}[#3]
|
||||
#4
|
||||
\end{Boxout}
|
||||
@@ -117,28 +141,29 @@
|
||||
width .initial:e = {\c_MarginBoxout_width_dim},
|
||||
}
|
||||
|
||||
\NewDocumentEnvironment{MarginBoxout}{
|
||||
\NewDocumentCommand{\MarginBoxout}{
|
||||
% #1: Key-value options.
|
||||
O{}
|
||||
% #2: Label.
|
||||
>{\TrimSpaces}m
|
||||
% #3: Caption
|
||||
O{}
|
||||
% #4: Body.
|
||||
+b
|
||||
% #4: Content.
|
||||
+m
|
||||
}{ \group_begin:
|
||||
\keys_set:nn {MarginBoxout} {#1}
|
||||
\marginalia[
|
||||
width = \l_MarginBoxout_width_dim,
|
||||
]{
|
||||
\begin{Boxout}[
|
||||
innerspec:e = \l_Boxout_innerspec_tl,
|
||||
warning:e = \bool_to_str:N \l_Boxout_warning_bool,
|
||||
innerspec:V = \l_Boxout_innerspec_tl,
|
||||
severity:V = \l_Boxout_severity_int,
|
||||
format = {\RaggedOutside},
|
||||
]{#2}[#3]
|
||||
#4
|
||||
\end{Boxout}
|
||||
}
|
||||
\group_end: }{}
|
||||
\group_end: }
|
||||
|
||||
\dim_const:Nn \c_WrapBoxout_width_dim {3in}
|
||||
\dim_const:Nn \c_WrapBoxout_justifywidth_dim {18em}
|
||||
@@ -190,7 +215,7 @@
|
||||
\l_Boxout_innerspec_tl,
|
||||
columns={\dim_use:N \l_WrapBoxout_width_dim}
|
||||
},
|
||||
warning:e = {\bool_to_str:N \l_Boxout_warning_bool},
|
||||
severity:V = \l_Boxout_severity_int,
|
||||
format = \__WrapBoxout_format:,
|
||||
]{#2}[#3]
|
||||
#4
|
||||
|
||||
Reference in New Issue
Block a user